llvm.org GIT mirror llvm / 30dbd24
[llvm-readobj/llvm-readelf] - Eliminate the elf-groups.x86_64 precompiled binary from the inputs. We do not need the elf-groups.x86_64. In one of the tests, it was used for no solid reason, and for the second test case we can use YAML input with SHT_GROUP sections. The patch performs a cleanup of one of the test cases, removes another one completely (since during the review was found out it actually duplicates one of the existent tests) and removes the precompiled binary. Differential revision: https://reviews.llvm.org/D63647 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@364167 91177308-0d34-0410-b5e6-96231b3b80d8 George Rimar 9 months ago
3 changed file(s) with 80 addition(s) and 62 deletion(s). Raw diff Collapse all Expand all
test/tools/llvm-readobj/Inputs/elf-groups.x86_64 less more
Binary diff not shown
None # Source file compiled:
1 ##include
2 # #include
3 #template
4 #void foo(A variable) {
5 # std::cout << "foo is " << typeid(A).name() << "\n";
6 #}
7 #int main () {
8 # char x = 'x';
9 # int y = 1;
10 # foo(x);
11 # foo(y);
12 # return 0;
13 #}
0 ## Check that llvm-readelf and llvm-readobj can
1 ## dump SHT_GROUP sections properly.
142
15 RUN: llvm-readobj -g %p/Inputs/elf-groups.x86_64 \
16 RUN: | FileCheck %s
17 RUN: llvm-readelf -g %p/Inputs/elf-groups.x86_64 \
18 RUN: | FileCheck --check-prefix="GNU" %s
19 CHECK: Groups {
20 CHECK-NEXT: Group {
21 CHECK-NEXT: Name: .group (92)
22 CHECK-NEXT: Index: 1
23 CHECK-NEXT: Link: 23
24 CHECK-NEXT: Info: 17
25 CHECK-NEXT: Type: COMDAT (0x1)
26 CHECK-NEXT: Signature: _Z3fooIcEvT_
27 CHECK-NEXT: Section(s) in group [
28 CHECK-NEXT: .text._Z3fooIcEvT_ (10)
29 CHECK-NEXT: .rela.text._Z3fooIcEvT_ (11)
30 CHECK-NEXT: ]
31 CHECK-NEXT: }
32 CHECK-NEXT: Group {
33 CHECK-NEXT: Name: .group (92)
34 CHECK-NEXT: Index: 2
35 CHECK-NEXT: Link: 23
36 CHECK-NEXT: Info: 18
37 CHECK-NEXT: Type: COMDAT (0x1)
38 CHECK-NEXT: Signature: _Z3fooIiEvT_
39 CHECK-NEXT: Section(s) in group [
40 CHECK-NEXT: .text._Z3fooIiEvT_ (12)
41 CHECK-NEXT: .rela.text._Z3fooIiEvT_ (13)
42 CHECK-NEXT: ]
43 CHECK-NEXT: }
3 # RUN: yaml2obj %s -o %t.o
4 # RUN: llvm-readobj -g %t.o | FileCheck %s
5 # RUN: llvm-readelf -g %t.o | FileCheck --check-prefix=GNU %s
446
45 GNU:COMDAT group section [ 1] `.group' [_Z3fooIcEvT_] contains 2 sections:
46 GNU-NEXT: [Index] Name
47 GNU-NEXT: [ 10] .text._Z3fooIcEvT_
48 GNU-NEXT: [ 11] .rela.text._Z3fooIcEvT_
49 GNU:COMDAT group section [ 2] `.group' [_Z3fooIiEvT_] contains 2 sections:
50 GNU-NEXT: [Index] Name
51 GNU-NEXT: [ 12] .text._Z3fooIiEvT_
52 GNU-NEXT: [ 13] .rela.text._Z3fooIiEvT_
53 GNU:COMDAT group section [ 3] `.group' [_ZNKSt9type_info4nameEv] contains 1 sections:
54 GNU-NEXT: [Index] Name
55 GNU-NEXT: [ 14] .text._ZNKSt9type_info4nameEv
7 # CHECK: Groups {
8 # CHECK-NEXT: Group {
9 # CHECK-NEXT: Name: .group
10 # CHECK-NEXT: Index: 1
11 # CHECK-NEXT: Link: 7
12 # CHECK-NEXT: Info: 1
13 # CHECK-NEXT: Type: COMDAT
14 # CHECK-NEXT: Signature: foo
15 # CHECK-NEXT: Section(s) in group [
16 # CHECK-NEXT: .text.foo
17 # CHECK-NEXT: .rela.text.foo
18 # CHECK-NEXT: ]
19 # CHECK-NEXT: }
20 # CHECK-NEXT: Group {
21 # CHECK-NEXT: Name: .group1
22 # CHECK-NEXT: Index: 2
23 # CHECK-NEXT: Link: 7
24 # CHECK-NEXT: Info: 2
25 # CHECK-NEXT: Type: COMDAT
26 # CHECK-NEXT: Signature: bar
27 # CHECK-NEXT: Section(s) in group [
28 # CHECK-NEXT: .text.bar
29 # CHECK-NEXT: .rela.text.bar
30 # CHECK-NEXT: ]
31 # CHECK-NEXT: }
32
33 # GNU: COMDAT group section [ 1] `.group' [foo] contains 2 sections:
34 # GNU-NEXT: [Index] Name
35 # GNU-NEXT: [ 3] .text.foo
36 # GNU-NEXT: [ 4] .rela.text.foo
37 # GNU: COMDAT group section [ 2] `.group1' [bar] contains 2 sections:
38 # GNU-NEXT: [Index] Name
39 # GNU-NEXT: [ 5] .text.bar
40 # GNU-NEXT: [ 6] .rela.text.bar
41
42 --- !ELF
43 FileHeader:
44 Class: ELFCLASS64
45 Data: ELFDATA2LSB
46 Type: ET_REL
47 Machine: EM_X86_64
48 Sections:
49 - Name: .group
50 Type: SHT_GROUP
51 Link: .symtab
52 Info: foo
53 Members:
54 - SectionOrType: GRP_COMDAT
55 - SectionOrType: .text.foo
56 - SectionOrType: .rela.text.foo
57 - Name: .group1
58 Type: SHT_GROUP
59 Link: .symtab
60 Info: bar
61 Members:
62 - SectionOrType: GRP_COMDAT
63 - SectionOrType: .text.bar
64 - SectionOrType: .rela.text.bar
65 - Name: .text.foo
66 Type: SHT_PROGBITS
67 - Name: .rela.text.foo
68 Type: SHT_RELA
69 Link: .symtab
70 Info: .text.foo
71 - Name: .text.bar
72 Type: SHT_PROGBITS
73 - Name: .rela.text.bar
74 Type: SHT_RELA
75 Link: .symtab
76 Info: .text.bar
77 Symbols:
78 - Name: foo
79 Section: .text.foo
80 - Name: bar
81 Section: .text.bar
+0
-8
test/tools/llvm-readobj/print-section.test less more
None RUN: llvm-readobj -p .text %p/Inputs/elf-groups.x86_64 \
1 RUN: | FileCheck %s
2
3 CHECK: [ 0] UH..H....E.
4 CHECK: [ f] .E.x.E..
5 CHECK: [ 1a] ..}..
6 CHECK: [ 23] .}..
7 CHECK: [ 2b] 1.H...].