[lld] 560636e - [lld-macho] Put DATA_IN_CODE immediately after FUNCTION_STARTS
Jez Ng via llvm-commits
llvm-commits at lists.llvm.org
Wed Jun 16 12:23:30 PDT 2021
Author: Jez Ng
Date: 2021-06-16T15:23:07-04:00
New Revision: 560636e5497a85d036a39ad5bf599d26828f66b3
URL: https://github.com/llvm/llvm-project/commit/560636e5497a85d036a39ad5bf599d26828f66b3
DIFF: https://github.com/llvm/llvm-project/commit/560636e5497a85d036a39ad5bf599d26828f66b3.diff
LOG: [lld-macho] Put DATA_IN_CODE immediately after FUNCTION_STARTS
codesign checks for this.
Reviewed By: #lld-macho, thakis
Differential Revision: https://reviews.llvm.org/D104354
Added:
Modified:
lld/MachO/OutputSegment.cpp
lld/test/MachO/linkedit-contiguity.s
Removed:
################################################################################
diff --git a/lld/MachO/OutputSegment.cpp b/lld/MachO/OutputSegment.cpp
index fda47ed3942f..1be19e2ffdc3 100644
--- a/lld/MachO/OutputSegment.cpp
+++ b/lld/MachO/OutputSegment.cpp
@@ -115,12 +115,13 @@ static int sectionOrder(OutputSection *osec) {
}
} else if (segname == segment_names::linkEdit) {
return StringSwitch<int>(osec->name)
- .Case(section_names::rebase, -9)
- .Case(section_names::binding, -8)
- .Case(section_names::weakBinding, -7)
- .Case(section_names::lazyBinding, -6)
- .Case(section_names::export_, -5)
- .Case(section_names::functionStarts, -4)
+ .Case(section_names::rebase, -10)
+ .Case(section_names::binding, -9)
+ .Case(section_names::weakBinding, -8)
+ .Case(section_names::lazyBinding, -7)
+ .Case(section_names::export_, -6)
+ .Case(section_names::functionStarts, -5)
+ .Case(section_names::dataInCode, -4)
.Case(section_names::symbolTable, -3)
.Case(section_names::indirectSymbolTable, -2)
.Case(section_names::stringTable, -1)
diff --git a/lld/test/MachO/linkedit-contiguity.s b/lld/test/MachO/linkedit-contiguity.s
index 63a11dbc7551..a67e86d247f4 100644
--- a/lld/test/MachO/linkedit-contiguity.s
+++ b/lld/test/MachO/linkedit-contiguity.s
@@ -6,8 +6,6 @@
## It also checks that the last section in __LINKEDIT covers the last byte of
## the segment.
-## FIXME: Include LC_DATA_IN_CODE in this test when we add support for it.
-
# RUN: llvm-mc -filetype=obj -triple=x86_64-apple-darwin %t/foo.s -o %t/foo.o
# RUN: %lld %t/foo.o -dylib -o %t/libfoo.dylib
@@ -38,6 +36,11 @@
# CHECK: cmd LC_FUNCTION_STARTS
# CHECK-NEXT: cmdsize
# CHECK-NEXT: dataoff [[#FUNCSTARTS_OFF: EXPORT_OFF + EXPORT_SIZE]]
+# CHECK-NEXT: datasize [[#FUNCSTARTS_SIZE:]]
+
+# CHECK: cmd LC_DATA_IN_CODE
+# CHECK-NEXT: cmdsize
+# CHECK-NEXT: dataoff [[#DIC_OFF: FUNCSTARTS_OFF + FUNCSTARTS_SIZE]]
# CHECK: cmd LC_CODE_SIGNATURE
# CHECK-NEXT: cmdsize 16
@@ -56,3 +59,8 @@ _main:
callq _foo
callq _weak_foo
ret
+
+.p2align 2, 0x90
+.data_region jt32
+.long 0
+.end_data_region
More information about the llvm-commits
mailing list