1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246
|
# REQUIRES: x86
## Test that we correctly handle symbol relocations in the compact unwind
## section.
## llvm-mc does not emit such relocations for compact unwind, but `ld -r` does.
## As such, these yaml files were from an object file produced with 'ld -r',
## specifically:
##
## // foo.s
## .globl _foo
## .text
## .p2align 2
## _foo:
## .cfi_startproc
## .cfi_personality 155, ___gxx_personality_v0
## .cfi_lsda 16, _exception0
## .cfi_def_cfa_offset 16
## ret
## .cfi_endproc
##
## .section __TEXT,__gcc_except_tab
## _exception0:
## .space 0
##
## llvm-mc -filetype=obj -triple=x86_64-apple-macos10.15 -o foo1.o foo.s
## ld -r -o foo.o foo1.o
# RUN: rm -rf %t; mkdir -p %t
# RUN: yaml2obj %s -o %t/foo.o
# RUN: %lld -dylib -lc++ %t/foo.o -o %t/foo
# RUN: llvm-objdump --macho --syms --unwind-info %t/foo | FileCheck %s
# CHECK: SYMBOL TABLE:
# CHECK-DAG: [[#%x,FOO:]] g F __TEXT,__text _foo
# CHECK-DAG: [[#%x,EXCEPT0:]] l O __TEXT,__gcc_except_tab _exception0
# CHECK: LSDA descriptors:
# CHECK-NEXT: [0]: function offset=0x[[#%.8x,FOO]], LSDA offset=0x[[#%.8x,EXCEPT0]]
--- !mach-o
FileHeader:
magic: 0xFEEDFACF
cputype: 0x1000007
cpusubtype: 0x3
filetype: 0x1
ncmds: 2
sizeofcmds: 464
flags: 0x0
reserved: 0x0
LoadCommands:
- cmd: LC_SEGMENT_64
cmdsize: 392
segname: ''
vmaddr: 0
vmsize: 112
fileoff: 528
filesize: 112
maxprot: 7
initprot: 7
nsects: 4
flags: 0
Sections:
- sectname: __text
segname: __TEXT
addr: 0x0
size: 1
offset: 0x210
align: 2
reloff: 0x0
nreloc: 0
flags: 0x80000400
reserved1: 0x0
reserved2: 0x0
reserved3: 0x0
content: C3
- sectname: __gcc_except_tab
segname: __TEXT
addr: 0x1
size: 0
offset: 0x211
align: 0
reloff: 0x0
nreloc: 0
flags: 0x0
reserved1: 0x0
reserved2: 0x0
reserved3: 0x0
content: ''
- sectname: __eh_frame
segname: __TEXT
addr: 0x8
size: 72
offset: 0x218
align: 3
reloff: 0x280
nreloc: 7
flags: 0x0
reserved1: 0x0
reserved2: 0x0
reserved3: 0x0
content: 1C00000000000000017A504C5200017810079B0400000010100C0708900100002400000004000000F8FFFFFFFFFFFFFF010000000000000008E7FFFFFFFFFFFFFF0E100000000000
relocations:
- address: 0x13
symbolnum: 4
pcrel: true
length: 2
extern: true
type: 4
scattered: false
value: 0
- address: 0x24
symbolnum: 1
pcrel: false
length: 2
extern: true
type: 5
scattered: false
value: 0
- address: 0x24
symbolnum: 2
pcrel: false
length: 2
extern: true
type: 0
scattered: false
value: 0
- address: 0x28
symbolnum: 2
pcrel: false
length: 3
extern: true
type: 5
scattered: false
value: 0
- address: 0x28
symbolnum: 3
pcrel: false
length: 3
extern: true
type: 0
scattered: false
value: 0
- address: 0x39
symbolnum: 2
pcrel: false
length: 3
extern: true
type: 5
scattered: false
value: 0
- address: 0x39
symbolnum: 0
pcrel: false
length: 3
extern: true
type: 0
scattered: false
value: 0
- sectname: __compact_unwind
segname: __LD
addr: 0x50
size: 32
offset: 0x260
align: 3
reloff: 0x2B8
nreloc: 4
flags: 0x2000000
reserved1: 0x0
reserved2: 0x0
reserved3: 0x0
content: '0000000000000000010000000000024200000000000000000000000000000000'
relocations:
- address: 0x0
symbolnum: 3
pcrel: false
length: 3
extern: true
type: 0
scattered: false
value: 0
- address: 0x18
symbolnum: 0
pcrel: false
length: 3
extern: true
type: 0
scattered: false
value: 0
- address: 0x10
symbolnum: 4
pcrel: false
length: 3
extern: true
type: 0
scattered: false
value: 0
- address: 0x18
symbolnum: 0
pcrel: false
length: 3
extern: true
type: 0
scattered: false
value: 0
- cmd: LC_SYMTAB
cmdsize: 24
symoff: 728
nsyms: 5
stroff: 808
strsize: 57
LinkEditData:
NameList:
- n_strx: 29
n_type: 0xE
n_sect: 2
n_desc: 32
n_value: 1
- n_strx: 41
n_type: 0xE
n_sect: 3
n_desc: 0
n_value: 8
- n_strx: 51
n_type: 0xE
n_sect: 3
n_desc: 0
n_value: 40
- n_strx: 2
n_type: 0xF
n_sect: 1
n_desc: 32
n_value: 0
- n_strx: 7
n_type: 0x1
n_sect: 0
n_desc: 0
n_value: 0
StringTable:
- ' '
- _foo
- ___gxx_personality_v0
- _exception0
- EH_Frame1
- func.eh
...
|