This is an archive of the discontinued LLVM Phabricator instance.

[ELF] - do not create special symbols when creating relocatable output
ClosedPublic

Authored by grimar on Mar 1 2016, 9:50 AM.

Details

Summary

start_/_end_​<section-name> symbols and such ones like :
preinit_array_start/end
init_array_start/end
fini_array_start/end

should not be created by linker when creating relocatable files.
Patch fixes that, testcase is provided.

Diff Detail

Event Timeline

grimar updated this revision to Diff 49504.Mar 1 2016, 9:50 AM
grimar retitled this revision from to [ELF] - do not create special symbols when creating relocatable output.
grimar updated this object.
grimar added reviewers: ruiu, rafael.
grimar added subscribers: llvm-commits, grimar.
ruiu accepted this revision.Mar 1 2016, 9:58 AM
ruiu edited edge metadata.

LGTM

ELF/Writer.cpp
1004

Instead of here, please add "if (Config->Relocatable) return;" at beginning of addStartEndSymbols.

This revision is now accepted and ready to land.Mar 1 2016, 9:58 AM
grimar added inline comments.Mar 1 2016, 10:10 AM
ELF/Writer.cpp
1004

But what about addStartStopSymbols() ? Should I add the same there ? I not sure that it is good because will iterate over all RegularSections, thats not wasting but somewhat confusing to do that without reasons.

ruiu added inline comments.Mar 1 2016, 10:57 AM
ELF/Writer.cpp
1004

That makes sense. Let's go with your code then.

This revision was automatically updated to reflect the committed changes.
emaste added a subscriber: emaste.Mar 2 2016, 1:27 PM