[PATCH] [ELF] LLD does not create a record in the .dynsym if a strong symbol defined in the executable file replaces a weak symbol from a shared library.

Shankar Easwaram shankarke at gmail.com
Wed Aug 13 19:46:29 PDT 2014


When the weak symbol in the shared library is resolved from another object file when building an executable that symbol would need to be exported.

I was suggesting to have a reference in the atom that if it needs to be exported, be set to exportDynamic during the resolution phase.

It could be recorded in the elf context as well but to be cleaner I felt that a reference used.

Does that sound the right way (or) I am over complicating things ?

Shankar Easwaran

> On Aug 13, 2014, at 19:51, "kledzik at apple.com" <kledzik at apple.com> wrote:
> 
> From the description of the problem, I thought that libfoo would have a weak definition of "flag" and main had a strong definition of "flag" and the problem was that the binaries were not set up properly so that ld.so would pick main's flag to override libfoo's flag.  
> 
> But looking at the example code,  "flag" is extern.  So this seems like the other meaning of weak - that the symbol can be missing at runtime.  But the use of "flag" in foo() is not checking if its address is NULL before accessing. But in this case it should not be NULL because ld.so should find it in main.
> 
> Which case is this?
> 
> What info is missing after resolve() is done?
> 
> http://reviews.llvm.org/D4789
> 
> 




More information about the llvm-commits mailing list