[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Tinycc-devel] Weak symbol problem

From: Thomas Preud'homme
Subject: Re: [Tinycc-devel] Weak symbol problem
Date: Mon, 18 Apr 2011 20:02:11 +0200
User-agent: KMail/1.13.5 (Linux/2.6.38-2-amd64; KDE/4.4.5; x86_64; ; )

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 address@hidden ~/local/test% cat orig-main.c 
void __attribute__((weak)) f();

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

19:42 address@hidden ~/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 -

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 
>   Daniel

Best regards and sorry for the delay.


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

reply via email to

[Prev in Thread] Current Thread [Next in Thread]