[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 21:41:11 PDT 2014


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 --------------
A non-text attachment was scrubbed...
Name: D5424.13902.patch
Type: text/x-patch
Size: 3366 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20140920/6d669c99/attachment.bin>


More information about the llvm-commits mailing list