[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
This commit is contained in:
Jez Ng 2021-06-16 15:23:07 -04:00
parent eeac6b2bec
commit 560636e549
2 changed files with 17 additions and 8 deletions

View File

@ -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)

View File

@ -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