1# REQUIRES: x86
2# RUN: mkdir -p %t
3
4## codesign requires that each setion in __LINKEDIT ends where the next one
5## starts. This test enforces that invariant.
6## TODO: Test other __LINKEDIT sections here as support for them gets added.
7## Examples of such sections include the data for LC_CODE_SIGNATURE and
8## LC_DATA_IN_CODE.
9
10# RUN: llvm-mc -filetype=obj -triple=x86_64-apple-darwin %p/Inputs/libhello.s \
11# RUN:   -o %t/libhello.o
12# RUN: %lld -dylib \
13# RUN:   -install_name @executable_path/libhello.dylib %t/libhello.o \
14# RUN:   -o %t/libhello.dylib
15
16# RUN: llvm-mc -filetype=obj -triple=x86_64-apple-darwin %s -o %t/test.o
17# RUN: %lld -o %t/test \
18# RUN:   -L%t -lhello %t/test.o -lSystem
19
20# RUN: llvm-objdump --macho --all-headers %t/test | FileCheck %s
21
22# CHECK:      cmd LC_DYLD_INFO_ONLY
23# CHECK-NEXT: cmdsize 48
24# CHECK-NEXT: rebase_off 0
25# CHECK-NEXT: rebase_size 0
26# CHECK-NEXT: bind_off [[#BIND_OFF:]]
27# CHECK-NEXT: bind_size [[#BIND_SIZE:]]
28# CHECK-NEXT: weak_bind_off 0
29# CHECK-NEXT: weak_bind_size 0
30# CHECK-NEXT: lazy_bind_off [[#LAZY_OFF: BIND_OFF + BIND_SIZE]]
31# CHECK-NEXT: lazy_bind_size [[#LAZY_SIZE:]]
32# CHECK-NEXT: export_off [[#EXPORT_OFF: LAZY_OFF + LAZY_SIZE]]
33# CHECK-NEXT: export_size [[#]]
34
35.text
36.globl _main
37_main:
38  sub $8, %rsp # 16-byte-align the stack; dyld checks for this
39  callq _print_hello
40  add $8, %rsp
41  ret
42