This is an archive of the discontinued LLVM Phabricator instance.

[PATCH] [ELF] Fix .init_array initialization
ClosedPublic

Authored by zatrazz on Jun 24 2015, 6:36 AM.

Details

Summary

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 patch fixes the llvm test-suite regressions for both Single
and MultiSource files.

Diff Detail

Event Timeline

zatrazz updated this revision to Diff 28339.Jun 24 2015, 6:36 AM
zatrazz retitled this revision from to [PATCH] [ELF] Fix .init_array initialization.
zatrazz updated this object.
zatrazz edited the test plan for this revision. (Show Details)
zatrazz added reviewers: ruiu, shankar.easwaran.
zatrazz added a project: lld.
zatrazz added subscribers: Unknown Object (MLST), lld.
ruiu accepted this revision.Jun 24 2015, 8:38 AM
ruiu edited edge metadata.

LGTM

This revision is now accepted and ready to land.Jun 24 2015, 8:38 AM
zatrazz closed this revision.Jul 3 2015, 8:09 AM