2014-06-30 17:49:37 +08:00
|
|
|
# RUN: lld -flavor darwin -arch x86_64 %s -o %t -e _foo
|
|
|
|
# RUN: llvm-readobj -sections -section-data %t | FileCheck %s
|
|
|
|
|
|
|
|
--- !native
|
|
|
|
defined-atoms:
|
|
|
|
# For __TEXT, __text (with typeCode)
|
|
|
|
- name: _foo
|
|
|
|
scope: global
|
|
|
|
content: [ 55 ]
|
|
|
|
# CHECK: Name: __text
|
|
|
|
# CHECK: Segment: __TEXT
|
|
|
|
# CHECK: SectionData (
|
2014-06-30 18:30:00 +08:00
|
|
|
# CHECK-NEXT: 0000: 55
|
2014-06-30 17:49:37 +08:00
|
|
|
# CHECK-NEXT: )
|
|
|
|
|
|
|
|
# For __TEXT, __const (with typeConstant),
|
|
|
|
- type: constant
|
|
|
|
content: [ 01, 00, 00, 00 ]
|
|
|
|
# From __TEXT, __literal4, (with typeLiteral4)
|
|
|
|
- scope: hidden
|
|
|
|
type: const-4-byte
|
|
|
|
content: [ 02, 00, 00, 00 ]
|
|
|
|
# From __TEXT, __literal8, (with typeLiteral8)
|
|
|
|
- scope: hidden
|
|
|
|
type: const-8-byte
|
|
|
|
content: [ 03, 00, 00, 00, 00, 00, 00, 00 ]
|
|
|
|
# From __TEXT, __literal16, (with typeLiteral16)
|
|
|
|
- scope: hidden
|
|
|
|
type: const-16-byte
|
|
|
|
content: [ 04, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00 ]
|
|
|
|
# CHECK: Name: __const
|
|
|
|
# CHECK: Segment: __TEXT
|
|
|
|
# CHECK: SectionData (
|
|
|
|
# CHECK-NEXT: 0000: 01000000 02000000 03000000 00000000
|
|
|
|
# CHECK-NEXT: 0010: 04000000 00000000 00000000 00000000
|
|
|
|
# CHECK-NEXT: )
|
|
|
|
|
|
|
|
# For __TEXT, __cstring (with typeCString)
|
|
|
|
- scope: hidden
|
|
|
|
type: c-string
|
|
|
|
content: [ 57, 69, 62, 62, 6C, 65, 00 ]
|
|
|
|
merge: by-content
|
|
|
|
# CHECK: Name: __cstring
|
|
|
|
# CHECK: Segment: __TEXT
|
|
|
|
# CHECK: SectionData (
|
|
|
|
# CHECK-NEXT: 0000: 57696262 6C6500
|
|
|
|
# CHECK-NEXT: )
|
|
|
|
|
|
|
|
# For __TEXT, __ustring (with typeUTF16String)
|
|
|
|
- scope: hidden
|
|
|
|
type: utf16-string
|
|
|
|
content: [ 05, 00 ]
|
|
|
|
merge: by-content
|
|
|
|
# CHECK: Name: __ustring
|
|
|
|
# CHECK: Segment: __TEXT
|
|
|
|
# CHECK: SectionData (
|
|
|
|
# CHECK-NEXT: 0000: 0500
|
|
|
|
# CHECK-NEXT: )
|
|
|
|
|
|
|
|
# For __TEXT, __gcc_except_tab, (with typeLSDA)
|
|
|
|
- name: GCC_except_table0
|
|
|
|
type: unwind-lsda
|
|
|
|
content: [ 06, 00 ]
|
|
|
|
# CHECK: Name: __gcc_except_tab
|
|
|
|
# CHECK: Segment: __TEXT
|
|
|
|
# CHECK: SectionData (
|
|
|
|
# CHECK-NEXT: 0000: 0600
|
|
|
|
# CHECK-NEXT: )
|
|
|
|
|
|
|
|
# For __TEXT, __eh_frame, (with typeCFI)
|
|
|
|
- type: unwind-cfi
|
|
|
|
content: [ 07 ]
|
|
|
|
# CHECK: Name: __eh_frame
|
|
|
|
# CHECK: Segment: __TEXT
|
|
|
|
# CHECK: SectionData (
|
|
|
|
# CHECK-NEXT: 0000: 07
|
|
|
|
# CHECK-NEXT: )
|
|
|
|
|
|
|
|
# For __DATA, __data, (with typeData)
|
|
|
|
- name: var
|
|
|
|
type: data
|
|
|
|
content: [ 08 ]
|
|
|
|
# CHECK: Name: __data
|
|
|
|
# CHECK: Segment: __DATA
|
|
|
|
# CHECK: SectionData (
|
|
|
|
# CHECK-NEXT: 0000: 08
|
|
|
|
# CHECK-NEXT: )
|
|
|
|
|
|
|
|
# For __DATA, ___bss (with typeZeroFill)
|
|
|
|
# FIXME: Attributes & tags of __bss are mostly broken. Should be at end of
|
|
|
|
# __DATA, should have size, should have S_ZEROFILL flag.
|
|
|
|
- type: zero-fill
|
|
|
|
size: 8
|
|
|
|
# CHECK: Name: ___bss
|
|
|
|
# CHECK: Segment: __DATA
|
|
|
|
|
|
|
|
# For __DATA, __const, (with typeConstData)
|
|
|
|
- type: const-data
|
|
|
|
content: [ 09, 00, 00, 00 ]
|
|
|
|
# CHECK: Name: __const
|
|
|
|
# CHECK: Segment: __DATA
|
|
|
|
# CHECK: SectionData (
|
|
|
|
# CHECK-NEXT: 0000: 09000000
|
|
|
|
# CHECK-NEXT: )
|
|
|
|
|
|
|
|
# For __DATA, __cfstring, (with typeCFString)
|
|
|
|
- type: cfstring
|
|
|
|
content: [ 0A, 00 ]
|
|
|
|
# CHECK: Name: __cfstring
|
|
|
|
# CHECK: Segment: __DATA
|
|
|
|
# CHECK: SectionData (
|
|
|
|
# CHECK-NEXT: 0000: 0A00
|
|
|
|
# CHECK-NEXT: )
|
|
|
|
|
|
|
|
# For __DATA, ___got (with typeGOT)
|
|
|
|
- type: got
|
|
|
|
content: [ 0B, 00, 00, 00, 00, 00, 00, 00 ]
|
|
|
|
# CHECK: Name: ___got
|
|
|
|
# CHECK: Segment: __DATA
|
|
|
|
# CHECK: SectionData (
|
|
|
|
# CHECK-NEXT: 0000: 0B000000 00000000
|
|
|
|
# CHECK-NEXT: )
|
|
|
|
|
|
|
|
|
|
|
|
# For __DATA, __mod_init_func (with typeInitializerPtr)
|
|
|
|
- type: initializer-pointer
|
|
|
|
content: [ 0C, 00, 00, 00, 00, 00, 00, 00 ]
|
|
|
|
# CHECK: Name: __mod_init_func
|
|
|
|
# CHECK: Segment: __DATA
|
|
|
|
# CHECK: SectionData (
|
|
|
|
# CHECK-NEXT: 0000: 0C000000 00000000
|
|
|
|
# CHECK-NEXT: )
|
|
|
|
|
|
|
|
# For __DATA, __mod_term_func (with typeTerminatorPointer)
|
|
|
|
- type: terminator-pointer
|
|
|
|
content: [ 0D, 00, 00, 00, 00, 00, 00, 00 ]
|
|
|
|
# CHECK: Name: __mod_term_func
|
|
|
|
# CHECK: Segment: __DATA
|
|
|
|
# CHECK: SectionData (
|
|
|
|
# CHECK-NEXT: 0000: 0D000000 00000000
|
|
|
|
# CHECK-NEXT: )
|
|
|
|
|
|
|
|
# FIXME: this should really end up in __TEXT,__unwind_info after being
|
|
|
|
# processed. Most important fact here is that its presence doesn't trigger an
|
|
|
|
# assert, but __LD,__compact_unwind is a harmless enough place to stash it.
|
|
|
|
|
|
|
|
- type: compact-unwind
|
|
|
|
content: [ 0E, 00, 00, 00, 00, 00, 00, 00 ]
|
|
|
|
# CHECK: Name: __compact_unwind
|
|
|
|
# CHECK: Segment: __LD
|
|
|
|
# CHECK: SectionData (
|
|
|
|
# CHECK-NEXT: 0000: 0E000000 00000000
|
|
|
|
# CHECK-NEXT: )
|
2014-07-17 03:49:02 +08:00
|
|
|
|
|
|
|
|
|
|
|
--- !mach-o
|
|
|
|
arch: x86_64
|
|
|
|
file-type: MH_DYLIB
|
|
|
|
flags: [ ]
|
|
|
|
install-name: /usr/lib/libSystem.B.dylib
|
|
|
|
sections:
|
|
|
|
- segment: __TEXT
|
|
|
|
section: __text
|
|
|
|
type: S_REGULAR
|
|
|
|
attributes: [ S_ATTR_PURE_INSTRUCTIONS, S_ATTR_SOME_INSTRUCTIONS ]
|
|
|
|
address: 0x0000000000000000
|
|
|
|
content: [ 0x55 ]
|
|
|
|
|
|
|
|
global-symbols:
|
|
|
|
- name: dyld_stub_binder
|
|
|
|
type: N_SECT
|
|
|
|
scope: [ N_EXT ]
|
|
|
|
sect: 1
|
|
|
|
value: 0x0000000000000000
|
|
|
|
|