Inline variable behaviour using c++17 across shared libraries differ for gcc and clang


I have been observing this behavior for past few days. My application is made up of several shared libraries. It seems like if I have a class in say a header file such as

class A{
    inline static int a = 0;

Now if i change the value in one source file in one shared library, the changes are reflected if i try to read this variable from some other source file of some other shared library in gcc.
but this doesnt happen for Clang. For Clang it just reads the value supplied in definition(seems like it just creates a local copy in each shared library context).

I know the inline specifier guarantees that the address of the variable will be same in every TU, applies to TU’s linking statically(say into a executable or within a shared library), but if I want to converge this behaviour for both gcc and Clang across boundaries, is there a way to do so?

My Clang version is 14.0.6 and running the binaries in linux environment.