PIE.yaml 1.24 KB
# RUN: ld64.lld -arch x86_64 -macosx_version_min 10.8 %s \
# RUN: %p/Inputs/PIE.yaml -o %t  && \
# RUN: llvm-objdump --macho --private-headers %t | FileCheck %s
#
# RUN: ld64.lld -arch x86_64 -macosx_version_min 10.8 %s \
# RUN: %p/Inputs/PIE.yaml -pie -o %t\
# RUN:  &&  llvm-objdump --macho --private-headers %t | FileCheck %s
#
# RUN: ld64.lld -arch x86_64 -macosx_version_min 10.8 %s \
# RUN: %p/Inputs/PIE.yaml -no_pie -o %t\
# RUN:  &&  llvm-objdump --macho --private-headers %t \
# RUN:  | FileCheck --check-prefix=CHECK_NO_PIE %s
#
# Test various PIE options.
#

--- !mach-o
arch:            x86_64
file-type:       MH_OBJECT
flags:           [ MH_SUBSECTIONS_VIA_SYMBOLS ]
has-UUID:        false
OS:              unknown
sections:
  - segment:         __TEXT
    section:         __text
    type:            S_REGULAR
    attributes:      [ S_ATTR_PURE_INSTRUCTIONS, S_ATTR_SOME_INSTRUCTIONS ]
    address:         0x0000000000000000
    content:         [ 0xC3 ]
global-symbols:
  - name:            _main
    type:            N_SECT
    scope:           [ N_EXT ]
    sect:            1
    value:           0x0000000000000000

...

# CHECK:	          MH_MAGIC_64 {{[0-9a-zA-Z _]+}} TWOLEVEL PIE
# CHECK_NO_PIE-NOT:	MH_MAGIC_64 {{[0-9a-zA-Z _]+}} TWOLEVEL PIE