152 lines · yaml
1# RUN: rm -rf %t2# RUN: %split-file %s %t3 4# RUN: yaml2obj %t/zero-secaddr.yml -o %t/zero-secaddr5# RUN: llvm-objdump %t/zero-secaddr -d --symbolize-operands\6# RUN: --no-show-raw-insn --no-leading-addr | FileCheck %s7 8# RUN: yaml2obj %t/nonzero-secaddr.yml -o %t/nonzero-secaddr9# RUN: llvm-objdump %t/nonzero-secaddr -d --symbolize-operands\10# RUN: --no-show-raw-insn --no-leading-addr | FileCheck %s11 12## Expect to find the branch labels.13# CHECK: <break_cond_is_arg>:14# CHECK: s_branch L115# CHECK: <L0>:16# CHECK: s_cbranch_execz L217# CHECK: <L1>:18# CHECK: s_branch L019# CHECKL <L2>:20 21# I created this YAML starting with this LLVM IR:22#23# define void @break_cond_is_arg(i32 %arg, i1 %breakcond) {24# entry:25# br label %loop26# loop:27# %tmp23phi = phi i32 [ %tmp23, %endif ], [ 0, %entry ]28# %tmp23 = add nuw i32 %tmp23phi, 129# %tmp27 = icmp ult i32 %arg, %tmp2330# br i1 %tmp27, label %then, label %endif31# then: ; preds = %bb32# call void @llvm.amdgcn.raw.buffer.store.f32(float undef, <4 x i32> undef, i32 0, i32 undef, i32 0)33# br label %endif34# endif: ; preds = %bb28, %bb35# br i1 %breakcond, label %loop, label %loopexit36# loopexit:37# ret void38# }39#40# declare void @llvm.amdgcn.raw.buffer.store.f32(float, <4 x i32>, i32, i32, i32 immarg) #041#42# attributes #0 = { nounwind writeonly }43#44# I compiled it to a relocatable ELF:45#46# llc -mtriple=amdgcn -mcpu=gfx1030 llvm/a.ll -filetype=obj -o a.elf47#48# then converted it to YAML:49#50# obj2yaml a.elf51#52# then manually removed the BB0_1 etc local symbols.53#54# Note that there are two copies of the file:55# - One as a relocatable object file (zero section addresses)56# - One as a shared object file (non-zero section addresses)57 58#--- zero-secaddr.yml59--- !ELF60FileHeader:61 Class: ELFCLASS6462 Data: ELFDATA2LSB63 Type: ET_REL64 Machine: EM_AMDGPU65 Flags: [ EF_AMDGPU_MACH_AMDGCN_GFX1030 ]66Sections:67 - Name: .text68 Type: SHT_PROGBITS69 Flags: [ SHF_ALLOC, SHF_EXECINSTR ]70 AddressAlign: 0x471 Content: 00008CBF0000FDBB81020236810385BE800384BE8102847D6AC10689040082BF7E077E88058105817E047E8A080088BF0500887D7E060787070404886A3C87BEF7FF88BF000070E000000104F4FF82BF7E047E880000FDBB1E2080BE72 - Name: .AMDGPU.config73 Type: SHT_PROGBITS74 AddressAlign: 0x175 Content: 48B80000000000004CB800000000000060B80000000000000400000000000000080000000000000076 - Name: .note.GNU-stack77 Type: SHT_PROGBITS78 AddressAlign: 0x179 - Name: .note80 Type: SHT_NOTE81 AddressAlign: 0x482 Notes:83 - Name: AMD84 Desc: 616D6467636E2D756E6B6E6F776E2D6C696E75782D676E752D6766783130333085 Type: NT_FREEBSD_PROCSTAT_GROUPS86 - Type: SectionHeaderTable87 Sections:88 - Name: .strtab89 - Name: .shstrtab90 - Name: .text91 - Name: .AMDGPU.config92 - Name: .note.GNU-stack93 - Name: .note94 - Name: .symtab95Symbols:96 - Name: break_cond_is_arg97 Type: STT_FUNC98 Section: .text99 Binding: STB_GLOBAL100 Size: 0x5C101...102 103#--- nonzero-secaddr.yml104--- !ELF105FileHeader:106 Class: ELFCLASS64107 Data: ELFDATA2LSB108 Type: ET_DYN109 Machine: EM_AMDGPU110 Flags: [ EF_AMDGPU_MACH_AMDGCN_GFX1030 ]111Sections:112 - Name: .text113 Type: SHT_PROGBITS114 Flags: [ SHF_ALLOC, SHF_EXECINSTR ]115 Address: 0x1000116 AddressAlign: 0x4117 Content: 00008CBF0000FDBB81020236810385BE800384BE8102847D6AC10689040082BF7E077E88058105817E047E8A080088BF0500887D7E060787070404886A3C87BEF7FF88BF000070E000000104F4FF82BF7E047E880000FDBB1E2080BE118 - Name: .AMDGPU.config119 Type: SHT_PROGBITS120 Address: 0x2000121 AddressAlign: 0x1122 Content: 48B80000000000004CB800000000000060B800000000000004000000000000000800000000000000123 - Name: .note.GNU-stack124 Type: SHT_PROGBITS125 Address: 0x3000126 AddressAlign: 0x1127 - Name: .note128 Type: SHT_NOTE129 Address: 0x4000130 AddressAlign: 0x4131 Notes:132 - Name: AMD133 Desc: 616D6467636E2D756E6B6E6F776E2D6C696E75782D676E752D67667831303330134 Type: NT_FREEBSD_PROCSTAT_GROUPS135 - Type: SectionHeaderTable136 Sections:137 - Name: .strtab138 - Name: .shstrtab139 - Name: .text140 - Name: .AMDGPU.config141 - Name: .note.GNU-stack142 - Name: .note143 - Name: .symtab144Symbols:145 - Name: break_cond_is_arg146 Type: STT_FUNC147 Section: .text148 Binding: STB_GLOBAL149 Size: 0x5C150 Value: 0x1000151...152