This is an archive of the discontinued LLVM Phabricator instance.

[llvm-objcopy][MachO] Support indirect symbol table
ClosedPublic

Authored by seiya on Aug 15 2019, 2:36 AM.

Details

Summary

Parse the indirect symbol table and update the indexes of
symbol entries in the table in the writer in case they have
been changed.

Event Timeline

seiya created this revision.Aug 15 2019, 2:36 AM
seiya planned changes to this revision.Aug 15 2019, 3:06 AM

I'll upload a test for this later.

rupprecht added inline comments.Aug 15 2019, 2:04 PM
llvm/tools/llvm-objcopy/MachO/MachOReader.cpp
261–263

Can this be simplified to a bitmask check? e.g.:

if (Index & (MachO::INDIRECT_SYMBOL_LOCAL | MachO::INDIRECT_SYMBOL_ABS) != 0)
seiya updated this revision to Diff 215816.Aug 18 2019, 10:05 PM
seiya marked an inline comment as done.
  • Addressed a review comment.
  • Added a test.
seiya updated this revision to Diff 215817.Aug 18 2019, 10:06 PM
  • Updated the test.
Harbormaster completed remote builds in B36929: Diff 215817.
rupprecht accepted this revision.Sep 24 2019, 1:53 PM

LGTM, but @alexshap can you review the Mach-O logic?

llvm/tools/llvm-objcopy/MachO/MachOReader.cpp
262

For readability, you might want to extract uint32_t AbsOrLocalMask = MachO::INDIRECT_SYMBOL_LOCAL | MachO::INDIRECT_SYMBOL_ABS

This revision is now accepted and ready to land.Sep 24 2019, 1:53 PM
seiya updated this revision to Diff 222343.Sep 29 2019, 8:13 PM

Addressed a review comment.

seiya marked an inline comment as done.Sep 29 2019, 8:17 PM
seiya updated this revision to Diff 222540.Sep 30 2019, 8:13 PM

clang-formatted

llvm/tools/llvm-objcopy/MachO/Object.h
116

I'd extend this comment a little bit by saying that the higher bits of this Index encode that extra information (if it is INDIRECT_SYMBOL_LOCAL or INDIRECT_SYMBOL_ABS), so that there is this extra hidden structure.

seiya updated this revision to Diff 223123.Oct 3 2019, 5:19 PM
  • Added a comment.
seiya marked an inline comment as done.Oct 3 2019, 5:20 PM
This revision was automatically updated to reflect the committed changes.