hanchenye-llvm-project/lld/test/elf/Inputs
Rafael Auler 6fd0afa195 [ELF] Fix bug in ELFFile::createAtoms() that caused lld to mislink musl
When creating the graph edges of the atoms of an ELF file, special care must be
taken with atoms that represent weak symbols. They cannot be the target of any
Reference::kindLayoutAfter edge because they can be merged and point to other
code, screwing up the final layout of the atoms. ELFFile::createAtoms()
correctly handles this corner case. The problem is that createAtoms() assumed
that there can be no zero-sized weak symbols, which is not true. Consider:

my_weak_func1:
my_weak_func2:
my_weak_func3:
code

In this case, we have two zero-sized weak symbols, my_weak_func1 and
my_weak_func2, and one non-zero weak symbol my_weak_func3. createAtoms() would
correctly handle my_weak_func3, but not the first two symbols. This problem
happens in the musl C library when a zero-sized weak symbol is merged and
screws up the file layout. Since this musl code lives at the finalization hooks,
any C program linked with LLD and musl was correctly executing, but segfaulting
at the end.

Reviewers: shankarke

http://reviews.llvm.org/D5606

llvm-svn: 219034
2014-10-03 22:50:50 +00:00
..
abs-test.i386
bar.o.x86-64
branch-test.hexagon
branch-test.ppc
consecutive-weak-defs.o.yaml [ELF] Fix bug in ELFFile::createAtoms() that caused lld to mislink musl 2014-10-03 22:50:50 +00:00
constants-merge.x86-64
constdata.x86-64
foo.o.x86-64
globalconst.c
globalconst.o.x86-64
gotpcrel.S
gotpcrel.x86-64
group-cmd-search-1.ls
group-cmd-search-2.ls
group-cmd-search-3.ls
ifunc.S
ifunc.cpp
ifunc.cpp.x86-64
ifunc.x86-64
init_array.x86-64
libfnarchive.a
libifunc.x86-64.so
libundef.so
libweaksym.so
main-with-global-def.o.yaml [ELF] Fix bug in ELFFile::createAtoms() that caused lld to mislink musl 2014-10-03 22:50:50 +00:00
mainobj.x86_64
object-test.elf-hexagon
object-test.elf-i386
phdr.i386
quickdata-sort-test.o.elf-hexagon
quickdata-sortcommon-test.o.elf-hexagon
quickdata-test.elf-hexagon
reloc-test.elf-i386
reloc-xb.x86
reloc-xt.x86
relocs-dynamic.x86-64
relocs.x86-64
responsefile
rodata-test.hexagon
rodata-test.i386
rodata.c
rodata.o
section-test.i386
shared.c
shared.so-x86-64
stripped-empty.x86_64
target-test.hexagon
target-test.ppc
tls.S
tls.c
tls.x86-64
tlsAddr.x86-64
tlsaddr.c
undef-from-main-so.c
undef-from-main.c
undef-pc32.o
undef.o
undef2-so.o.yaml
use-shared-32s.c
use-shared-32s.x86-64
use-shared.c
use-shared.x86-64
weaksym.o
writersyms.o
x86-64-relocs.S