1# REQUIRES: x86 2 3# RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t.o 4# RUN: ld.lld --eh-frame-hdr --section-start .text=0x1000 %t.o -o %t 5# RUN: llvm-readobj -S --section-data %t | FileCheck %s 6 7## Check we are able to handle DW_EH_PE_udata2 encoding. 8 9# CHECK: Section { 10# CHECK: Index: 11# CHECK: Name: .eh_frame_hdr 12# CHECK-NEXT: Type: SHT_PROGBITS 13# CHECK-NEXT: Flags [ 14# CHECK-NEXT: SHF_ALLOC 15# CHECK-NEXT: ] 16# CHECK-NEXT: Address: 0x2004 17# CHECK-NEXT: Offset: 0x1004 18# CHECK-NEXT: Size: 20 19# CHECK-NEXT: Link: 0 20# CHECK-NEXT: Info: 0 21# CHECK-NEXT: AddressAlignment: 4 22# CHECK-NEXT: EntrySize: 0 23# CHECK-NEXT: SectionData ( 24# CHECK-NEXT: 0000: 011B033B 10000000 01000000 30F2FFFF 25# CHECK-NEXT: 0010: 2C000000 26# Header (always 4 bytes): 011B033B 27# 10000000 = .eh_frame(0x2018) - .eh_frame_hdr(0x2004) - 4 28# 01000000 = 1 = the number of FDE pointers in the table. 29# 30F2FFFF = foo(0x1000) - 0x234(addend) - .eh_frame_hdr(0x2004) 30 31# CHECK: Section { 32# CHECK: Index: 33# CHECK: Name: .eh_frame 34# CHECK-NEXT: Type: SHT_PROGBITS 35# CHECK-NEXT: Flags [ 36# CHECK-NEXT: SHF_ALLOC 37# CHECK-NEXT: ] 38# CHECK-NEXT: Address: 0x2018 39# CHECK-NEXT: Offset: 0x1018 40# CHECK-NEXT: Size: 41# CHECK-NEXT: Link: 42# CHECK-NEXT: Info: 43# CHECK-NEXT: AddressAlignment: 44# CHECK-NEXT: EntrySize: 45# CHECK-NEXT: SectionData ( 46# CHECK-NEXT: 0000: 14000000 00000000 01525300 01010102 47# CHECK-NEXT: 0010: FF000000 00000000 0C000000 1C000000 48# CHECK-NEXT: 0020: 34120000 00000000 00000000 49# ^ 50# ---> ADDR(foo) + 0x234 = 0x1234 51 52.text 53.global foo 54foo: 55 nop 56 57.section .eh_frame,"a",@unwind 58 .long 13 # Size 59 .long 0x00 # ID 60 .byte 0x01 # Version. 61 62 .byte 0x52 # Augmentation string: 'R','S','\0' 63 .byte 0x53 64 .byte 0x00 65 66 .byte 0x01 67 68 .byte 0x01 # LEB128 69 .byte 0x01 # LEB128 70 71 .byte 0x02 # DW_EH_PE_udata2 72 73 .byte 0xFF 74 75 .long 0x6 # Size 76 .long 0x15 # ID 77 .short foo + 0x234 78