This is an archive of the discontinued LLVM Phabricator instance.

[yaml2obj] - Allow placing local symbols after globals.
ClosedPublic

Authored by grimar on Aug 27 2019, 5:21 AM.

Details

Summary

This allows us to produce broken binaries with local
symbols placed after global in '.dynsym'/'.symtab'

Also, simplifies the code.

Diff Detail

Event Timeline

grimar created this revision.Aug 27 2019, 5:21 AM
MaskRay added inline comments.Aug 27 2019, 5:29 AM
test/tools/yaml2obj/elf-symbols-binding-order.yaml
5 ↗(On Diff #217377)

--symbols dump both .symtab and .dynsym.

I think you can change the CHECK lines for .dynsym so that you can:

  1. test --dyn-symbols on .dynsym
  2. test --symbols on both .symtab and .dynsym
jhenderson added inline comments.Aug 27 2019, 5:52 AM
lib/ObjectYAML/ELFEmitter.cpp
998 ↗(On Diff #217377)

Maybe: for (size_t I = 0, S = V.size(); I < S; ++I)

test/tools/yaml2obj/elf-symbols-binding-order.yaml
5 ↗(On Diff #217377)

As this is just a yaml2obj test, I think we can just remove "--dyn-symbols". There would be no need to change the CHECK lines then.

grimar updated this revision to Diff 217823.Aug 29 2019, 3:42 AM
grimar marked 3 inline comments as done.
  • Addressed review comments.
lib/ObjectYAML/ELFEmitter.cpp
998 ↗(On Diff #217377)

Ok.

test/tools/yaml2obj/elf-symbols-binding-order.yaml
5 ↗(On Diff #217377)

I removed --dyn-symbols.

This revision is now accepted and ready to land.Aug 29 2019, 3:48 AM
MaskRay accepted this revision.Aug 29 2019, 4:01 AM
This revision was automatically updated to reflect the committed changes.
Herald added a project: Restricted Project. · View Herald TranscriptAug 29 2019, 4:01 AM
Herald added a subscriber: hiraditya. · View Herald Transcript