[all-commits] [llvm/llvm-project] 1aa29d: [lld-macho] Support subtractor relocations that re...
Jez Ng via All-commits
all-commits at lists.llvm.org
Tue Apr 20 13:59:22 PDT 2021
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: 1aa29dffceff63c7f2bdecc03ec9c0922a100082
https://github.com/llvm/llvm-project/commit/1aa29dffceff63c7f2bdecc03ec9c0922a100082
Author: Jez Ng <jezng at fb.com>
Date: 2021-04-20 (Tue, 20 Apr 2021)
Changed paths:
M lld/MachO/Arch/ARM64.cpp
M lld/MachO/Arch/ARM64Common.cpp
M lld/MachO/Arch/ARM64_32.cpp
M lld/MachO/Arch/X86_64.cpp
M lld/MachO/InputFiles.cpp
M lld/MachO/InputSection.cpp
M lld/MachO/Writer.cpp
M lld/test/MachO/reloc-subtractor.s
Log Message:
-----------
[lld-macho] Support subtractor relocations that reference sections
The minuend (but not the subtrahend) can reference a section.
Note that we do not yet properly validate that the subtrahend isn't
referencing a section; I've filed PR50034 to track that.
I've also extended the reloc-subtractor.s test to reorder symbols, to
make sure that the addends are being associated with the minuend (and not
the subtrahend) relocation.
Fixes PR49999.
Reviewed By: #lld-macho, thakis
Differential Revision: https://reviews.llvm.org/D100804
Commit: bb62ef9943008281a2223c942c71e67b3902a07e
https://github.com/llvm/llvm-project/commit/bb62ef9943008281a2223c942c71e67b3902a07e
Author: Jez Ng <jezng at fb.com>
Date: 2021-04-20 (Tue, 20 Apr 2021)
Changed paths:
M lld/MachO/OutputSegment.h
M lld/MachO/Writer.cpp
M lld/test/MachO/bitcode-bundle.ll
M lld/test/MachO/bss.s
M lld/test/MachO/linkedit-contiguity.s
M lld/test/MachO/section-headers.s
M lld/test/MachO/segments.s
Log Message:
-----------
[lld-macho] Ensure segments are laid out contiguously
codesign/libstuff checks that the `__LLVM` segment is directly
before `__LINKEDIT` by checking that `fileOff + fileSize == next segment
fileOff`. Previously, there would be gaps between the segments due to
the fact that their fileOffs are page-aligned but their fileSizes
aren't. In order to satisfy codesign, we page-align fileOff *before*
calculating fileSize. (I don't think codesign checks for the relative
ordering of other segments, so in theory we could do this just for
`__LLVM`, but ld64 seems to do it for all segments.)
Note that we *don't* round up the fileSize of the `__LINKEDIT` segment.
Since it's the last segment, it doesn't need to worry about contiguity;
in addition, codesign checks that the last (hidden) section in
`__LINKEDIT` covers the last byte of the segment, so if we rounded up
`__LINKEDIT`'s size we would have to do the same for its last section,
which is a bother.
While at it, I also addressed a FIXME in the linkedit-contiguity.s test
to cover more `__LINKEDIT` sections.
Reviewed By: #lld-macho, thakis, alexshap
Differential Revision: https://reviews.llvm.org/D100848
Compare: https://github.com/llvm/llvm-project/compare/673e2f1b70dd...bb62ef994300
More information about the All-commits
mailing list