From eaa594f4ec54eba52b03fd9f1c789b214c66a753 Mon Sep 17 00:00:00 2001 From: Georgii Rymar Date: Tue, 21 Jan 2020 16:06:15 +0300 Subject: [PATCH] [llvm-readobj] - Rewrite gnuhash.test test to stop using precompiled objects. This rewrites the test to use YAML and removes 4 precompiled object. Differential revision: https://reviews.llvm.org/D73096 --- .../ELF/Inputs/gnuhash.so.elf-i386 | Bin 1080 -> 0 bytes .../ELF/Inputs/gnuhash.so.elf-ppc | Bin 1204 -> 0 bytes .../ELF/Inputs/gnuhash.so.elf-ppc64 | Bin 1784 -> 0 bytes .../ELF/Inputs/gnuhash.so.elf-x86_64 | Bin 1616 -> 0 bytes llvm/test/tools/llvm-readobj/ELF/gnuhash.test | 153 +++++++++++------- 5 files changed, 96 insertions(+), 57 deletions(-) delete mode 100644 llvm/test/tools/llvm-readobj/ELF/Inputs/gnuhash.so.elf-i386 delete mode 100644 llvm/test/tools/llvm-readobj/ELF/Inputs/gnuhash.so.elf-ppc delete mode 100644 llvm/test/tools/llvm-readobj/ELF/Inputs/gnuhash.so.elf-ppc64 delete mode 100644 llvm/test/tools/llvm-readobj/ELF/Inputs/gnuhash.so.elf-x86_64 diff --git a/llvm/test/tools/llvm-readobj/ELF/Inputs/gnuhash.so.elf-i386 b/llvm/test/tools/llvm-readobj/ELF/Inputs/gnuhash.so.elf-i386 deleted file mode 100644 index c222a899ba7178b4d305949c330c4033f6ea1081..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1080 zcmb7DF-t;G6h8JUG#d;Wf(l%MhI%v@5d@*76<7v2*mQZOW`jz;*B}I~4o=~}X=&&O zG}O@C+FE1weeb@DPYI$AKF|HmJ@?#q&bi)Y^SMYQA_kUNLY2Z#3if$I@1!J&omGj+ zw7+lSY5iElPf{dgczzChUTjdaqD7NI!%OW>$SzM)>W(H9rANJ1*y3RQg7OM998|Vl$>o)zQPKGr5y#^hg z$Hv(H)|eKxe}0laKH3v?kS}D?c~!{e&ay>SOlR_0H8PX%sDkkz+uvA3$k$-dV)g6| z$?poDyI(cm+X~2e($5)_r=WSGjNz=;10UnqOOkKFfITBNL9Q9co|wKs`d~g{7v#I* zJ?uT>_#e{K(f@@gG{<0kSV|9Zhg<~UT?DPEjrs+SM_A?{O&u|;!}v8Y}* zOhZwslO!rh!(j@$H|U~RJo@z$>a(sZUKyHq`3|u6XFv%+EB_~3r?P}TI71^ra@1JUMgb@LPEa(8vF!Y@oj-xU?{rvI5X%9%f_a!+;gmqr3$; zV;?hedHnBq28DUk0Ajix{#Wk;CNS~sGLM)6+`BOK-Zo)4asAoeoSWB{Yv7>;Yw^D1 OWA$>^;5ERBuJ;@8Tx)Uw diff --git a/llvm/test/tools/llvm-readobj/ELF/Inputs/gnuhash.so.elf-ppc64 b/llvm/test/tools/llvm-readobj/ELF/Inputs/gnuhash.so.elf-ppc64 deleted file mode 100644 index 25ce5c71b38b682305e8c98fcb1f8c79a06a677d..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1784 zcmcgsJ#Q015S=|cB*YX@fGj>FQ$WX6Ai0Z42vQ`VpaH7W1v@bk_QBmDB@z-*D%Yv_ zDUoPW@&}NhrlFvP67yzfW_1o{3sErA?%R1Yv$Hod_Pfmo_oK*BkOp1ESqXQnd{401 z_1L2>HK<1|T7k~KO|j40?H)zBo%b^mVf-m1`lvSwN?i08aVHvQ$nR`m@eMw&e|Tqo zqPl;7Yf?q8u^&{tl0<^Ixr< z7otnx>+)Wn~`Jhp{q%mB;?W@k%zG{?s_Fd+3MteQW7ie+ zXSji7^Lwgqt^*qj*OPl^{kHfvxLaxiSPtv2A=&SQeOT-sKHtHz|2@mE{hsM>-TOKJ z8kXI+C?0M>EFTkFSo-_c`3!Rv@}Izmzu&~ZAFZdySe9RWT*UQ)7|zt24HnOM0jqj9 x+f||iJv=c+(ekm%=W1=#g(3PZit7UTKkKaMAwSoTxjFfp{CzAp1;QTk{{{~(Y}5b% diff --git a/llvm/test/tools/llvm-readobj/ELF/Inputs/gnuhash.so.elf-x86_64 b/llvm/test/tools/llvm-readobj/ELF/Inputs/gnuhash.so.elf-x86_64 deleted file mode 100644 index 612e7b2112ff441571330bbfc3f63b5a346270b0..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1616 zcmcgs&o2W(6n^a@_2W=C36j0Iv2h?AgtoLuiUS8ulci-H+D3OJBof!2o%|V&690sY zgR_f+D@XO-?0oE2S0WNG>3lQa``*m!n>Tw|ESJ)$6u~T7Bw5`WDrX$o9w>-%G*1?f z{nV$m5!aW<%&-rT$kra&zK?(4Z&Nm}WNi!3jUK-cacSm%6PGdjSd4Ne&TSQJnPy}_ z{w=>XSSUWc+&x`gJf7^1u`AIeF3XX~AHrVE_mY>kL1`RG;D-`;I&3sZRV!}bl2ZG= zul&Gm229l}vf=A{yCL{21Dl*Hb}fmqNsYwxzhoTHE243Og9at9e=)~DuLbTtIeyR# z(ZlShe(HFx?~zkEud^(~ph-^EQ-@8rR@IDKJ3ja^Rf}&I^@s{BN`KZN&Rd`Liu2#^ zRs0rL8T|>plsnahmwF4|*#|cB*)IH~=D(jiouHpf;7P6QZRR)Dmr1Rbw+i{P+A5W{ zi#uv3Unmz=z&6@g9Kaf3pqWQQT&EDIDVQzJYNye?U5jC0@(hlN`j*FNnu?4SvLDLpcpI t!e=NAo=IpeO7grj|7h+}>5Yj;9pzm7M2GtI^Ss;n_l8^$al|^${{W#QYM}rC diff --git a/llvm/test/tools/llvm-readobj/ELF/gnuhash.test b/llvm/test/tools/llvm-readobj/ELF/gnuhash.test index c7d15dc3153a..5981a7db2636 100644 --- a/llvm/test/tools/llvm-readobj/ELF/gnuhash.test +++ b/llvm/test/tools/llvm-readobj/ELF/gnuhash.test @@ -1,63 +1,102 @@ -// Check dumping of the GNU Hash section -// The input was generated using the following: -// $ llvm-mc -filetype=obj -triple=i386-pc-linux -o example-i386.o example.s -// $ llvm-mc -filetype=obj -triple=x86_64-pc-linux -o example-x86_64.o example.s -// $ llvm-mc -filetype=obj -triple=powerpc-pc-linux -o example-ppc.o example.s -// $ llvm-mc -filetype=obj -triple=powerpc64-pc-linux -o example-ppc64.o example.s -// $ ld -shared -m elf_i386 -hash-style=gnu -o gnuhash.so.elf-i386 example-i386.o -// $ ld -shared -m elf_x86_64 -hash-style=gnu -o gnuhash.so.elf-x86_64 example-x86_64.o -// $ ld -shared -m elf32ppc -hash-style=gnu -o gnuhash.so.elf-ppc example-ppc.o -// $ ld -shared -m elf64ppc -hash-style=gnu -o gnuhash.so.elf-ppc64 example-ppc64.o -// $ cat example.s -// .globl foo -// foo: +## Check how the GNU Hash section is dumped with --gnu-hash-table. -RUN: llvm-readobj --gnu-hash-table %p/Inputs/gnuhash.so.elf-i386 | FileCheck %s -check-prefix I386 -RUN: llvm-readobj --gnu-hash-table %p/Inputs/gnuhash.so.elf-x86_64 | FileCheck %s -check-prefix X86_64 -RUN: llvm-readobj --gnu-hash-table %p/Inputs/gnuhash.so.elf-ppc | FileCheck %s -check-prefix PPC -RUN: llvm-readobj --gnu-hash-table %p/Inputs/gnuhash.so.elf-ppc64 | FileCheck %s -check-prefix PPC64 +# RUN: yaml2obj --docnum=1 %s -o %t.x64 +# RUN: yaml2obj --docnum=2 %s -o %t.x32 -I386: Arch: i386 -I386: GnuHashTable { -I386-NEXT: Num Buckets: 3 -I386-NEXT: First Hashed Symbol Index: 1 -I386-NEXT: Num Mask Words: 1 -I386-NEXT: Shift Count: 5 -I386-NEXT: Bloom Filter: [0x39004608] -I386-NEXT: Buckets: [1, 4, 0] -I386-NEXT: Values: [0xB887388, 0xECD54542, 0x7C92E3BB, 0x1C5871D9] -I386-NEXT: } +# RUN: llvm-readobj --gnu-hash-table %t.x64 | FileCheck %s +# RUN: llvm-readelf --gnu-hash-table %t.x64 | FileCheck %s -X86_64: Arch: x86_64 -X86_64: GnuHashTable { -X86_64-NEXT: Num Buckets: 3 -X86_64-NEXT: First Hashed Symbol Index: 1 -X86_64-NEXT: Num Mask Words: 1 -X86_64-NEXT: Shift Count: 6 -X86_64-NEXT: Bloom Filter: [0x800000001204288] -X86_64-NEXT: Buckets: [1, 4, 0] -X86_64-NEXT: Values: [0xB887388, 0xECD54542, 0x7C92E3BB, 0x1C5871D9] -X86_64-NEXT: } +# RUN: llvm-readobj --gnu-hash-table %t.x32 | FileCheck %s +# RUN: llvm-readelf --gnu-hash-table %t.x32 | FileCheck %s -PPC: Arch: powerpc -PPC: GnuHashTable { -PPC-NEXT: Num Buckets: 3 -PPC-NEXT: First Hashed Symbol Index: 1 -PPC-NEXT: Num Mask Words: 1 -PPC-NEXT: Shift Count: 5 -PPC-NEXT: Bloom Filter: [0x3D00460A] -PPC-NEXT: Buckets: [1, 5, 0] -PPC-NEXT: Values: [0xEEBEC3A, 0xB887388, 0xECD54542, 0x7C92E3BB, 0x1C5871D9] -PPC-NEXT: } +# CHECK: GnuHashTable { +# CHECK-NEXT: Num Buckets: 3 +# CHECK-NEXT: First Hashed Symbol Index: 1 +# CHECK-NEXT: Num Mask Words: 2 +# CHECK-NEXT: Shift Count: 2 +# CHECK-NEXT: Bloom Filter: [0x3, 0x4] +# CHECK-NEXT: Buckets: [5, 6, 7] +# CHECK-NEXT: Values: [0x8, 0x9, 0xA, 0xB] +# CHECK-NEXT: } -PPC64: Arch: powerpc64 -PPC64: GnuHashTable { -PPC64-NEXT: Num Buckets: 3 -PPC64-NEXT: First Hashed Symbol Index: 1 -PPC64-NEXT: Num Mask Words: 1 -PPC64-NEXT: Shift Count: 6 -PPC64-NEXT: Bloom Filter: [0x800000001204288] -PPC64-NEXT: Buckets: [1, 4, 0] -PPC64-NEXT: Values: [0xB887388, 0xECD54542, 0x7C92E3BB, 0x1C5871D9] -PPC64-NEXT: } +--- !ELF +FileHeader: + Class: ELFCLASS64 + Data: ELFDATA2LSB + Type: ET_DYN + Machine: EM_X86_64 +Sections: + - Name: .gnu.hash + Type: SHT_GNU_HASH + Flags: [ SHF_ALLOC ] + Header: + SymNdx: 0x1 + Shift2: 0x2 + BloomFilter: [0x3, 0x4] + HashBuckets: [0x5, 0x6, 0x7] + HashValues: [0x8, 0x9, 0xA, 0xB] + - Name: .dynamic + Type: SHT_DYNAMIC + Flags: [ SHF_ALLOC ] + Link: .dynstr + Entries: + - Tag: DT_GNU_HASH + Value: 0x0 + - Tag: DT_NULL + Value: 0x0 +DynamicSymbols: + - Name: aaa + Binding: STB_GLOBAL + - Name: bbb + Binding: STB_GLOBAL + - Name: ccc + Binding: STB_GLOBAL + - Name: ddd + Binding: STB_GLOBAL +ProgramHeaders: + - Type: PT_LOAD + Flags: [ PF_R, PF_X ] + Sections: + - Section: .gnu.hash + - Section: .dynamic +--- !ELF +FileHeader: + Class: ELFCLASS32 + Data: ELFDATA2LSB + Type: ET_DYN + Machine: EM_386 +Sections: + - Name: .gnu.hash + Type: SHT_GNU_HASH + Flags: [ SHF_ALLOC ] + Header: + SymNdx: 0x1 + Shift2: 0x2 + BloomFilter: [0x3, 0x4] + HashBuckets: [0x5, 0x6, 0x7] + HashValues: [0x8, 0x9, 0xA, 0xB] + - Name: .dynamic + Type: SHT_DYNAMIC + Flags: [ SHF_ALLOC ] + Link: .dynstr + Entries: + - Tag: DT_GNU_HASH + Value: 0x0 + - Tag: DT_NULL + Value: 0x0 +DynamicSymbols: + - Name: aaa + Binding: STB_GLOBAL + - Name: bbb + Binding: STB_GLOBAL + - Name: ccc + Binding: STB_GLOBAL + - Name: ddd + Binding: STB_GLOBAL +ProgramHeaders: + - Type: PT_LOAD + Flags: [ PF_R, PF_X ] + Sections: + - Section: .gnu.hash + - Section: .dynamic