From 638e8a405dcb5176ec20de15baa5fa55034652df Mon Sep 17 00:00:00 2001 From: George Rimar Date: Fri, 14 Jul 2017 08:26:44 +0000 Subject: [PATCH] [ELF] - Remove dependency on precompiled inputs from -gdb-index testcases. Previously we used precompiled objects in gdb-index.s and debug-gnu-pubnames.s testcases. We can avoid that. Differential revision: https://reviews.llvm.org/D35360 llvm-svn: 308005 --- lld/test/ELF/Inputs/gdb-index-a.elf | Bin 3040 -> 0 bytes lld/test/ELF/Inputs/gdb-index-b.elf | Bin 3048 -> 0 bytes lld/test/ELF/Inputs/gdb-index.s | 73 ++++++++++++++++++ lld/test/ELF/debug-gnu-pubnames.s | 24 ++++-- lld/test/ELF/gdb-index.s | 113 ++++++++++++++++++++++------ 5 files changed, 177 insertions(+), 33 deletions(-) delete mode 100644 lld/test/ELF/Inputs/gdb-index-a.elf delete mode 100644 lld/test/ELF/Inputs/gdb-index-b.elf create mode 100644 lld/test/ELF/Inputs/gdb-index.s diff --git a/lld/test/ELF/Inputs/gdb-index-a.elf b/lld/test/ELF/Inputs/gdb-index-a.elf deleted file mode 100644 index 9b90b0dc233e9740e22834ba1cddf320a28c0a1a..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 3040 zcmbtW&rcIU6rSxO1%+DBh=_?bF^W;PEf5rqrj`gs4F?U02Til33pCPg({2?ws3(8K z#E^L5VuD`usKEm<(TfNF1UYyxF?#pl$%DQ(J8#)OrylerJ2UTl-<$94%TLz=}N_)qus9tndc)>Aj)vzW?3ZX$|WaRFXfX6 z)smw_waR?aD>(W3tPm4pVJJKS)|I!6b?am8f zstw>dCPZ{*s_o}7Q?znO`lirVY>M_KeElw(qO%EqdlS5?3BIEVPP@?DuB4s0+)Nb|)xG~u*9XbCrs2K8`7+pm zh0hB5$PL?ma1i59`h_qlH0Jq-Acjx(zvkmhkk5&7q|e_RoQvlQKSmk2!gfa$gr65Q z{FES%<|8}{7@rd$aTy!1VZRGn&OHSYo&Ji_Usjo@k9)-RCjsMgV#+;i!1nlE&~mN~ z5so4Gsmh@DhI0SlUWI_J{(c0(Xq~Wre24J*mjKi0zXco(&u7>;w+=y_enz8@XPN6i z28_>%dK=h);m=CgIQJ0*b^2G7KIP;6Z3s0hu@KjnW=`AkMUAp#3<_>;;L<&ud5eh9a)09`)jIaeaKIbovzq J@;@7{{~H(av9$mI diff --git a/lld/test/ELF/Inputs/gdb-index-b.elf b/lld/test/ELF/Inputs/gdb-index-b.elf deleted file mode 100644 index b3356d8c773b20ef283c3ac4d8ee0d73c39b738a..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 3048 zcmbtWJ8u&~5T5e^NgxSMc!Us;jD!S8=lDo0;3BFzqqLD`Pu&0Z7W%~xG0IJjpB1sv+m5tG8%6(NOSb=7-{b>lh=!cu zp7hAe!r<88o5JYp!pN&a53@)4NyT21+-~A0SM@95L=25^yKLOe+EOKqViT0a)En!% z=~l_Un4jU+aefXCa2wAGzkx$h(2OR$xq3Yb(wD>q^<=7tnTfr8twz~}S~bYFs--Nj zW_JIcW__^|m4i}ip6K|@%z@0#*-|TvTA3+t!pn{CX~kMTe=9%blk z%xAme<-Jrqzc=2=S50TEPkVduSkKsM9^*J@=~n~E*Lwo|c1|8=6d$A75=*|4qhZOor$k8W!wNQzW;=MqB<9mi*Yu zGXEpSWK87yf`$b@Ev88BLpIv-UsCzCKi(g=kj(#_F&UE~>QmrBD27PxGq&0CFInCn zx1G%YnlZ%Gb@DKlqbd>3rztwW?y*ib|3yXUw*R&NN9Awk!1#$K2!n*bvK?4T@U%aE z-%Qc(udz=&u+85K%lzS%*Zz86<4-|;yAb=m^8XIS5Lv&icF;d7;$zh#Uz#78A7{#z NzplUyY&S*b{|)b5v6%n> diff --git a/lld/test/ELF/Inputs/gdb-index.s b/lld/test/ELF/Inputs/gdb-index.s new file mode 100644 index 000000000000..907a66d350b0 --- /dev/null +++ b/lld/test/ELF/Inputs/gdb-index.s @@ -0,0 +1,73 @@ +.text +.Ltext0: +.globl main2 +.type main2, @function +main2: + nop + nop +.Letext0: + +.section .debug_info,"",@progbits +.long 0x30 +.value 0x4 +.long 0 +.byte 0x8 +.uleb128 0x1 +.quad .Ltext0 +.quad .Letext0-.Ltext0 +.long 0 +.long 0 +.long 0 +.long 0 +.byte 0x63 +.byte 0x88 +.byte 0xb4 +.byte 0x61 +.byte 0xaa +.byte 0xb6 +.byte 0xb0 +.byte 0x67 + +.section .debug_abbrev,"",@progbits +.uleb128 0x1 +.uleb128 0x11 +.byte 0 +.uleb128 0x11 +.uleb128 0x1 +.uleb128 0x12 +.uleb128 0x7 +.uleb128 0x10 +.uleb128 0x17 +.uleb128 0x2130 +.uleb128 0xe +.uleb128 0x1b +.uleb128 0xe +.uleb128 0x2134 +.uleb128 0x19 +.uleb128 0x2133 +.uleb128 0x17 +.uleb128 0x2131 +.uleb128 0x7 +.byte 0 +.byte 0 +.byte 0 + +.section .debug_gnu_pubnames,"",@progbits +.long 0x18 +.value 0x2 +.long 0 +.long 0x33 +.long 0x18 +.byte 0x30 +.string "main2" +.long 0 + +.section .debug_gnu_pubtypes,"",@progbits +.long 0x17 +.value 0x2 +.long 0 +.long 0x33 +.long 0x2b +.byte 0x90 +.string "int" +.long 0 diff --git a/lld/test/ELF/debug-gnu-pubnames.s b/lld/test/ELF/debug-gnu-pubnames.s index 0a8693c97eb8..aebfdfd0fb91 100644 --- a/lld/test/ELF/debug-gnu-pubnames.s +++ b/lld/test/ELF/debug-gnu-pubnames.s @@ -1,10 +1,18 @@ # REQUIRES: x86 -# RUN: ld.lld -e main %p/Inputs/gdb-index-a.elf %p/Inputs/gdb-index-b.elf -o %t1.exe -# RUN: llvm-readobj -sections %t1.exe | FileCheck -check-prefix=CHECK1 %s -# CHECK1: Name: .debug_gnu_pubnames -# CHECK1: Name: .debug_gnu_pubtypes +# RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t.o -# RUN: ld.lld -gdb-index -e main %p/Inputs/gdb-index-a.elf %p/Inputs/gdb-index-b.elf -o %t2.exe -# RUN: llvm-readobj -sections %t2.exe | FileCheck -check-prefix=CHECK2 %s -# CHECK2-NOT: Name: .debug_gnu_pubnames -# CHECK2-NOT: Name: .debug_gnu_pubtypes +# RUN: ld.lld %t.o -o %t1.exe +# RUN: llvm-readobj -sections %t1.exe | FileCheck %s +# CHECK: .debug_gnu_pubnames +# CHECK: .debug_gnu_pubtypes + +# RUN: ld.lld -gdb-index %t.o -o %t2.exe +# RUN: llvm-readobj -sections %t2.exe | FileCheck %s --check-prefix=GDB +# GDB-NOT: .debug_gnu_pubnames +# GDB-NOT: .debug_gnu_pubtypes + +.section .debug_gnu_pubnames,"",@progbits +.long 0 + +.section .debug_gnu_pubtypes,"",@progbits +.long 0 diff --git a/lld/test/ELF/gdb-index.s b/lld/test/ELF/gdb-index.s index b7d8a708ace5..e04845e022c3 100644 --- a/lld/test/ELF/gdb-index.s +++ b/lld/test/ELF/gdb-index.s @@ -1,32 +1,19 @@ -## gdb-index-a.elf and gdb-index-b.elf are a test.o and test2.o renamed, -## were generated in this way: -## test.cpp: -## int main() { return 0; } -## test2.cpp: -## int main2() { return 0; } -## Compiled with: -## gcc -gsplit-dwarf -c test.cpp test2.cpp -## gcc version 5.3.1 20160413 -## Info about gdb-index: https://sourceware.org/gdb/onlinedocs/gdb/Index-Section-Format.html - # REQUIRES: x86 -# RUN: ld.lld --gdb-index -e main %p/Inputs/gdb-index-a.elf %p/Inputs/gdb-index-b.elf -o %t +# RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t1.o +# RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %p/Inputs/gdb-index.s -o %t2.o +# RUN: ld.lld --gdb-index -e main %t1.o %t2.o -o %t # RUN: llvm-dwarfdump -debug-dump=gdb_index %t | FileCheck %s # RUN: llvm-objdump -d %t | FileCheck %s --check-prefix=DISASM # DISASM: Disassembly of section .text: # DISASM: main: -# DISASM-CHECK: 11000: 55 pushq %rbp -# DISASM-CHECK: 11001: 48 89 e5 movq %rsp, %rbp -# DISASM-CHECK: 11004: b8 00 00 00 00 movl $0, %eax -# DISASM-CHECK: 11009: 5d popq %rbp -# DISASM-CHECK: 1100a: c3 retq -# DISASM: _Z5main2v: -# DISASM-CHECK: 1100b: 55 pushq %rbp -# DISASM-CHECK: 1100c: 48 89 e5 movq %rsp, %rbp -# DISASM-CHECK: 1100f: b8 00 00 00 00 movl $0, %eax -# DISASM-CHECK: 11014: 5d popq %rbp -# DISASM-CHECK: 11015: c3 retq +# DISASM-CHECK: 201000: 90 nop +# DISASM-CHECK: 201001: cc int3 +# DISASM-CHECK: 201002: cc int3 +# DISASM-CHECK: 201003: cc int3 +# DISASM: main2: +# DISASM-CHECK: 201004: 90 nop +# DISASM-CHECK: 201005: 90 nop # CHECK: .gnu_index contents: # CHECK-NEXT: Version = 7 @@ -34,8 +21,8 @@ # CHECK-NEXT: 0: Offset = 0x0, Length = 0x34 # CHECK-NEXT: 1: Offset = 0x34, Length = 0x34 # CHECK: Address area offset = 0x38, has 2 entries: -# CHECK-NEXT: Low/High address = [0x201000, 0x20100b) (Size: 0xb), CU id = 0 -# CHECK-NEXT: Low/High address = [0x20100b, 0x201016) (Size: 0xb), CU id = 1 +# CHECK-NEXT: Low/High address = [0x201000, 0x201001) (Size: 0x1), CU id = 0 +# CHECK-NEXT: Low/High address = [0x201004, 0x201006) (Size: 0x2), CU id = 1 # CHECK: Symbol table offset = 0x60, size = 1024, filled slots: # CHECK-NEXT: 489: Name offset = 0x1d, CU vector offset = 0x0 # CHECK-NEXT: String name: main, CU vector index: 0 @@ -47,3 +34,79 @@ # CHECK-NEXT: 0(0x0): 0x30000000 # CHECK-NEXT: 1(0x8): 0x90000000 0x90000001 # CHECK-NEXT: 2(0x14): 0x30000001 + +## The following section contents are created by this using gcc 7.1.0: +## echo 'int main() { return 0; }' | gcc -gsplit-dwarf -xc++ -S -o- - + +.text +.Ltext0: +.globl main +.type main, @function +main: + nop +.Letext0: + +.section .debug_info,"",@progbits +.long 0x30 +.value 0x4 +.long 0 +.byte 0x8 +.uleb128 0x1 +.quad .Ltext0 +.quad .Letext0-.Ltext0 +.long 0 +.long 0 +.long 0 +.long 0 +.byte 0x63 +.byte 0x88 +.byte 0xb4 +.byte 0x61 +.byte 0xaa +.byte 0xb6 +.byte 0xb0 +.byte 0x67 + +.section .debug_abbrev,"",@progbits +.uleb128 0x1 +.uleb128 0x11 +.byte 0 +.uleb128 0x11 +.uleb128 0x1 +.uleb128 0x12 +.uleb128 0x7 +.uleb128 0x10 +.uleb128 0x17 +.uleb128 0x2130 +.uleb128 0xe +.uleb128 0x1b +.uleb128 0xe +.uleb128 0x2134 +.uleb128 0x19 +.uleb128 0x2133 +.uleb128 0x17 +.uleb128 0x2131 +.uleb128 0x7 +.byte 0 +.byte 0 +.byte 0 + +.section .debug_gnu_pubnames,"",@progbits +.long 0x18 +.value 0x2 +.long 0 +.long 0x33 +.long 0x18 +.byte 0x30 +.string "main" +.long 0 + +.section .debug_gnu_pubtypes,"",@progbits +.long 0x17 +.value 0x2 +.long 0 +.long 0x33 +.long 0x2b +.byte 0x90 +.string "int" +.long 0