OSDN Git Service

Improve the --expand-relocs handling of MachO.
authorRafael Espindola <rafael.espindola@gmail.com>
Thu, 18 Jun 2015 22:38:20 +0000 (22:38 +0000)
committerRafael Espindola <rafael.espindola@gmail.com>
Thu, 18 Jun 2015 22:38:20 +0000 (22:38 +0000)
commit28b186f3cc9730ccae156ec0069465dea45e179e
tree5ceba309df930dd9ae699bdc0c23a3d6621b3ef9
parentd30c2356b0ef695310da842cfb0e6a0b12b2658b
Improve the --expand-relocs handling of MachO.

In a relocation target can take 3 basic forms

* A r_value in scattered relocations.
* A symbol in external relocations.
* A section is non-external relocations.

Have the dump reflect that. With this change we go from

CHECK-NEXT:       Extern: 0
CHECK-NEXT:       Type: X86_64_RELOC_SUBTRACTOR (5)
CHECK-NEXT:       Symbol: 0x2
CHECK-NEXT:       Scattered: 0

To just

// CHECK-NEXT:       Type: X86_64_RELOC_SUBTRACTOR (5)
// CHECK-NEXT:       Section: __data (2)

Since the relocation is with a section, we print the seciton name and don't
need to say that it is not scattered or external.

Someone motivated can add further special cases for things like
ARM64_RELOC_ADDEND and ARM_RELOC_PAIR.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@240073 91177308-0d34-0410-b5e6-96231b3b80d8
17 files changed:
lib/Object/MachOObjectFile.cpp
test/CodeGen/PowerPC/hello-reloc.s
test/MC/AArch64/arm64-leaf-compact-unwind.s
test/MC/MachO/AArch64/classrefs.s
test/MC/MachO/AArch64/darwin-ARM64-reloc.s
test/MC/MachO/AArch64/ld64-workaround.s
test/MC/MachO/AArch64/mergeable.s
test/MC/MachO/AArch64/reloc-crash.s
test/MC/MachO/AArch64/reloc-crash2.s
test/MC/MachO/ARM/static-movt-relocs.s
test/MC/MachO/darwin-x86_64-diff-reloc-assign-2.s
test/MC/MachO/darwin-x86_64-reloc.s
test/MC/MachO/reloc.s
test/MC/MachO/x86_64-mergeable.s
test/tools/llvm-readobj/relocations.test
test/tools/llvm-readobj/sections-ext.test
tools/llvm-readobj/MachODumper.cpp