[PATCH] [lld] [ELF] Fix linking when a regular object defines a symbol that is used in a DSO

Rafael Auler rafaelauler at gmail.com
Fri Sep 19 22:01:00 PDT 2014


On Sat, Sep 20, 2014 at 1:41 AM, Rafael Auler <rafaelauler at gmail.com> wrote:

> Hi ruiu, rafael, Bigcheese,
>
> When a shared lib has an undefined symbol that is defined in a regular
> object (the program), the final executable must export this symbol in the
> dynamic symbol table. However, in the current logic, lld only puts the
> symbol in the dynamic symbol table if the symbol is weak. This patch fixes
> lld to put the symbol in the dynamic symbol table regardless if it is weak
> or not.
>
> This caused a problem in FreeBSD10, whose programs link against a crt1.o
> that defines the symbol __progname, which is, in turn, undefined in
> libc.so.7 and will only be resolved in runtime.
>
> http://reviews.llvm.org/D5424
>
> Files:
>   include/lld/ReaderWriter/ELFLinkingContext.h
>   lib/ReaderWriter/ELF/ELFLinkingContext.cpp
>   lib/ReaderWriter/ELF/OutputELFWriter.h
>   test/elf/Inputs/defobj.o
>   test/elf/Inputs/libundef2.so
>   test/elf/undef-from-dso-to-main.test
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20140920/24057c8f/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: libundef2.so
Type: application/octet-stream
Size: 2511 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20140920/24057c8f/attachment.so>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: defobj.o
Type: application/octet-stream
Size: 729 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20140920/24057c8f/attachment.o>


More information about the llvm-commits mailing list