This is an archive of the discontinued LLVM Phabricator instance.

[llvm-objcopy] - Use replaceSectionReferences to update the sections for symbols in symbol table.
ClosedPublic

Authored by grimar on Mar 19 2019, 6:27 AM.

Details

Summary

If the compression was used and we had a symbol not involved in relocation,
we never updated its section and it was silently removed from the output.

Diff Detail

Repository
rL LLVM

Event Timeline

grimar created this revision.Mar 19 2019, 6:27 AM
grimar updated this revision to Diff 191284.Mar 19 2019, 6:31 AM
  • Rewrote the comment.

Nice catch. Should we remove the loop in RelocationSection::replaceSectionReferences that updates the symbols? I think that's unnecessary now, if we are looping over all symbols in the symbol table.

rupprecht accepted this revision.Mar 19 2019, 11:44 AM

lgtm modulo trying out jhenderson's suggestion

tools/llvm-objcopy/ELF/Object.h
533 ↗(On Diff #191284)

missing parameter name

This revision is now accepted and ready to land.Mar 19 2019, 11:44 AM
grimar updated this revision to Diff 191467.Mar 20 2019, 3:47 AM
grimar marked an inline comment as done.
  • Addressed review comments.

Should we remove the loop in RelocationSection::replaceSectionReferences that updates the symbols? I think that's unnecessary now, if we are looping over all symbols in the symbol table.

This should work I think, thanks! Done in the new diff.

This revision was automatically updated to reflect the committed changes.
Herald added a project: Restricted Project. · View Herald TranscriptMar 20 2019, 6:56 AM