2021-01-03 02:31:55 +08:00
|
|
|
# REQUIRES: x86
|
|
|
|
|
|
|
|
# RUN: rm -rf %t && mkdir -p %t
|
|
|
|
# RUN: llvm-mc -filetype=obj -triple=x86_64-apple-darwin %s -o %t/test.o
|
|
|
|
# RUN: %lld -execute -o %t/exec %t/test.o -lSystem
|
|
|
|
# RUN: %lld -dylib -o %t/dylib %t/test.o -lSystem
|
|
|
|
# RUN: %lld -bundle -o %t/bundle %t/test.o -lSystem
|
|
|
|
|
|
|
|
# RUN: llvm-objdump --macho --all-headers %t/exec | \
|
|
|
|
# RUN: FileCheck %s --check-prefixes=EXEC,COMMON
|
|
|
|
# RUN: llvm-objdump --macho --all-headers %t/dylib | \
|
|
|
|
# RUN: FileCheck %s --check-prefixes=DYLIB,COMMON
|
|
|
|
# RUN: llvm-objdump --macho --all-headers %t/bundle | \
|
2021-02-09 05:44:29 +08:00
|
|
|
# RUN: FileCheck %s --check-prefix=COMMON
|
2021-01-03 02:31:55 +08:00
|
|
|
|
|
|
|
## Check that load commands and sections within segments occur in the proper
|
|
|
|
## sequence. On ARM64 kernel is especially picky about layout, and will
|
|
|
|
## barf with errno=EBADMACHO when the sequence is wrong.
|
|
|
|
|
|
|
|
# EXEC: cmd LC_SEGMENT_64
|
|
|
|
# EXEC: segname __PAGEZERO
|
|
|
|
|
|
|
|
# COMMON: cmd LC_SEGMENT_64
|
|
|
|
# COMMON: segname __TEXT
|
|
|
|
# COMMON: sectname __text
|
|
|
|
# COMMON: segname __TEXT
|
|
|
|
# COMMON: sectname __cstring
|
|
|
|
# COMMON: segname __TEXT
|
|
|
|
# COMMON: cmd LC_SEGMENT_64
|
|
|
|
# COMMON: segname __DATA_CONST
|
|
|
|
# COMMON: sectname __got
|
|
|
|
# COMMON: segname __DATA_CONST
|
2021-05-26 02:57:17 +08:00
|
|
|
# COMMON: sectname __const
|
|
|
|
# COMMON: segname __DATA_CONST
|
2021-01-03 02:31:55 +08:00
|
|
|
# COMMON: cmd LC_SEGMENT_64
|
|
|
|
# COMMON: segname __DATA
|
|
|
|
# COMMON: sectname __data
|
|
|
|
# COMMON: segname __DATA
|
|
|
|
# COMMON: cmd LC_SEGMENT_64
|
|
|
|
# COMMON: segname __LINKEDIT
|
|
|
|
# COMMON: cmd LC_DYLD_INFO_ONLY
|
|
|
|
# COMMON: cmd LC_SYMTAB
|
|
|
|
# COMMON: cmd LC_DYSYMTAB
|
|
|
|
|
|
|
|
# EXEC: cmd LC_LOAD_DYLINKER
|
|
|
|
# DYLIB: cmd LC_ID_DYLIB
|
|
|
|
|
|
|
|
# COMMON: cmd LC_UUID
|
[lld-macho] Have tests default to targeting macos 10.15
D101114 enforced proper version checks, which exposed a variety of version
mismatch issues in our tests. We previously changed the test inputs to
target 10.0, which was the simpler thing to do, but we should really
just have our lit.local.cfg default to targeting 10.15, which is what is done
here. We're not likely to ever have proper support for the older versions
anyway, as that would require more work for unclear benefit; for instance,
llvm-mc seems to generate a different compact unwind format for older macOS
versions, which would cause our compact-unwind.s test to fail.
Targeting 10.15 by default causes the following behavioral changes:
* `__mh_execute_header` is now a section symbol instead of an absolute symbol
* LC_BUILD_VERSION gets emitted instead of LC_VERSION_MIN_MACOSX. The former is
32 bytes in size whereas the latter is 16 bytes, so a bunch of hardcoded
address offsets in our tests had to be updated.
* >= 10.6 executables are PIE by default
Note that this diff was stacked atop of a local revert of most of the test
changes in rG8c17a875150f8e736e8f9061ddf084397f45f4c5, to make review easier.
Reviewed By: #lld-macho, oontvoo
Differential Revision: https://reviews.llvm.org/D101119
2021-04-23 07:37:47 +08:00
|
|
|
# COMMON: cmd LC_BUILD_VERSION
|
2021-07-17 23:18:48 +08:00
|
|
|
|
|
|
|
# EXEC: cmd LC_MAIN
|
|
|
|
|
2021-01-03 02:31:55 +08:00
|
|
|
# COMMON: cmd LC_LOAD_DYLIB
|
|
|
|
|
|
|
|
.section __TEXT,__cstring
|
|
|
|
_str:
|
|
|
|
.asciz "Help me! I'm trapped in a test!\n"
|
|
|
|
|
|
|
|
.globl _mutable
|
|
|
|
.section __DATA,__data
|
|
|
|
mutable:
|
|
|
|
.long 0x1234
|
|
|
|
|
|
|
|
.globl _constant
|
|
|
|
.section __DATA,__const
|
|
|
|
constant:
|
|
|
|
.long 0x4567
|
|
|
|
|
|
|
|
.text
|
|
|
|
.global _main
|
|
|
|
_main:
|
|
|
|
mov ___nan@GOTPCREL(%rip), %rax
|
|
|
|
ret
|