Le samedi 15 mai 2010 04:13:49, Daniel Glöckner a écrit :
> Before I commit the following patch as fix, can somebody please look
> over it for side effects?
> 
> The patch marks all undefined weak symbols found in external libraries
> as strong. The value of all remaining weak symbols is set to zero just
> before the section is output.

You mean in external libraries we are linking with? Why is that necessary? 
AFAIU, this is not done by gcc. I did a small test:

19:41 robotux@cerclon ~/local/test% cat orig-main.c 
void __attribute__((weak)) f();

int main(void)
{
        if (f)
                f();
        return 0;
}

19:42 robotux@cerclon ~/local/test% cat definition_f.c 
#include <stdio.h>

int f(void)
{
        puts("Hello from f");
}

definition_f.c is compiled as a shared library named libf.so with -fPIC and -
shared

orig-main.c is then compiled to a .o and then linked with libf.so

nm on the resulting binary shows that f is still a weak reference.


Furthermore, I included your patch in Debian to give it a try and it still 
fails in the test 3 [1]
> 
> If this approach is correct, is it needed as well on FreeBSD, where
> the PLT offset is moved to the GOT?

I certainly lack knowledge for linkage: what do you mean by PLT offset. Do you 
mean the offset of the PLT from the beginning of the binary file? I thought it 
was *always* given by the p_offset field of the Elf(32|64)_Phdr structure of 
the 
PLT.
> 
>   Daniel

Best regards and sorry for the delay.

[1] 
https://buildd.debian.org/fetch.cgi?pkg=tcc&arch=armel&ver=0.9.25-6&stamp=1303102383&file=log

Attachment: signature.asc
Description: This is a digitally signed message part.

_______________________________________________
Tinycc-devel mailing list
[email protected]
http://lists.nongnu.org/mailman/listinfo/tinycc-devel

Reply via email to