linking of inline static methods
Martin v. Loewis
martin@loewis.home.cs.tu-berlin.de
Wed Jun 28 13:36:00 GMT 2000
> I don't think there is any bug in ld. In general, you don't use
> -Bsymbolic unless you know what you are doing. -Bsymbolic turns the
> global symbol references into local ones if there is a definition in
> the shared library. That is your problem.
I believe this is not the problem. On the assembler level, there is
only one definition of the symbol, namely in a file that goes into the
shared library. When linking, you suddenly get two definitions. One in
the shared library, and one in the executable. As a result, they will
be considered different under -Bsymbolic - that part is not
questioned.
What I don't understand is why the object needs to be copied into the
executable. Specifically, for the library, I get
00001930 D _16TestInlineStatic.staticVar
and for the executable, I get
0804984c B _16TestInlineStatic.staticVar
together with a relocation
0804984c R_386_COPY _16TestInlineStatic.staticVar
Why is it needed to copy the variable into the program image at run
time? Couldn't it live in the shared library just fine?
Regards,
Martin
More information about the Gcc
mailing list