llvm.org GIT mirror llvm / b2a17d0
[RuntimeDyld] Apply padding and alignment bumps to all sections with stubs, and increase the MachO/x86-64 stub alignment to 8. Stub alignment should be guaranteed for any section containing RuntimeDyld stubs/GOT-entries. To do this we should pad and align all sections containing stubs, not just code sections. This commit also bumps the MachO/x86-64 stub alignment to 8, so that GOT entries will be aligned. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@362139 91177308-0d34-0410-b5e6-96231b3b80d8 Lang Hames 1 year, 6 months ago
3 changed file(s) with 9 addition(s) and 9 deletion(s). Raw diff Collapse all Expand all
798798 pData = data.data();
799799 }
800800
801 // Code section alignment needs to be at least as high as stub alignment or
802 // padding calculations may by incorrect when the section is remapped to a
803 // higher alignment.
804 if (IsCode) {
801 // If there are any stubs then the section alignment needs to be at least as
802 // high as stub alignment or padding calculations may by incorrect when the
803 // section is remapped.
804 if (StubBufSize != 0) {
805805 Alignment = std::max(Alignment, getStubAlignment());
806 if (StubBufSize > 0)
807 PaddingSize += getStubAlignment() - 1;
806 PaddingSize += getStubAlignment() - 1;
808807 }
809808
810809 // Some sections, such as debug info, don't need to be loaded for execution.
2727
2828 unsigned getMaxStubSize() const override { return 8; }
2929
30 unsigned getStubAlignment() override { return 1; }
30 unsigned getStubAlignment() override { return 8; }
3131
3232 Expected
3333 processRelocationRef(unsigned SectionID, relocation_iterator RelI,
2121 movl x(%rip), %eax
2222
2323 # Test PC-rel GOT relocation.
24 # Verify both the contents of the GOT entry for y, and that the movq instruction
25 # references the correct GOT entry address:
24 # Verify the alignment of the GOT entry, the contents of the GOT entry for y,
25 # and that the movq instruction references the correct GOT entry address:
26 # rtdyld-check: stub_addr(test_x86-64.o/__text, y)[2:0] = 0
2627 # rtdyld-check: *{8}(stub_addr(test_x86-64.o/__text, y)) = y
2728 # rtdyld-check: decode_operand(insn3, 4) = stub_addr(test_x86-64.o/__text, y) - next_pc(insn3)
2829 insn3: