seg-protection-x86_64.yaml 1.97 KB
# RUN: ld64.lld -arch x86_64 %s %p/Inputs/hello-world-x86_64.yaml -o %t && llvm-objdump --private-headers %t | FileCheck %s

--- !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:         [ 0x00, 0x00 ]
global-symbols:
  - name:            _main
    type:            N_SECT
    scope:           [ N_EXT ]
    sect:            1
    value:           0x0000000000000000
  - name:            start
    type:            N_SECT
    scope:           [ N_EXT ]
    sect:            1
    value:           0x0000000000000001

...

# CHECK: Load command 0
# CHECK:       cmd LC_SEGMENT_64
# CHECK:   cmdsize 72
# CHECK:   segname __PAGEZERO
# CHECK:    vmaddr
# CHECK:    vmsize
# CHECK:   fileoff
# CHECK:  filesize
# CHECK:   maxprot ---
# CHECK:   initprot ---
# CHECK:    nsects 0
# CHECK:     flags (none)
# CHECK: Load command 1
# CHECK:       cmd LC_SEGMENT_64
# CHECK:   cmdsize 152
# CHECK:   segname __TEXT
# CHECK:    vmaddr
# CHECK:    vmsize
# CHECK:   fileoff
# CHECK:  filesize
# CHECK:   maxprot rwx
# CHECK:   initprot r-x
# CHECK:    nsects 1
# CHECK:     flags (none)
# CHECK: Section
# CHECK:   sectname __text
# CHECK:    segname __TEXT
# CHECK:       addr
# CHECK:       size
# CHECK:     offset
# CHECK:      align 2^0 (1)
# CHECK:     reloff 0
# CHECK:     nreloc 0
# CHECK:       type S_REGULAR
# CHECK: attributes PURE_INSTRUCTIONS SOME_INSTRUCTIONS
# CHECK:  reserved1 0
# CHECK:  reserved2 0
# CHECK: Load command 2
# CHECK:       cmd LC_SEGMENT_64
# CHECK:   cmdsize 72
# CHECK:   segname __LINKEDIT
# CHECK:    vmaddr
# CHECK:    vmsize
# CHECK:   fileoff
# CHECK:  filesize
# CHECK:   maxprot rwx
# CHECK:   initprot r--
# CHECK:    nsects 0
# CHECK:     flags (none)