[ELF] Fix .init_array initialization
authorAdhemerval Zanella <adhemerval.zanella@linaro.org>
Wed, 24 Jun 2015 19:26:00 +0000 (19:26 +0000)
committerAdhemerval Zanella <adhemerval.zanella@linaro.org>
Wed, 24 Jun 2015 19:26:00 +0000 (19:26 +0000)
commit3ebea27d6663e63bf1421f1ce36f82cc475dd481
tree17c0247bc21c7d1e12bae8523929247f63e1f0e6
parent991af666f1520359175f1ca0e0fb4dbc6161ce73
[ELF] Fix .init_array initialization

Some compilers may not add the section symbol in '.symtab' for the
.init_array and 'ldd' just ignore it.  It results in global constructor
not being called in final executable.

This patch add both '.init_array' and '.fini_array' to be added in
Atom graph generation even when the section contains no symbol.  An
already existing testcase is modified to check for such scenario.

The issue fixes the llvm test-suite regressions for both Single
and MultiSource files.

llvm-svn: 240570
lld/lib/ReaderWriter/ELF/ELFFile.h
lld/test/elf/init_array.test