llvm.org GIT mirror llvm / 26db7fb
[yaml2obj][obj2yaml] - Change how symbol's binding is descibed when parsing/dumping. Currently, YAML has the following syntax for describing the symbols: Symbols: Local: LocalSymbol1: ... LocalSymbol2: ... ... Global: GlobalSymbol1: ... Weak: ... GNUUnique: I.e. symbols are grouped by their bindings. That is not very convenient, because: It does not allow to set a custom binding, what can be useful for producing broken/special outputs for test cases. Adding a new binding would require to change a syntax (what we observed when added GNUUnique recently). It does not allow to change the order of the symbols in .symtab/.dynsym, i.e. currently all Local symbols are placed first, then Global, Weak and GNUUnique are following, but we are not able to change the order. It is not consistent. Binding is just one of the properties of the symbol, we do not group them by other properties. It makes the code more complex that it can be. This patch shows it can be simplified with the change performed. The patch changes the syntax to just: Symbols: Symbol1: ... Symbol2: ... ... With that, we are able to work with the binding field just like with any other symbol property. Differential revision: https://reviews.llvm.org/D60122 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@357595 91177308-0d34-0410-b5e6-96231b3b80d8 George Rimar 1 year, 2 months ago
119 changed file(s) with 1409 addition(s) and 1342 deletion(s). Raw diff Collapse all Expand all
5151 // Just use 64, since it can hold 32-bit values too.
5252 LLVM_YAML_STRONG_TYPEDEF(uint64_t, ELF_SHF)
5353 LLVM_YAML_STRONG_TYPEDEF(uint16_t, ELF_SHN)
54 LLVM_YAML_STRONG_TYPEDEF(uint8_t, ELF_STB)
5455 LLVM_YAML_STRONG_TYPEDEF(uint8_t, ELF_STT)
5556 LLVM_YAML_STRONG_TYPEDEF(uint8_t, ELF_STV)
5657 LLVM_YAML_STRONG_TYPEDEF(uint8_t, ELF_STO)
9697 ELF_STT Type;
9798 StringRef Section;
9899 Optional Index;
100 ELF_STB Binding;
99101 llvm::yaml::Hex64 Value;
100102 llvm::yaml::Hex64 Size;
101103 uint8_t Other;
102 };
103
104 struct SymbolsDef {
105 std::vector Local;
106 std::vector Global;
107 std::vector Weak;
108 std::vector GNUUnique;
109104 };
110105
111106 struct SectionOrType {
288283 // cleaner and nicer if we read them from the YAML as a separate
289284 // top-level key, which automatically ensures that invariants like there
290285 // being a single SHT_SYMTAB section are upheld.
291 SymbolsDef Symbols;
292 SymbolsDef DynamicSymbols;
286 std::vector Symbols;
287 std::vector DynamicSymbols;
293288 };
294289
295290 } // end namespace ELFYAML
361356 static void enumeration(IO &IO, ELFYAML::ELF_SHN &Value);
362357 };
363358
359 template <> struct ScalarEnumerationTraits {
360 static void enumeration(IO &IO, ELFYAML::ELF_STB &Value);
361 };
362
364363 template <>
365364 struct ScalarEnumerationTraits {
366365 static void enumeration(IO &IO, ELFYAML::ELF_STT &Value);
436435 static StringRef validate(IO &IO, ELFYAML::Symbol &Symbol);
437436 };
438437
439 template <> struct MappingTraits {
440 static void mapping(IO &IO, ELFYAML::SymbolsDef &Symbols);
441 };
442
443438 template <> struct MappingTraits {
444439 static void mapping(IO &IO, ELFYAML::DynamicEntry &Rel);
445440 };
559559 IO.enumFallback(Value);
560560 }
561561
562 void ScalarEnumerationTraits::enumeration(
563 IO &IO, ELFYAML::ELF_STB &Value) {
564 #define ECase(X) IO.enumCase(Value, #X, ELF::X)
565 ECase(STB_LOCAL);
566 ECase(STB_GLOBAL);
567 ECase(STB_WEAK);
568 ECase(STB_GNU_UNIQUE);
569 #undef ECase
570 IO.enumFallback(Value);
571 }
572
562573 void ScalarEnumerationTraits::enumeration(
563574 IO &IO, ELFYAML::ELF_STT &Value) {
564575 #define ECase(X) IO.enumCase(Value, #X, ELF::X)
844855 IO.mapOptional("Type", Symbol.Type, ELFYAML::ELF_STT(0));
845856 IO.mapOptional("Section", Symbol.Section, StringRef());
846857 IO.mapOptional("Index", Symbol.Index);
858 IO.mapOptional("Binding", Symbol.Binding, ELFYAML::ELF_STB(0));
847859 IO.mapOptional("Value", Symbol.Value, Hex64(0));
848860 IO.mapOptional("Size", Symbol.Size, Hex64(0));
849
850861 MappingNormalization Keys(IO, Symbol.Other);
851862 IO.mapOptional("Visibility", Keys->Visibility, ELFYAML::ELF_STV(0));
852863 IO.mapOptional("Other", Keys->Other, ELFYAML::ELF_STO(0));
861872 return "Large indexes are not supported";
862873 }
863874 return StringRef();
864 }
865
866 void MappingTraits::mapping(IO &IO,
867 ELFYAML::SymbolsDef &Symbols) {
868 IO.mapOptional("Local", Symbols.Local);
869 IO.mapOptional("Global", Symbols.Global);
870 IO.mapOptional("Weak", Symbols.Weak);
871 IO.mapOptional("GNUUnique", Symbols.GNUUnique);
872875 }
873876
874877 static void commonSectionMapping(IO &IO, ELFYAML::Section &Section) {
2727 Symbol: _start
2828 Type: 0xFF
2929 Symbols:
30 Global:
31 - Name: _start
32 Type: STT_FUNC
33 Section: .text
34 Value: 0x0
30 - Name: _start
31 Type: STT_FUNC
32 Section: .text
33 Value: 0x0
34 Binding: STB_GLOBAL
4242 Addend: 0
4343
4444 Symbols:
45 Local:
46 - Name: .text
47 Type: STT_SECTION
48 Section: .text
49
50 Global:
51 - Name: main
52 Type: STT_FUNC
53 Section: .text
54 Size: 0x08
45 - Name: .text
46 Type: STT_SECTION
47 Section: .text
48 - Name: main
49 Type: STT_FUNC
50 Section: .text
51 Size: 0x08
52 Binding: STB_GLOBAL
6464 Type: R_AMDGPU_RELATIVE64
6565
6666 Symbols:
67 Local:
68 - Name: .text
69 Type: STT_SECTION
70 Section: .text
71
72 Global:
73 - Name: main
74 Type: STT_FUNC
75 Section: .text
76 Size: 0x08
67 - Name: .text
68 Type: STT_SECTION
69 Section: .text
70 - Name: main
71 Type: STT_FUNC
72 Section: .text
73 Size: 0x08
74 Binding: STB_GLOBAL
4848
4949
5050 Symbols:
51 Local:
52 - Name: .text
53 Type: STT_SECTION
54 Section: .text
55
56 Global:
57 - Name: main
58 Type: STT_FUNC
59 Section: .text
60 Size: 0x08
51 - Name: .text
52 Type: STT_SECTION
53 Section: .text
54 - Name: main
55 Type: STT_FUNC
56 Section: .text
57 Size: 0x08
58 Binding: STB_GLOBAL
5858 Flags2: 0x0
5959
6060 Symbols:
61 Local:
62 - Name: .MIPS.abiflags
63 Type: STT_SECTION
64 Section: .MIPS.abiflags
61 - Name: .MIPS.abiflags
62 Type: STT_SECTION
63 Section: .MIPS.abiflags
6161 Size: 4
6262
6363 Symbols:
64 Global:
65 - Name: T1
66 Section: .text
67 Value: 0
68 Size: 4
64 - Name: T1
65 Section: .text
66 Value: 0
67 Size: 4
68 Binding: STB_GLOBAL
6969
7070 # o64
7171 --- !ELF
8383 Size: 4
8484
8585 Symbols:
86 Global:
87 - Name: T1
88 Section: .text
89 Value: 0
90 Size: 4
86 - Name: T1
87 Section: .text
88 Value: 0
89 Size: 4
90 Binding: STB_GLOBAL
9191
9292 # eabio32
9393 --- !ELF
105105 Size: 4
106106
107107 Symbols:
108 Global:
109 - Name: T1
110 Section: .text
111 Value: 0
112 Size: 4
108 - Name: T1
109 Section: .text
110 Value: 0
111 Size: 4
112 Binding: STB_GLOBAL
113113
114114 # eabi64
115115 --- !ELF
127127 Size: 4
128128
129129 Symbols:
130 Global:
131 - Name: T1
132 Section: .text
133 Value: 0
134 Size: 4
130 - Name: T1
131 Section: .text
132 Value: 0
133 Size: 4
134 Binding: STB_GLOBAL
135135 ...
4343 Size: 4
4444
4545 Symbols:
46 Global:
47 - Name: T1
48 Section: .text
49 Value: 0
50 Size: 4
46 - Name: T1
47 Section: .text
48 Value: 0
49 Size: 4
50 Binding: STB_GLOBAL
5151 ...
9797 Size: 0x0F
9898
9999 Symbols:
100 Local:
101 - Name: .text
102 Type: STT_SECTION
103 Section: .text
104 - Name: .rodata
105 Type: STT_SECTION
106 Section: .rodata
107 Global:
108 - Name: main
109 Type: STT_FUNC
110 Section: .text
111 Size: 0x58
112 - Name: printf
100 - Name: .text
101 Type: STT_SECTION
102 Section: .text
103 - Name: .rodata
104 Type: STT_SECTION
105 Section: .rodata
106 - Name: main
107 Type: STT_FUNC
108 Section: .text
109 Size: 0x58
110 Binding: STB_GLOBAL
111 - Name: printf
112 Binding: STB_GLOBAL
113113 ...
2727 Symbol: main
2828 Type: 0xFF
2929 Symbols:
30 Global:
31 - Name: main
30 - Name: main
31 Binding: STB_GLOBAL
2929 Type: R_386_32
3030
3131 Symbols:
32 Local:
33 - Name: .text
34 Type: STT_SECTION
35 Section: .text
36
37 Global:
38 - Name: main
39 Type: STT_FUNC
40 Section: .text
41 Size: 0x08
32 - Name: .text
33 Type: STT_SECTION
34 Section: .text
35 - Name: main
36 Type: STT_FUNC
37 Section: .text
38 Size: 0x08
39 Binding: STB_GLOBAL
2323 CHECK-NEXT: Symbol: ''
2424 CHECK-NEXT: Type: R_X86_64_NONE
2525 CHECK-NEXT: Symbols:
26 CHECK-NEXT: Local:
2726 CHECK-NEXT: - Name: rb_ary_new_capa
2827 CHECK-NEXT: Type: STT_FUNC
2928 CHECK-NEXT: Section: .text
3029 CHECK-NEXT: Size: 0x0000000000000005
31 CHECK-NEXT: Global:
3230 CHECK-NEXT: - Name: __dtraceenabled_ruby___array-create
3331 CHECK-NEXT: Index: SHN_ABS
32 CHECK-NEXT: Binding: STB_GLOBAL
3433 CHECK-NEXT: - Name: '$dtrace1316529.rb_ary_new_capa'
3534 CHECK-NEXT: Type: STT_FUNC
3635 CHECK-NEXT: Section: .text
36 CHECK-NEXT: Binding: STB_GLOBAL
3737 CHECK-NEXT: Size: 0x0000000000000005
3838 CHECK-NEXT: Visibility: STV_HIDDEN
420420 ELF-MIPSEL-NEXT: CPR1Size: REG_32
421421 ELF-MIPSEL-NEXT: Flags1: [ ODDSPREG ]
422422 ELF-MIPSEL-NEXT: Symbols:
423 ELF-MIPSEL-NEXT: Local:
424423 ELF-MIPSEL-NEXT: - Name: trivial.ll
425424 ELF-MIPSEL-NEXT: Type: STT_FILE
426425 ELF-MIPSEL-NEXT: Index: SHN_ABS
449448 ELF-MIPSEL-NEXT: - Name: .MIPS.abiflags
450449 ELF-MIPSEL-NEXT: Type: STT_SECTION
451450 ELF-MIPSEL-NEXT: Section: .MIPS.abiflags
452 ELF-MIPSEL-NEXT: Global:
453451 ELF-MIPSEL-NEXT: - Name: main
454452 ELF-MIPSEL-NEXT: Type: STT_FUNC
455453 ELF-MIPSEL-NEXT: Section: .text
454 ELF-MIPSEL-NEXT: Binding: STB_GLOBAL
456455 ELF-MIPSEL-NEXT: Size: 0x000000000000004C
457456 ELF-MIPSEL-NEXT: - Name: var
458457 ELF-MIPSEL-NEXT: Type: STT_OBJECT
459458 ELF-MIPSEL-NEXT: Section: .bss
459 ELF-MIPSEL-NEXT: Binding: STB_GLOBAL
460460 ELF-MIPSEL-NEXT: Size: 0x0000000000000004
461461 ELF-MIPSEL-NEXT: - Name: SomeOtherFunction
462 ELF-MIPSEL-NEXT: Binding: STB_GLOBAL
462463 ELF-MIPSEL-NEXT: - Name: _gp_disp
464 ELF-MIPSEL-NEXT: Binding: STB_GLOBAL
463465 ELF-MIPSEL-NEXT: - Name: puts
466 ELF-MIPSEL-NEXT: Binding: STB_GLOBAL
464467
465468 ELF-MIPS64EL: FileHeader:
466469 ELF-MIPS64EL-NEXT: Class: ELFCLASS64
504507 ELF-MIPS64EL-NEXT: AddressAlign: 0x0000000000000004
505508 ELF-MIPS64EL-NEXT: Content: ''
506509 ELF-MIPS64EL-NEXT: Symbols:
507 ELF-MIPS64EL-NEXT: Local:
508510 ELF-MIPS64EL-NEXT: - Name: .text
509511 ELF-MIPS64EL-NEXT: Type: STT_SECTION
510512 ELF-MIPS64EL-NEXT: Section: .text
522524 ELF-MIPS64EL-NEXT: - Name: .pdr
523525 ELF-MIPS64EL-NEXT: Type: STT_SECTION
524526 ELF-MIPS64EL-NEXT: Section: .pdr
525 ELF-MIPS64EL-NEXT: Global:
526527 ELF-MIPS64EL-NEXT: - Name: zed
528 ELF-MIPS64EL-NEXT: Binding: STB_GLOBAL
527529
528530 ELF-X86-64: FileHeader:
529531 ELF-X86-64-NEXT: Class: ELFCLASS64
568570 ELF-X86-64-NEXT: Type: R_X86_64_PC32
569571 ELF-X86-64-NEXT: Addend: -4
570572 ELF-X86-64-NEXT: Symbols:
571 ELF-X86-64-NEXT: Local:
572573 ELF-X86-64-NEXT: - Name: trivial-object-test.s
573574 ELF-X86-64-NEXT: Type: STT_FILE
574575 ELF-X86-64-NEXT: Index: SHN_ABS
581582 ELF-X86-64-NEXT: - Name: .note.GNU-stack
582583 ELF-X86-64-NEXT: Type: STT_SECTION
583584 ELF-X86-64-NEXT: Section: .note.GNU-stack
584 ELF-X86-64-NEXT: Global:
585585 ELF-X86-64-NEXT: - Name: main
586586 ELF-X86-64-NEXT: Type: STT_FUNC
587587 ELF-X86-64-NEXT: Section: .text
588 ELF-X86-64-NEXT: Binding: STB_GLOBAL
588589 ELF-X86-64-NEXT: Size: 0x0000000000000026
589590 ELF-X86-64-NEXT: - Name: SomeOtherFunction
591 ELF-X86-64-NEXT: Binding: STB_GLOBAL
590592 ELF-X86-64-NEXT: - Name: puts
591
593 ELF-X86-64-NEXT: Binding: STB_GLOBAL
592594
593595 ELF-AVR: FileHeader:
594596 ELF-AVR-NEXT: Class: ELFCLASS32
609611 ELF-AVR-NEXT: AddressAlign: 0x0000000000000001
610612 ELF-AVR-NEXT: Content: ''
611613 ELF-AVR-NEXT: Symbols:
612 ELF-AVR-NEXT: Local:
613614 ELF-AVR-NEXT: - Name: .text
614615 ELF-AVR-NEXT: Type: STT_SECTION
615616 ELF-AVR-NEXT: Section: .text
622623 ELF-AVR-NEXT: Index: SHN_ABS
623624 ELF-AVR-NEXT: - Name: main
624625 ELF-AVR-NEXT: Section: .text
625 ELF-AVR-NEXT: Global:
626626 ELF-AVR-NEXT: - Name: __trampolines_start
627627 ELF-AVR-NEXT: Section: .text
628 ELF-AVR-NEXT: Binding: STB_GLOBAL
628629 ELF-AVR-NEXT: - Name: _etext
629630 ELF-AVR-NEXT: Section: .text
631 ELF-AVR-NEXT: Binding: STB_GLOBAL
630632 ELF-AVR-NEXT: Value: 0x0000000000000004
631633 ELF-AVR-NEXT: - Name: __data_load_end
632634 ELF-AVR-NEXT: Index: SHN_ABS
635 ELF-AVR-NEXT: Binding: STB_GLOBAL
633636 ELF-AVR-NEXT: Value: 0x0000000000000004
634637 ELF-AVR-NEXT: - Name: __trampolines_end
635638 ELF-AVR-NEXT: Section: .text
639 ELF-AVR-NEXT: Binding: STB_GLOBAL
636640 ELF-AVR-NEXT: - Name: __data_load_start
637641 ELF-AVR-NEXT: Index: SHN_ABS
642 ELF-AVR-NEXT: Binding: STB_GLOBAL
638643 ELF-AVR-NEXT: Value: 0x0000000000000004
639644 ELF-AVR-NEXT: - Name: __dtors_end
640645 ELF-AVR-NEXT: Section: .text
646 ELF-AVR-NEXT: Binding: STB_GLOBAL
641647 ELF-AVR-NEXT: - Name: __eeprom_end
642648 ELF-AVR-NEXT: Section: .data
649 ELF-AVR-NEXT: Binding: STB_GLOBAL
643650 ELF-AVR-NEXT: Value: 0x0000000000810000
644651 ELF-AVR-NEXT: - Name: __ctors_start
645652 ELF-AVR-NEXT: Section: .text
653 ELF-AVR-NEXT: Binding: STB_GLOBAL
646654 ELF-AVR-NEXT: - Name: __dtors_start
647655 ELF-AVR-NEXT: Section: .text
656 ELF-AVR-NEXT: Binding: STB_GLOBAL
648657 ELF-AVR-NEXT: - Name: __ctors_end
649658 ELF-AVR-NEXT: Section: .text
659 ELF-AVR-NEXT: Binding: STB_GLOBAL
650660 ELF-AVR-NEXT: - Name: _edata
651661 ELF-AVR-NEXT: Section: .data
662 ELF-AVR-NEXT: Binding: STB_GLOBAL
652663 ELF-AVR-NEXT: Value: 0x0000000000800060
653664 ELF-AVR-NEXT: - Name: _end
654665 ELF-AVR-NEXT: Section: .data
666 ELF-AVR-NEXT: Binding: STB_GLOBAL
655667 ELF-AVR-NEXT: Value: 0x0000000000800060
656
657668
658669 WASM: --- !WASM
659670 WASM-NEXT: FileHeader:
4040 Size: 4
4141
4242 Symbols:
43 Global:
44 - Name: T0
45 Type: STT_FUNC
46 Section: .text
47 Size: 4
48 - Name: D0
49 Type: STT_OBJECT
50 Section: .data
51 Size: 4
43 - Name: T0
44 Type: STT_FUNC
45 Section: .text
46 Size: 4
47 Binding: STB_GLOBAL
48 - Name: D0
49 Type: STT_OBJECT
50 Section: .data
51 Size: 4
52 Binding: STB_GLOBAL
5253 ...
2424 Flags: [SHF_EXECINSTR, SHF_ALLOC]
2525
2626 Symbols:
27 Global:
28 - Name: T1
29 Section: .text
30 Type: STT_FUNC
31 Value: 0x0
32 Size: 8
27 - Name: T1
28 Section: .text
29 Type: STT_FUNC
30 Value: 0x0
31 Size: 8
32 Binding: STB_GLOBAL
3333
3434 --- !ELF
3535 FileHeader: !FileHeader
4646 Flags: [SHF_EXECINSTR, SHF_ALLOC]
4747
4848 Symbols:
49 Global:
50 - Name: T2
51 Section: .text
52 Type: STT_FUNC
53 Value: 0x0
54 Size: 4
49 - Name: T2
50 Section: .text
51 Type: STT_FUNC
52 Value: 0x0
53 Size: 4
54 Binding: STB_GLOBAL
5555 ...
3535 Type: SHT_ARM_ATTRIBUTES
3636 AddressAlign: 0x0000000000000001
3737 Content: 4115000000616561626900010B000000060208010901
38 Symbols:
39 Local:
40 - Name: .text
41 Type: STT_SECTION
42 Section: .text
43 - Name: .data
44 Type: STT_SECTION
45 Section: .data
46 - Name: .bss
47 Type: STT_SECTION
48 Section: .bss
49 - Name: '$a'
50 Section: .text
51 - Name: call_weak_fn
52 Type: STT_FUNC
53 Section: .text
54 - Name: .ARM.attributes
55 Type: STT_SECTION
56 Section: .ARM.attributes
38 Symbols:
39 - Name: .text
40 Type: STT_SECTION
41 Section: .text
42 - Name: .data
43 Type: STT_SECTION
44 Section: .data
45 - Name: .bss
46 Type: STT_SECTION
47 Section: .bss
48 - Name: '$a'
49 Section: .text
50 - Name: call_weak_fn
51 Type: STT_FUNC
52 Section: .text
53 - Name: .ARM.attributes
54 Type: STT_SECTION
55 Section: .ARM.attributes
5756
5857 # CHECK: Section {
5958 # CHECK-NEXT: Index: 0
4848 Type: R_MIPS_LO16
4949
5050 Symbols:
51 Local:
52 - Name: loc1
53 - Name: loc2
54 Global:
55 - Name: glob1
56 Section: .text
57 Value: 0x0
58 Size: 4
59 - Name: glob2
60 Weak:
61 - Name: weak1
51 - Name: loc1
52 - Name: loc2
53 - Name: glob1
54 Section: .text
55 Value: 0x0
56 Size: 4
57 Binding: STB_GLOBAL
58 - Name: glob2
59 Binding: STB_GLOBAL
60 - Name: weak1
61 Binding: STB_WEAK
6262
6363 # CHECK: Section {
6464 # CHECK-NEXT: Index: 0
1010 Flags: [ SHF_ALLOC, SHF_WRITE ]
1111 Content: "DEADBEEF"
1212 Symbols:
13 Local:
14 - Name: local_symbol
15 Type: STT_OBJECT
16 Section: .data
17 Global:
18 - Name: global_symbol
19 Type: STT_OBJECT
20 Section: .data
21 Weak:
22 - Name: weak_symbol
23 Type: STT_OBJECT
24 Section: .data
13 - Name: local_symbol
14 Type: STT_OBJECT
15 Section: .data
16 - Name: global_symbol
17 Type: STT_OBJECT
18 Section: .data
19 Binding: STB_GLOBAL
20 - Name: weak_symbol
21 Type: STT_OBJECT
22 Section: .data
23 Binding: STB_WEAK
2524
2625 # CHECK: Symbol {
2726 # CHECK: Name: (0)
1717 # when linked and run on x86_64, will go into an
1818 # infloop.
1919 Symbols:
20 Global:
21 - Name: main
22 Type: STT_FUNC
23 Section: .text
24 Value: 0x1
25 Size: 2
26 - Name: undefined_symbol
20 - Name: main
21 Type: STT_FUNC
22 Section: .text
23 Value: 0x1
24 Size: 2
25 Binding: STB_GLOBAL
26 - Name: undefined_symbol
27 Binding: STB_GLOBAL
2728
2829 # CHECK: Symbols [
2930 # CHECK-NEXT: Symbol {
5656 # OBJ-NEXT: }
5757
5858 # YAML: Symbols:
59 # YAML-NEXT: Global:
60 # YAML-NEXT: - Name: default1
61 # YAML-NEXT: Type: STT_OBJECT
62 # YAML-NEXT: Section: .data
63 # YAML-NEXT: Size: 0x0000000000000004
64 # YAML-NEXT: - Name: default2
65 # YAML-NEXT: Type: STT_OBJECT
66 # YAML-NEXT: Section: .data
67 # YAML-NEXT: Value: 0x0000000000000004
68 # YAML-NEXT: Size: 0x0000000000000004
69 # YAML-NEXT: - Name: internal
70 # YAML-NEXT: Type: STT_OBJECT
71 # YAML-NEXT: Section: .data
72 # YAML-NEXT: Value: 0x0000000000000008
73 # YAML-NEXT: Size: 0x0000000000000004
74 # YAML-NEXT: Visibility: STV_INTERNAL
75 # YAML-NEXT: - Name: hidden
76 # YAML-NEXT: Type: STT_OBJECT
77 # YAML-NEXT: Section: .data
78 # YAML-NEXT: Value: 0x000000000000000C
79 # YAML-NEXT: Size: 0x0000000000000004
80 # YAML-NEXT: Visibility: STV_HIDDEN
81 # YAML-NEXT: - Name: protected
82 # YAML-NEXT: Type: STT_OBJECT
83 # YAML-NEXT: Section: .data
84 # YAML-NEXT: Value: 0x0000000000000010
85 # YAML-NEXT: Size: 0x0000000000000004
86 # YAML-NEXT: Visibility: STV_PROTECTED
87 # YAML-NEXT: Other: [ STO_MIPS_PIC, STO_MIPS_MICROMIPS ]
59 # YAML-NEXT: - Name: default1
60 # YAML-NEXT: Type: STT_OBJECT
61 # YAML-NEXT: Section: .data
62 # YAML-NEXT: Binding: STB_GLOBAL
63 # YAML-NEXT: Size: 0x0000000000000004
64 # YAML-NEXT: - Name: default2
65 # YAML-NEXT: Type: STT_OBJECT
66 # YAML-NEXT: Section: .data
67 # YAML-NEXT: Binding: STB_GLOBAL
68 # YAML-NEXT: Value: 0x0000000000000004
69 # YAML-NEXT: Size: 0x0000000000000004
70 # YAML-NEXT: - Name: internal
71 # YAML-NEXT: Type: STT_OBJECT
72 # YAML-NEXT: Section: .data
73 # YAML-NEXT: Binding: STB_GLOBAL
74 # YAML-NEXT: Value: 0x0000000000000008
75 # YAML-NEXT: Size: 0x0000000000000004
76 # YAML-NEXT: Visibility: STV_INTERNAL
77 # YAML-NEXT: - Name: hidden
78 # YAML-NEXT: Type: STT_OBJECT
79 # YAML-NEXT: Section: .data
80 # YAML-NEXT: Binding: STB_GLOBAL
81 # YAML-NEXT: Value: 0x000000000000000C
82 # YAML-NEXT: Size: 0x0000000000000004
83 # YAML-NEXT: Visibility: STV_HIDDEN
84 # YAML-NEXT: - Name: protected
85 # YAML-NEXT: Type: STT_OBJECT
86 # YAML-NEXT: Section: .data
87 # YAML-NEXT: Binding: STB_GLOBAL
88 # YAML-NEXT: Value: 0x0000000000000010
89 # YAML-NEXT: Size: 0x0000000000000004
90 # YAML-NEXT: Visibility: STV_PROTECTED
91 # YAML-NEXT: Other: [ STO_MIPS_PIC, STO_MIPS_MICROMIPS ]
8892
8993 --- !ELF
9094 FileHeader:
102106 Size: 0x14
103107
104108 Symbols:
105 Global:
106 - Name: default1
107 Type: STT_OBJECT
108 Visibility: STV_DEFAULT
109 Section: .data
110 Value: 0x00
111 Size: 0x04
112 - Name: default2
113 Type: STT_OBJECT
114 Section: .data
115 Value: 0x04
116 Size: 0x04
117 - Name: internal
118 Type: STT_OBJECT
119 Visibility: STV_INTERNAL
120 Section: .data
121 Value: 0x08
122 Size: 0x04
123 - Name: hidden
124 Type: STT_OBJECT
125 Visibility: STV_HIDDEN
126 Section: .data
127 Value: 0x0C
128 Size: 0x04
129 - Name: protected
130 Type: STT_OBJECT
131 Visibility: STV_PROTECTED
132 Other: [ STO_MIPS_MICROMIPS, STO_MIPS_PIC ]
133 Section: .data
134 Value: 0x10
135 Size: 0x04
109 - Name: default1
110 Type: STT_OBJECT
111 Visibility: STV_DEFAULT
112 Section: .data
113 Value: 0x00
114 Size: 0x04
115 Binding: STB_GLOBAL
116 - Name: default2
117 Type: STT_OBJECT
118 Section: .data
119 Value: 0x04
120 Size: 0x04
121 Binding: STB_GLOBAL
122 - Name: internal
123 Type: STT_OBJECT
124 Visibility: STV_INTERNAL
125 Section: .data
126 Value: 0x08
127 Size: 0x04
128 Binding: STB_GLOBAL
129 - Name: hidden
130 Type: STT_OBJECT
131 Visibility: STV_HIDDEN
132 Section: .data
133 Value: 0x0C
134 Size: 0x04
135 Binding: STB_GLOBAL
136 - Name: protected
137 Type: STT_OBJECT
138 Visibility: STV_PROTECTED
139 Other: [ STO_MIPS_MICROMIPS, STO_MIPS_PIC ]
140 Section: .data
141 Value: 0x10
142 Size: 0x04
143 Binding: STB_GLOBAL
1919 AddressAlign: 0x0000000000000001
2020 Content: ''
2121 Symbols:
22 Global:
23 - Name: lib1
24 Index: SHN_ABS
25 Value: 0x1234
26 Local:
27 - Name: '-'
28 Type: STT_FILE
22 - Name: '-'
23 Type: STT_FILE
24 - Name: lib1
25 Index: SHN_ABS
26 Value: 0x1234
27 Binding: STB_GLOBAL
2928 ...
1919 AddressAlign: 0x0000000000000001
2020 Content: ''
2121 Symbols:
22 Global:
23 - Name: lib2
24 Index: SHN_ABS
25 Value: 0x1234
26 Local:
27 - Name: '-'
28 Type: STT_FILE
22 - Name: '-'
23 Type: STT_FILE
24 - Name: lib2
25 Index: SHN_ABS
26 Value: 0x1234
27 Binding: STB_GLOBAL
2928 ...
1919 AddressAlign: 0x0000000000000001
2020 Content: ''
2121 Symbols:
22 Global:
23 - Name: lib3
24 Index: SHN_ABS
25 Value: 0x1234
26 Local:
27 - Name: '-'
28 Type: STT_FILE
22 - Name: '-'
23 Type: STT_FILE
24 - Name: lib3
25 Index: SHN_ABS
26 Value: 0x1234
27 Binding: STB_GLOBAL
2928 ...
1919 AddressAlign: 0x0000000000000001
2020 Content: ''
2121 Symbols:
22 Local:
23 - Name: '-'
24 Type: STT_FILE
22 - Name: '-'
23 Type: STT_FILE
2524 ...
4343 Flags: [ SHF_GROUP ]
4444 Content: '00'
4545 Symbols:
46 Global:
47 - Name: .debug_foo
48 Type: STT_SECTION
49 Section: .debug_foo
50 - Name: .notdebug_foo
51 Type: STT_SECTION
52 Section: .notdebug_foo
53 - Name: .Linfo_string0
54 Section: .debug_bar
55 - Name: groupname
56 Section: .group
46 - Name: .debug_foo
47 Type: STT_SECTION
48 Section: .debug_foo
49 Binding: STB_GLOBAL
50 - Name: .notdebug_foo
51 Type: STT_SECTION
52 Section: .notdebug_foo
53 Binding: STB_GLOBAL
54 - Name: .Linfo_string0
55 Section: .debug_bar
56 Binding: STB_GLOBAL
57 - Name: groupname
58 Section: .group
59 Binding: STB_GLOBAL
5760 ...
88 Type: ET_EXEC
99 Machine: EM_X86_64
1010 Symbols:
11 Global:
12 - Name: test
13 Index: SHN_ABS
14 Value: 0x1234
11 - Name: test
12 Index: SHN_ABS
13 Value: 0x1234
14 Binding: STB_GLOBAL
1515
1616 #CHECK: Symbols [
1717 #CHECK-NEXT: Symbol {
3535 AddressAlign: 0x0000000000000004
3636 Content: ''
3737 Symbols:
38 Local:
39 - Name: .text.bar
40 Type: STT_SECTION
41 Section: .text.bar
42 - Name: .text.foo
43 Type: STT_SECTION
44 Section: .text.foo
45 - Name: .ARM.exidx.text.foo
46 Type: STT_SECTION
47 Section: .ARM.exidx.text.foo
38 - Name: .text.bar
39 Type: STT_SECTION
40 Section: .text.bar
41 - Name: .text.foo
42 Type: STT_SECTION
43 Section: .text.foo
44 - Name: .ARM.exidx.text.foo
45 Type: STT_SECTION
46 Section: .ARM.exidx.text.foo
4646 AddressAlign: 0x0000000000000010
4747 Content: "00000000"
4848 Symbols:
49 Global:
50 - Name: foo
51 Type: STT_FUNC
52 Section: .text
53 Value: 0x1004
49 - Name: foo
50 Type: STT_FUNC
51 Section: .text
52 Value: 0x1004
53 Binding: STB_GLOBAL
5454
5555 # CHECK: Type: SHT_NULL
5656
5555 Type: R_X86_64_PC32
5656 Addend: 0x13
5757 Symbols:
58 Global:
59 - Name: _start
60 Type: STT_FUNC
61 Section: .text
62 Value: 0x1000
63 Size: 4
64 - Name: foo
65 Type: STT_FUNC
66 Size: 4
67 - Name: fooA
68 Type: STT_FUNC
69 Size: 4
70 - Name: bar
71 Type: STT_OBJECT
72 Size: 4
73 - Name: barA
74 Type: STT_OBJECT
75 Size: 4
58 - Name: _start
59 Type: STT_FUNC
60 Section: .text
61 Value: 0x1000
62 Size: 4
63 Binding: STB_GLOBAL
64 - Name: foo
65 Type: STT_FUNC
66 Size: 4
67 Binding: STB_GLOBAL
68 - Name: fooA
69 Type: STT_FUNC
70 Size: 4
71 Binding: STB_GLOBAL
72 - Name: bar
73 Type: STT_OBJECT
74 Size: 4
75 Binding: STB_GLOBAL
76 - Name: barA
77 Type: STT_OBJECT
78 Size: 4
79 Binding: STB_GLOBAL
7680
7781 # CHECK: Relocations [
7882 # CHECK-NEXT: Section (2) .rel.text {
88 Type: ET_EXEC
99 Machine: EM_HEXAGON
1010 Symbols:
11 Global:
12 - Name: test
13 Index: SHN_COMMON
14 Value: 0x1234
15 - Name: test2
16 Index: SHN_HEXAGON_SCOMMON
17 Value: 0x1235
18 - Name: test3
19 Index: SHN_HEXAGON_SCOMMON_2
20 Value: 0x1236
21 - Name: test4
22 Index: SHN_HEXAGON_SCOMMON_4
23 Value: 0x1237
24 - Name: test5
25 Index: SHN_HEXAGON_SCOMMON_8
26 Value: 0x1238
11 - Name: test
12 Index: SHN_COMMON
13 Value: 0x1234
14 Binding: STB_GLOBAL
15 - Name: test2
16 Index: SHN_HEXAGON_SCOMMON
17 Value: 0x1235
18 Binding: STB_GLOBAL
19 - Name: test3
20 Index: SHN_HEXAGON_SCOMMON_2
21 Value: 0x1236
22 Binding: STB_GLOBAL
23 - Name: test4
24 Index: SHN_HEXAGON_SCOMMON_4
25 Value: 0x1237
26 Binding: STB_GLOBAL
27 - Name: test5
28 Index: SHN_HEXAGON_SCOMMON_8
29 Value: 0x1238
30 Binding: STB_GLOBAL
2731
2832 #CHECK: Symbols [
2933 #CHECK-NEXT: Symbol {
5252 Type: SHT_PROGBITS
5353 Flags: [ SHF_ALLOC ]
5454 Symbols:
55 Global:
56 - Name: foo
57 Type: STT_FUNC
58 Section: .text
59 Value: 0x1234
60 - Name: bar
61 Type: STT_OBJECT
62 Section: .data
63 Value: 0xabcd
55 - Name: foo
56 Type: STT_FUNC
57 Section: .text
58 Value: 0x1234
59 Binding: STB_GLOBAL
60 - Name: bar
61 Type: STT_OBJECT
62 Section: .data
63 Value: 0xabcd
64 Binding: STB_GLOBAL
6465
6566 # CHECK: Format:
6667 # 32-SAME: ELF32-
2121 Content: DEADBEEF
2222 Size: 16
2323 Symbols:
24 Global:
25 - Name: foo
26 Type: STT_FUNC
27 Section: .text
28 Value: 16
29 Size: 8
30 - Name: bar
31 Type: STT_OBJECT
32 Section: .data
33 Size: 16
24 - Name: foo
25 Type: STT_FUNC
26 Section: .text
27 Value: 16
28 Size: 8
29 Binding: STB_GLOBAL
30 - Name: bar
31 Type: STT_OBJECT
32 Section: .data
33 Size: 16
34 Binding: STB_GLOBAL
3435
3536 # CHECK: Sections [
3637 # CHECK-NEXT: Section {
3232 AddressAlign: 0x0000000000000010
3333 Size: 64
3434 Symbols:
35 Local:
36 - Name: Local
37 Type: STT_FUNC
38 Section: .text
39 Value: 0x1000
40 Size: 8
41 - Name: LocalSection
42 Type: STT_SECTION
43 Section: .text
44 - Name: LocalFile
45 Type: STT_FILE
46 Weak:
47 - Name: Weak
48 Type: STT_FUNC
49 Size: 8
50 Section: .text
51 Value: 0x1008
52 Global:
53 - Name: Global
54 Type: STT_FUNC
55 Size: 8
56 Section: .text
57 Value: 0x1010
35 - Name: Local
36 Type: STT_FUNC
37 Section: .text
38 Value: 0x1000
39 Size: 8
40 - Name: LocalSection
41 Type: STT_SECTION
42 Section: .text
43 - Name: LocalFile
44 Type: STT_FILE
45 - Name: Global
46 Type: STT_FUNC
47 Size: 8
48 Section: .text
49 Value: 0x1010
50 Binding: STB_GLOBAL
51 - Name: Weak
52 Type: STT_FUNC
53 Size: 8
54 Section: .text
55 Value: 0x1008
56 Binding: STB_WEAK
5857
5958 #CHECK: Symbols [
6059 #CHECK-NEXT: Symbol {
1818 Symbol: .L.rel
1919 Type: R_X86_64_PC32
2020 Symbols:
21 Local:
22 - Name: .L.rel
23 Type: STT_FUNC
24 Section: .text
21 - Name: .L.rel
22 Type: STT_FUNC
23 Section: .text
2524
2625 # CHECK: not stripping symbol '.L.rel' because it is named in a relocation.
3131 - Name: .LLVM.Custom.Section
3232 Type: SHT_PROGBITS
3333 Symbols:
34 Local:
35 - Name: Local
36 Type: STT_FUNC
37 Section: .text
38 - Name: .L.LocalSection
39 Type: STT_SECTION
40 Section: .text
41 - Type: STT_SECTION
42 Section: .LLVM.Custom.Section
43 - Name: .L.LocalFile
44 Type: STT_FILE
45 - Name: .L.str
46 Type: STT_OBJECT
47 Section: .text
48 - Name: .L.undefined
49 - Name: .L.abs
50 Index: SHN_ABS
51 Global:
52 - Name: .L.Global
53 Type: STT_FUNC
54 Section: .text
34 - Name: Local
35 Type: STT_FUNC
36 Section: .text
37 - Name: .L.LocalSection
38 Type: STT_SECTION
39 Section: .text
40 - Type: STT_SECTION
41 Section: .LLVM.Custom.Section
42 - Name: .L.LocalFile
43 Type: STT_FILE
44 - Name: .L.str
45 Type: STT_OBJECT
46 Section: .text
47 - Name: .L.undefined
48 - Name: .L.abs
49 Index: SHN_ABS
50 - Name: .L.Global
51 Type: STT_FUNC
52 Section: .text
53 Binding: STB_GLOBAL
5554
5655 # CHECK: Symbols [
5756 # CHECK-NEXT: Symbol {
5454 - Name: .text
5555 Type: SHT_PROGBITS
5656 Symbols:
57 Local:
58 - Name: Local
59 Type: STT_FUNC
60 Section: .text
61 - Name: .L.str
62 Type: STT_OBJECT
63 Section: .text
64 Global:
65 - Name: Global
66 Type: STT_FUNC
67 Section: .text
57 - Name: Local
58 Type: STT_FUNC
59 Section: .text
60 - Name: .L.str
61 Type: STT_OBJECT
62 Section: .text
63 - Name: Global
64 Type: STT_FUNC
65 Section: .text
66 Binding: STB_GLOBAL
6867
6968 # CHECK: Symbols [
7069 # CHECK-NEXT: Symbol {
3030 AddressAlign: 0x0000000000000010
3131 Size: 64
3232 Symbols:
33 Local:
34 - Name: Local
35 Type: STT_FUNC
36 Section: .text
37 Value: 0x1000
38 Size: 8
39 Weak:
40 - Name: Weak
41 Type: STT_FUNC
42 Size: 8
43 Section: .text
44 Value: 0x1008
45 - Name: WeakUndef
46 Global:
47 - Name: Global
48 Type: STT_FUNC
49 Size: 8
50 Section: .text
51 Value: 0x1010
33 - Name: Local
34 Type: STT_FUNC
35 Section: .text
36 Value: 0x1000
37 Size: 8
38 - Name: Global
39 Type: STT_FUNC
40 Size: 8
41 Section: .text
42 Value: 0x1010
43 Binding: STB_GLOBAL
44 - Name: Weak
45 Type: STT_FUNC
46 Size: 8
47 Section: .text
48 Value: 0x1008
49 Binding: STB_WEAK
50 - Name: WeakUndef
51 Binding: STB_WEAK
5252
5353 #CHECK: Symbols [
5454 #CHECK-NEXT: Symbol {
3232 Flags: [ SHF_ALLOC, SHF_EXECINSTR, SHF_GROUP ]
3333 AddressAlign: 0x0000000000000001
3434 Symbols:
35 Local:
36 - Name: foo
37 Section: .group
35 - Name: foo
36 Section: .group
3737 Flags: [ SHF_ALLOC, SHF_EXECINSTR, SHF_GROUP ]
3838 AddressAlign: 0x0000000000000010
3939 Symbols:
40 Local:
41 - Name: .text.bar
42 Type: STT_SECTION
43 Section: .text.bar
44 - Name: .text.foo
45 Type: STT_SECTION
46 Section: .text.foo
47 Weak:
48 - Name: bar
49 Type: STT_FUNC
50 Section: .text.bar
51 Size: 0x0000000000000000
52 - Name: foo
53 Type: STT_FUNC
54 Section: .text.foo
55 Size: 0x0000000000000000
40 - Name: .text.bar
41 Type: STT_SECTION
42 Section: .text.bar
43 - Name: .text.foo
44 Type: STT_SECTION
45 Section: .text.foo
46 - Name: bar
47 Type: STT_FUNC
48 Section: .text.bar
49 Size: 0x0000000000000000
50 Binding: STB_WEAK
51 - Name: foo
52 Type: STT_FUNC
53 Section: .text.foo
54 Size: 0x0000000000000000
55 Binding: STB_WEAK
3737 Flags: [ SHF_ALLOC, SHF_EXECINSTR ]
3838 AddressAlign: 0x0000000000000010
3939 Symbols:
40 Local:
41 - Name: .text.foo
42 Type: STT_SECTION
43 Section: .text.foo
44 - Name: .text.bar
45 Type: STT_SECTION
46 Section: .text.bar
47 Weak:
48 - Name: foo
49 Type: STT_FUNC
50 Section: .text.foo
51 Size: 0x0000000000000000
52 - Name: bar
53 Type: STT_FUNC
54 Section: .text.bar
55 Size: 0x0000000000000000
40 - Name: .text.foo
41 Type: STT_SECTION
42 Section: .text.foo
43 - Name: .text.bar
44 Type: STT_SECTION
45 Section: .text.bar
46 - Name: foo
47 Type: STT_FUNC
48 Section: .text.foo
49 Size: 0x0000000000000000
50 Binding: STB_WEAK
51 - Name: bar
52 Type: STT_FUNC
53 Section: .text.bar
54 Size: 0x0000000000000000
55 Binding: STB_WEAK
3737 Flags: [ SHF_ALLOC, SHF_EXECINSTR, SHF_GROUP ]
3838 AddressAlign: 0x0000000000000010
3939 Symbols:
40 Local:
41 - Name: .text.bar
42 Type: STT_SECTION
43 Section: .text.bar
44 - Name: .text.foo
45 Type: STT_SECTION
46 Section: .text.foo
47 Weak:
48 - Name: bar
49 Type: STT_FUNC
50 Section: .text.bar
51 Size: 0x0000000000000000
52 - Name: foo
53 Type: STT_FUNC
54 Section: .text.foo
55 Size: 0x0000000000000000
40 - Name: .text.bar
41 Type: STT_SECTION
42 Section: .text.bar
43 - Name: .text.foo
44 Type: STT_SECTION
45 Section: .text.foo
46 - Name: bar
47 Type: STT_FUNC
48 Section: .text.bar
49 Size: 0x0000000000000000
50 Binding: STB_WEAK
51 - Name: foo
52 Type: STT_FUNC
53 Section: .text.foo
54 Size: 0x0000000000000000
55 Binding: STB_WEAK
77 Type: ET_EXEC
88 Machine: EM_X86_64
99 Symbols:
10 Global:
11 - Name: test
12 Index: SHN_HEXAGON_SCOMMON
10 - Name: test
11 Index: SHN_HEXAGON_SCOMMON
12 Binding: STB_GLOBAL
1313
1414 # CHECK: Symbol 'test' has unsupported value greater than or equal to SHN_LORESERVE: 65280
2222 AddressAlign: 0x0000000000000010
2323 Size: 64
2424 Symbols:
25 Local:
26 - Name: foo
27 Type: STT_FILE
28 Section: .text
29 Global:
30 - Name: bar
31 Type: STT_FUNC
32 Section: .text
25 - Name: foo
26 Type: STT_FILE
27 Section: .text
28 - Name: bar
29 Type: STT_FUNC
30 Section: .text
31 Binding: STB_GLOBAL
3332
3433 #STRIPALL: Symbols [
3534 #STRIPALL-NEXT: Symbol {
2323 Type: SHT_PROGBITS
2424 Flags: [ SHF_ALLOC, SHF_EXECINSTR ]
2525 Symbols:
26 Local:
27 - Name: Local1
28 Section: .text
29 - Name: Local2
30 Section: .text
31 Weak:
32 - Name: Weak1
33 Section: .text
34 - Name: Weak2
35 Section: .text
36 Global:
37 - Name: Global1
38 Section: .text
39 - Name: Global2
40 Section: .text
26 - Name: Local1
27 Section: .text
28 - Name: Local2
29 Section: .text
30 - Name: Global1
31 Section: .text
32 Binding: STB_GLOBAL
33 - Name: Global2
34 Section: .text
35 Binding: STB_GLOBAL
36 - Name: Weak1
37 Section: .text
38 Binding: STB_WEAK
39 - Name: Weak2
40 Section: .text
41 Binding: STB_WEAK
4142
4243 # CHECK: Symbol table '.symtab' contains 7 entries:
4344 # CHECK-NEXT: Num: Value Size Type Bind Vis Ndx Name
5555 Type: SHT_PROGBITS
5656 Flags: [ SHF_ALLOC, SHF_EXECINSTR ]
5757 Symbols:
58 Local:
59 - Name: Local1
60 Section: .text
61 - Name: Local2
62 Section: .text
63 Weak:
64 - Name: Weak1
65 Section: .text
66 - Name: Weak2
67 Section: .text
68 - Name: Weak3
69 Section: .text
70 Global:
71 - Name: Global1
72 Section: .text
73 - Name: Global2
74 Section: .text
75 - Name: Global3
76 Section: .text
77 - Name: Global4
78 Section: .text
79 - Name: Global5
80 Section: .text
81 - Name: Global6
82 Section: .text
83 - Name: "Global5 Global6"
84 Section: .text
85 - Name: Global7
58 - Name: Local1
59 Section: .text
60 - Name: Local2
61 Section: .text
62 - Name: Global1
63 Section: .text
64 Binding: STB_GLOBAL
65 - Name: Global2
66 Section: .text
67 Binding: STB_GLOBAL
68 - Name: Global3
69 Section: .text
70 Binding: STB_GLOBAL
71 - Name: Global4
72 Section: .text
73 Binding: STB_GLOBAL
74 - Name: Global5
75 Section: .text
76 Binding: STB_GLOBAL
77 - Name: Global6
78 Section: .text
79 Binding: STB_GLOBAL
80 - Name: "Global5 Global6"
81 Section: .text
82 Binding: STB_GLOBAL
83 - Name: Global7
84 Binding: STB_GLOBAL
85 - Name: Weak1
86 Section: .text
87 Binding: STB_WEAK
88 - Name: Weak2
89 Section: .text
90 Binding: STB_WEAK
91 - Name: Weak3
92 Section: .text
93 Binding: STB_WEAK
8694
8795 # CHECK: Symbol table '.symtab' contains 14 entries:
8896 # CHECK-NEXT: Num: Value Size Type Bind Vis Ndx Name
1515 AddressAlign: 0x0000000000000010
1616 Size: 64
1717 Symbols:
18 Local:
19 - Name: foo
20 Type: STT_FUNC
21 Section: .text
22 Value: 0x1000
23 Size: 8
18 - Name: foo
19 Type: STT_FUNC
20 Section: .text
21 Value: 0x1000
22 Size: 8
2423
2524 #CHECK: Symbols [
2625 #CHECK-NEXT: Symbol {
2626 AddressAlign: 0x0000000000000010
2727 Size: 64
2828 Symbols:
29 Local:
30 - Name: foo
31 Type: STT_FUNC
32 Section: .text
33 Value: 0x1000
34 Size: 8
35 - Name: bar
36 Type: STT_FUNC
37 Section: .text
38 Value: 0x1008
39 Size: 8
40 - Name: baz
41 Type: STT_FUNC
42 Section: .text
43 Value: 0x1010
44 Size: 8
29 - Name: foo
30 Type: STT_FUNC
31 Section: .text
32 Value: 0x1000
33 Size: 8
34 - Name: bar
35 Type: STT_FUNC
36 Section: .text
37 Value: 0x1008
38 Size: 8
39 - Name: baz
40 Type: STT_FUNC
41 Section: .text
42 Value: 0x1010
43 Size: 8
4544
4645 #CHECK: Symbols [
4746 #CHECK-NEXT: Symbol {
2828 Symbol: undefGlobal
2929 Type: R_X86_64_PC32
3030 Symbols:
31 Local:
32 - Name: hiddenLocal
33 Type: STT_FUNC
34 Section: .text
35 Value: 0x1008
36 Size: 8
37 Visibility: STV_HIDDEN
38 Weak:
39 - Name: hiddenWeak
40 Type: STT_FUNC
41 Section: .text
42 Value: 0x1010
43 Size: 8
44 Visibility: STV_HIDDEN
45 Global:
46 - Name: defaultGlobal
47 Type: STT_FUNC
48 Size: 8
49 Section: .text
50 Value: 0x1000
51 - Name: hiddenGlobal
52 Type: STT_OBJECT
53 Section: .data
54 Value: 0x2006
55 Size: 2
56 Visibility: STV_HIDDEN
57 - Name: hiddenGlobalCommon
58 Type: STT_OBJECT
59 Index: SHN_COMMON
60 Value: 0x2006
61 Size: 2
62 Visibility: STV_HIDDEN
63 - Name: undefGlobal
64 Type: STT_FUNC
65 Size: 8
66 - Name: internalGlobal
67 Type: STT_OBJECT
68 Section: .data
69 Value: 0x2002
70 Size: 2
71 Visibility: STV_INTERNAL
72 - Name: protectedGlobal
73 Type: STT_OBJECT
74 Section: .data
75 Value: 0x2000
76 Size: 4
77 Visibility: STV_PROTECTED
31 - Name: hiddenLocal
32 Type: STT_FUNC
33 Section: .text
34 Value: 0x1008
35 Size: 8
36 Visibility: STV_HIDDEN
37 - Name: defaultGlobal
38 Type: STT_FUNC
39 Size: 8
40 Section: .text
41 Value: 0x1000
42 Binding: STB_GLOBAL
43 - Name: hiddenGlobal
44 Type: STT_OBJECT
45 Section: .data
46 Value: 0x2006
47 Size: 2
48 Visibility: STV_HIDDEN
49 Binding: STB_GLOBAL
50 - Name: hiddenGlobalCommon
51 Type: STT_OBJECT
52 Index: SHN_COMMON
53 Value: 0x2006
54 Size: 2
55 Visibility: STV_HIDDEN
56 Binding: STB_GLOBAL
57 - Name: undefGlobal
58 Type: STT_FUNC
59 Size: 8
60 Binding: STB_GLOBAL
61 - Name: internalGlobal
62 Type: STT_OBJECT
63 Section: .data
64 Value: 0x2002
65 Size: 2
66 Visibility: STV_INTERNAL
67 Binding: STB_GLOBAL
68 - Name: protectedGlobal
69 Type: STT_OBJECT
70 Section: .data
71 Value: 0x2000
72 Size: 4
73 Visibility: STV_PROTECTED
74 Binding: STB_GLOBAL
75 - Name: hiddenWeak
76 Type: STT_FUNC
77 Section: .text
78 Value: 0x1010
79 Size: 8
80 Visibility: STV_HIDDEN
81 Binding: STB_WEAK
7882
7983 #CHECK: Relocations [
8084 #CHECK-NEXT: Section (3) .rel.text {
4141 AddressAlign: 0x0000000000000010
4242 Content: "0000000000000000"
4343 Symbols:
44 Local:
45 - Name: Local
46 Type: STT_FUNC
47 Section: .text
48 Value: 0x1000
49 Size: 8
50 Weak:
51 - Name: Weak
52 Type: STT_FUNC
53 Size: 8
54 Section: .text
55 Value: 0x1008
56 Global:
57 - Name: Global
58 Type: STT_FUNC
59 Size: 8
60 Section: .text
61 Value: 0x1010
62 - Name: GlobalUndef
63 Type: STT_FUNC
64 - Name: GlobalCommon
65 Type: STT_OBJECT
66 Index: SHN_COMMON
67 Value: 0x2006
68 Size: 2
44 - Name: Local
45 Type: STT_FUNC
46 Section: .text
47 Value: 0x1000
48 Size: 8
49 - Name: Global
50 Type: STT_FUNC
51 Size: 8
52 Section: .text
53 Value: 0x1010
54 Binding: STB_GLOBAL
55 - Name: GlobalUndef
56 Type: STT_FUNC
57 Binding: STB_GLOBAL
58 - Name: GlobalCommon
59 Type: STT_OBJECT
60 Index: SHN_COMMON
61 Value: 0x2006
62 Size: 2
63 Binding: STB_GLOBAL
64 - Name: Weak
65 Type: STT_FUNC
66 Size: 8
67 Section: .text
68 Value: 0x1008
69 Binding: STB_WEAK
6970
7071 #CHECK: Symbols [
7172 #CHECK-NEXT: Symbol {
1717 AddressAlign: 0x0000000000000010
1818 Size: 64
1919 Symbols:
20 Local:
21 - Name: foo
22 Type: STT_SECTION
23 Section: .text
24 - Name: bar
25 Type: STT_FILE
26 Section: .text
27 Global:
28 - Name: foobar
29 Type: STT_FUNC
30 Section: .text
20 - Name: foo
21 Type: STT_SECTION
22 Section: .text
23 - Name: bar
24 Type: STT_FILE
25 Section: .text
26 - Name: foobar
27 Type: STT_FUNC
28 Section: .text
29 Binding: STB_GLOBAL
3130
3231 # COMMON: Symbols [
3332 # COMMON-NEXT: Symbol {
3232 AddressAlign: 0x0000000000000010
3333 Content: "0000000000000000"
3434 Symbols:
35 Global:
36 - Name: foo
37 Type: STT_FUNC
38 Section: .text
39 Value: 0x1004
40 - Name: bar
41 Type: STT_OBJECT
42 Section: .data
43 Value: 0x2000
44 Size: 4
45 - Name: empty
46 Type: STT_FUNC
47 Section: .text
48 Value: 0x1008
35 - Name: foo
36 Type: STT_FUNC
37 Section: .text
38 Value: 0x1004
39 Binding: STB_GLOBAL
40 - Name: bar
41 Type: STT_OBJECT
42 Section: .data
43 Value: 0x2000
44 Size: 4
45 Binding: STB_GLOBAL
46 - Name: empty
47 Type: STT_FUNC
48 Section: .text
49 Value: 0x1008
50 Binding: STB_GLOBAL
4951
5052 #CHECK: Symbols [
5153 #CHECK-NEXT: Symbol {
2929 AddressAlign: 0x0000000000000010
3030 Size: 64
3131 Symbols:
32 Local:
33 - Name: foobaz
34 Type: STT_FUNC
35 Section: .text
36 Value: 0x1000
37 Size: 8
38 - Name: bar
39 Type: STT_FUNC
40 Section: .text
41 Value: 0x1008
42 Size: 8
43 - Name: rebar
44 Type: STT_FUNC
45 Section: .text
46 Value: 0x1010
47 Size: 8
32 - Name: foobaz
33 Type: STT_FUNC
34 Section: .text
35 Value: 0x1000
36 Size: 8
37 - Name: bar
38 Type: STT_FUNC
39 Section: .text
40 Value: 0x1008
41 Size: 8
42 - Name: rebar
43 Type: STT_FUNC
44 Section: .text
45 Value: 0x1010
46 Size: 8
4847
4948 #REGEX1-NOT: foobaz
5049 #REGEX1-NOT: bar
2323 Type: R_X86_64_PC32
2424
2525 Symbols:
26 Global:
27 - Name: foo
28 Type: STT_FUNC
29 Size: 4
26 - Name: foo
27 Type: STT_FUNC
28 Size: 4
29 Binding: STB_GLOBAL
3030
3131 # CHECK: Symbol table .symtab cannot be removed because it is referenced by the relocation section .rel.text.
1515 Type: SHT_PROGBITS
1616 Flags: [ SHF_ALLOC ]
1717 Symbols:
18 Global:
19 - Name: test
20 Type: STT_FUNC
21 Section: .test
22 Value: 0x1000
23 Size: 4
24 - Name: test2
25 Type: STT_FUNC
26 Section: .test2
27 Value: 0x1000
28 Size: 4
18 - Name: test
19 Type: STT_FUNC
20 Section: .test
21 Value: 0x1000
22 Size: 4
23 Binding: STB_GLOBAL
24 - Name: test2
25 Type: STT_FUNC
26 Section: .test2
27 Value: 0x1000
28 Size: 4
29 Binding: STB_GLOBAL
2930
3031 # The sections counted here should be .test, .symtab, .strtab, and .shstrtab.
3132 # The 5th section is the null section.
5050 SHF_OS_NONCONFORMING, SHF_STRINGS, SHF_TLS, SHF_WRITE ]
5151 Content: "a4a4a4a4"
5252 Symbols:
53 Local:
5453 - Name: dummy
5554 Section: .group
5655
77 Type: ET_EXEC
88 Machine: EM_X86_64
99 Symbols:
10 Global:
11 - Name: test
12 Index: 0xff05
10 - Name: test
11 Index: 0xff05
12 Binding: STB_GLOBAL
1313
1414 # CHECK: Symbol 'test' has unsupported value greater than or equal to SHN_LORESERVE: 65285
3131 - Name: .debug_bar
3232 Type: SHT_PROGBITS
3333 Symbols:
34 Local:
35 - Name: foo
36 Type: STT_FUNC
37 Section: .text
38 Value: 0x1000
39 Size: 8
40 - Name: bar
41 Type: STT_FUNC
42 Section: .text
43 Value: 0x1008
44 Size: 8
45 - Name: baz
46 Type: STT_FUNC
47 Section: .text
48 Value: 0x1010
49 Size: 8
34 - Name: foo
35 Type: STT_FUNC
36 Section: .text
37 Value: 0x1000
38 Size: 8
39 - Name: bar
40 Type: STT_FUNC
41 Section: .text
42 Value: 0x1008
43 Size: 8
44 - Name: baz
45 Type: STT_FUNC
46 Section: .text
47 Value: 0x1010
48 Size: 8
5049
5150 # CHECK: Name: .text
5251 # CHECK: Name: .gnu.warning.foo
2727 AddressAlign: 0x0000000000000010
2828 Content: "00000000"
2929 Symbols:
30 Global:
31 - Name: debugfoo
32 Section: .debug_foo
33 - Name: foo
34 Section: .text
35 - Name: bar
36 Section: .text.bar
37
30 - Name: debugfoo
31 Section: .debug_foo
32 Binding: STB_GLOBAL
33 - Name: foo
34 Section: .text
35 Binding: STB_GLOBAL
36 - Name: bar
37 Section: .text.bar
38 Binding: STB_GLOBAL
39
3840 # CHECK: SectionHeaderCount: 3
3941
4042 # CHECK: Name: .text
2727 AddressAlign: 0x0000000000000010
2828 Content: "00000000"
2929 Symbols:
30 Global:
31 - Name: debugfoo
32 Section: .debug_foo
33 - Name: foo
34 Section: .text
35 - Name: bar
36 Section: .text.bar
37
30 - Name: debugfoo
31 Section: .debug_foo
32 Binding: STB_GLOBAL
33 - Name: foo
34 Section: .text
35 Binding: STB_GLOBAL
36 - Name: bar
37 Section: .text.bar
38 Binding: STB_GLOBAL
39
3840 # CHECK: SectionHeaderCount: 5
3941
4042 # CHECK: Name: .text
109109 AddressAlign: 0x0000000000000010
110110 Content: "00000000"
111111 Symbols:
112 Global:
113 - Name: foo
114 Section: .text
115 - Name: debugfoo
116 Section: .debugfoo
112 - Name: foo
113 Section: .text
114 Binding: STB_GLOBAL
115 - Name: debugfoo
116 Section: .debugfoo
117 Binding: STB_GLOBAL
117118
118119 # CHECK: SectionHeaderCount: 5
119120
2222 AddressAlign: 0x0000000000000010
2323 Size: 64
2424 Symbols:
25 Weak:
26 - Name: foo
27 Type: STT_FUNC
28 Section: .text
25 - Name: foo
26 Type: STT_FUNC
27 Section: .text
28 Binding: STB_WEAK
2929
3030 #CHECK: Symbol foo cannot be removed because it is referenced by the section .group[1].
3838 Type: SHT_PROGBITS
3939 Flags: [ SHF_ALLOC, SHF_EXECINSTR ]
4040 Symbols:
41 Local:
42 - Name: foo
43 Type: STT_FUNC
44 Section: .text
45 Value: 0x1234
46 Size: 8
47 - Name: bar
48 Type: STT_FUNC
49 Section: .text
50 Value: 0x5678
51 Size: 8
41 - Name: foo
42 Type: STT_FUNC
43 Section: .text
44 Value: 0x1234
45 Size: 8
46 - Name: bar
47 Type: STT_FUNC
48 Section: .text
49 Value: 0x5678
50 Size: 8
5251
5352 # CHECK: Symbols [
5453 # CHECK-NEXT: Symbol {
2121 Symbol: foo
2222 Type: R_X86_64_PC32
2323 Symbols:
24 Local:
25 - Name: foo
26 Type: STT_FUNC
27 Section: .text
28 Value: 0x1000
29 Size: 8
24 - Name: foo
25 Type: STT_FUNC
26 Section: .text
27 Value: 0x1000
28 Size: 8
3029
3130 #CHECK: not stripping symbol 'foo' because it is named in a relocation.
4242 AddressAlign: 0x0000000000000001
4343 Content: '0102'
4444 Symbols:
45 Local:
46 - Name: foo
47 Section: .data
48 Value: 0x0000000000000001
49 DynamicSymbols: {}
45 - Name: foo
46 Section: .data
47 Value: 0x0000000000000001
5048 ...
4242 Symbol: bar
4343 Type: R_X86_64_32S
4444 Symbols:
45 Global:
46 - Name: bar
47 Section: .text
45 - Name: bar
46 Section: .text
47 Binding: STB_GLOBAL
2727 AddressAlign: 0x0000000000000010
2828 Size: 64
2929 Symbols:
30 Local:
31 - Name: foo
32 Type: STT_FUNC
33 Section: .text
34 Value: 0x1000
35 Size: 8
36 Weak:
37 - Name: bar
38 Type: STT_FUNC
39 Size: 8
40 Section: .text
41 Value: 0x1008
42 Global:
43 - Name: baz
44 Type: STT_FUNC
45 Size: 8
46 Section: .text
47 Value: 0x1010
30 - Name: foo
31 Type: STT_FUNC
32 Section: .text
33 Value: 0x1000
34 Size: 8
35 - Name: bar
36 Type: STT_FUNC
37 Size: 8
38 Section: .text
39 Value: 0x1008
40 Binding: STB_WEAK
41 - Name: baz
42 Type: STT_FUNC
43 Size: 8
44 Section: .text
45 Value: 0x1010
46 Binding: STB_GLOBAL
4847
4948 #CHECK: Symbols [
5049 #CHECK-NEXT: Symbol {
5656 Symbol: foo
5757 Type: R_X86_64_PC32
5858 Symbols:
59 Local:
60 - Name: foo
61 Type: STT_FUNC
62 Section: .text
63 Value: 0x1000
64 Size: 8
65 - Name: bar
66 Type: STT_FUNC
67 Size: 8
68 Section: .text
69 Value: 0x1008
70 - Name: barfoo
71 Type: STT_FUNC
72 Size: 8
73 Section: .text
74 Value: 0x1010
75 - Name: fileSymbol
76 Type: STT_FILE
77 - Name: sectionSymbol
78 Type: STT_SECTION
79 Weak:
80 - Name: baz
81 Type: STT_FUNC
82 Size: 8
83 Section: .text
84 Value: 0x1018
85 - Name: foobaz
86 Type: STT_FUNC
87 Global:
88 - Name: foobar
89 Type: STT_FUNC
90 - Name: barbaz
91 Type: STT_FUNC
92 Size: 8
93 Section: .text
94 Value: 0x1020
59 - Name: foo
60 Type: STT_FUNC
61 Section: .text
62 Value: 0x1000
63 Size: 8
64 - Name: bar
65 Type: STT_FUNC
66 Size: 8
67 Section: .text
68 Value: 0x1008
69 - Name: barfoo
70 Type: STT_FUNC
71 Size: 8
72 Section: .text
73 Value: 0x1010
74 - Name: fileSymbol
75 Type: STT_FILE
76 - Name: sectionSymbol
77 Type: STT_SECTION
78 - Name: foobar
79 Type: STT_FUNC
80 Binding: STB_GLOBAL
81 - Name: barbaz
82 Type: STT_FUNC
83 Size: 8
84 Section: .text
85 Value: 0x1020
86 Binding: STB_GLOBAL
87 - Name: baz
88 Type: STT_FUNC
89 Size: 8
90 Section: .text
91 Value: 0x1018
92 Binding: STB_WEAK
93 - Name: foobaz
94 Type: STT_FUNC
95 Binding: STB_WEAK
9596
9697 #CHECK: Symbols [
9798 #CHECK-NEXT: Symbol {
2121 AddressAlign: 0x0000000000000010
2222 Content: "0000000000000000"
2323 Symbols:
24 Global:
25 - Name: _start
26 Type: STT_FUNC
27 Section: .text
28 Value: 0x1000
29 Size: 4
30 - Name: bam
31 Type: STT_FUNC
32 Section: .text
33 Value: 0x1001
34 Size: 4
35 Visibility: STV_HIDDEN
36 - Name: foo
37 Type: STT_FUNC
38 Section: .text
39 Value: 0x1004
40 - Name: faz
41 Type: STT_OBJECT
42 Section: .data
43 Value: 0x2002
44 Size: 2
45 Visibility: STV_INTERNAL
46 - Name: bar
47 Type: STT_OBJECT
48 Section: .data
49 Value: 0x2000
50 Size: 4
51 - Name: baz
52 Type: STT_OBJECT
53 Section: .data
54 Value: 0x2004
55 Size: 4
24 - Name: _start
25 Type: STT_FUNC
26 Section: .text
27 Value: 0x1000
28 Size: 4
29 Binding: STB_GLOBAL
30 - Name: bam
31 Type: STT_FUNC
32 Section: .text
33 Value: 0x1001
34 Size: 4
35 Visibility: STV_HIDDEN
36 Binding: STB_GLOBAL
37 - Name: foo
38 Type: STT_FUNC
39 Section: .text
40 Value: 0x1004
41 Binding: STB_GLOBAL
42 - Name: faz
43 Type: STT_OBJECT
44 Section: .data
45 Value: 0x2002
46 Size: 2
47 Visibility: STV_INTERNAL
48 Binding: STB_GLOBAL
49 - Name: bar
50 Type: STT_OBJECT
51 Section: .data
52 Value: 0x2000
53 Size: 4
54 Binding: STB_GLOBAL
55 - Name: baz
56 Type: STT_OBJECT
57 Section: .data
58 Value: 0x2004
59 Size: 4
60 Binding: STB_GLOBAL
5661
5762 #CHECK: Symbols [
5863 #CHECK-NEXT: Symbol {
3636 Type: SHT_PROGBITS
3737 Flags: [ SHF_ALLOC, SHF_EXECINSTR ]
3838 Symbols:
39 Local:
40 - Name: ""
41 Type: STT_SECTION
42 Section: .text
43 Global:
44 # We need to have a named symbol, otherwise the original
45 # issue that was fixed is not reproduced by this test.
46 - Name: foo
39 - Name: ""
40 Type: STT_SECTION
41 Section: .text
42 # We need to have a named symbol, otherwise the original
43 # issue that was fixed is not reproduced by this test.
44 - Name: foo
45 Binding: STB_GLOBAL
2222 Symbol: undefGlobal
2323 Type: R_X86_64_PC32
2424 Symbols:
25 Local:
26 - Name: Local
27 Type: STT_FUNC
28 Section: .text
29 Value: 0x1008
30 Size: 8
31 Weak:
32 - Name: Weak
33 Type: STT_FUNC
34 Size: 8
35 Section: .text
36 Value: 0x1010
37 Global:
38 - Name: Global
39 Type: STT_FUNC
40 Size: 8
41 Section: .text
42 Value: 0x1018
43 - Name: undefGlobal
44 Type: STT_FUNC
45 Size: 8
25 - Name: Local
26 Type: STT_FUNC
27 Section: .text
28 Value: 0x1008
29 Size: 8
30 - Name: Global
31 Type: STT_FUNC
32 Size: 8
33 Section: .text
34 Value: 0x1018
35 Binding: STB_GLOBAL
36 - Name: undefGlobal
37 Type: STT_FUNC
38 Size: 8
39 Binding: STB_GLOBAL
40 - Name: Weak
41 Type: STT_FUNC
42 Size: 8
43 Section: .text
44 Value: 0x1010
45 Binding: STB_WEAK
4646
4747 #CHECK: Symbols [
4848 #CHECK-NEXT: Symbol {
2727 AddressAlign: 0x0000000000000010
2828 Size: 64
2929 Symbols:
30 Local:
31 - Name: Local
32 Type: STT_FUNC
33 Section: .text
34 Value: 0x1000
35 Size: 8
36 Weak:
37 - Name: Weak
38 Type: STT_FUNC
39 Size: 8
40 Section: .text
41 Value: 0x1008
42 Global:
43 - Name: Global
44 Type: STT_FUNC
45 Size: 8
46 Section: .text
47 Value: 0x1010
30 - Name: Local
31 Type: STT_FUNC
32 Section: .text
33 Value: 0x1000
34 Size: 8
35 - Name: Global
36 Type: STT_FUNC
37 Size: 8
38 Section: .text
39 Value: 0x1010
40 Binding: STB_GLOBAL
41 - Name: Weak
42 Type: STT_FUNC
43 Size: 8
44 Section: .text
45 Value: 0x1008
46 Binding: STB_WEAK
4847
4948 #CHECK: Symbols [
5049 #CHECK-NEXT: Symbol {
3232 Flags: [ SHF_MERGE, SHF_STRINGS ]
3333 AddressAlign: 0x0000000000000001
3434 Content: 5562756E747520636C616E672076657273696F6E20332E352D317562756E74753120287472756E6B2920286261736564206F6E204C4C564D20332E352900
35 Symbols:
36 Local:
37 - Type: STT_SECTION
38 Section: .text
39 - Type: STT_SECTION
40 Section: .anothertext
41 Value: 0x0000000000000010
42 - Type: STT_SECTION
43 Section: .eh_frame
44 Value: 0x0000000000000050
45 - Type: STT_SECTION
46 Section: .data
47 Value: 0x00000000000000A8
48 - Type: STT_SECTION
49 Section: .comment
50 - Name: /tmp/a.c
51 Type: STT_FILE
52 - Type: STT_FILE
53 Global:
54 - Name: somedata
55 Type: STT_OBJECT
56 Section: .anothertext
57 Value: 0x0000000000000045
58 - Name: main
59 Type: STT_FUNC
60 Section: .anothertext
61 Value: 0x0000000000000010
62 Size: 0x000000000000003F
63 - Name: foo
64 Type: STT_FUNC
65 Section: .text
66 Size: 0x000000000000000D
67 - Name: a
68 Type: STT_OBJECT
69 Section: .data
70 Value: 0x00000000000000A8
71 Size: 0x0000000000000004
35 Symbols:
36 - Type: STT_SECTION
37 Section: .text
38 - Type: STT_SECTION
39 Section: .anothertext
40 Value: 0x0000000000000010
41 - Type: STT_SECTION
42 Section: .eh_frame
43 Value: 0x0000000000000050
44 - Type: STT_SECTION
45 Section: .data
46 Value: 0x00000000000000A8
47 - Type: STT_SECTION
48 Section: .comment
49 - Name: /tmp/a.c
50 Type: STT_FILE
51 - Type: STT_FILE
52 - Name: somedata
53 Type: STT_OBJECT
54 Section: .anothertext
55 Value: 0x0000000000000045
56 Binding: STB_GLOBAL
57 - Name: main
58 Type: STT_FUNC
59 Section: .anothertext
60 Value: 0x0000000000000010
61 Size: 0x000000000000003F
62 Binding: STB_GLOBAL
63 - Name: foo
64 Type: STT_FUNC
65 Section: .text
66 Size: 0x000000000000000D
67 Binding: STB_GLOBAL
68 - Name: a
69 Type: STT_OBJECT
70 Section: .data
71 Value: 0x00000000000000A8
72 Size: 0x0000000000000004
73 Binding: STB_GLOBAL
7274 ...
118118 Symbol: .text
119119 Type: R_X86_64_32
120120 Symbols:
121 Local:
122 - Name: func
123 Type: STT_FUNC
124 Section: .text
125 Value: 0x0000000000000001
126 - Name: sym
127 Section: .text
128 - Name: .text
129 Type: STT_SECTION
130 Section: .text
121 - Name: func
122 Type: STT_FUNC
123 Section: .text
124 Value: 0x0000000000000001
125 - Name: sym
126 Section: .text
127 - Name: .text
128 Type: STT_SECTION
129 Section: .text
5050 Symbol: x
5151 Type: R_X86_64_64
5252 Symbols:
53 Global:
54 - Name: x
53 - Name: x
54 Binding: STB_GLOBAL
2222 AddressAlign: 0x0000000000000010
2323 Content: "0000000000000000"
2424 Symbols:
25 Local:
26 - Name: _Z3fooi
27 Type: STT_FUNC
28 Section: .text1
29 Value: 0x1000
30 - Name: _Z3foov
31 Type: STT_FUNC
32 Section: .text2
33 Value: 0x1010
25 - Name: _Z3fooi
26 Type: STT_FUNC
27 Section: .text1
28 Value: 0x1000
29 - Name: _Z3foov
30 Type: STT_FUNC
31 Section: .text2
32 Value: 0x1010
3433
3534 # We just want to check that the symbols are demangled
3635 # DEMANGLE: foo(int)
6262 Type: R_X86_64_64
6363
6464 Symbols:
65 Local:
66 - Name: loc1
67 - Name: loc2
68 Global:
69 - Name: glob1
70 Section: .text
71 Value: 0x0
72 Size: 4
73 - Name: glob2
74
65 - Name: loc1
66 - Name: loc2
67 - Name: glob1
68 Section: .text
69 Value: 0x0
70 Size: 4
71 Binding: STB_GLOBAL
72 - Name: glob2
73 Binding: STB_GLOBAL
2727 AddressAlign: 0x0000000000000010
2828 Content: "00000000"
2929 Symbols:
30 Global:
31 - Name: foo
32 Type: STT_FUNC
33 Section: .text
34 Value: 0x1004
35 - Name: bar
36 Type: STT_OBJECT
37 Section: .text
38 Value: 0x1008
39 Local:
40 - Name: lfoo
41 Type: STT_FUNC
42 Section: .text
43 Value: 0x1004
44 - Name: lbar
45 Type: STT_OBJECT
46 Section: .text
47 Value: 0x1008
30 - Name: lfoo
31 Type: STT_FUNC
32 Section: .text
33 Value: 0x1004
34 - Name: lbar
35 Type: STT_OBJECT
36 Section: .text
37 Value: 0x1008
38 - Name: foo
39 Type: STT_FUNC
40 Section: .text
41 Value: 0x1004
42 Binding: STB_GLOBAL
43 - Name: bar
44 Type: STT_OBJECT
45 Section: .text
46 Value: 0x1008
47 Binding: STB_GLOBAL
4848
3535 - VERSION_1
3636 - VERSION_2
3737 DynamicSymbols:
38 Global:
39 - Name: bar
38 - Name: bar
39 Binding: STB_GLOBAL
4040 ...
4242 Flags: 12
4343 Other: 2
4444 DynamicSymbols:
45 Global:
46 - Name: f1
45 - Name: f1
46 Binding: STB_GLOBAL
4545 Flags: 12
4646 Other: 2
4747 DynamicSymbols:
48 Global:
49 - Name: f1
48 - Name: f1
49 Binding: STB_GLOBAL
2424 AddressAlign: 8
2525 Content: 1400000000000000017A5200017810011B0C070890010710140000001C000000B0F0FFFF2A00000000000000000000001400000000000000017A5200017810011B0C070890010000240000001C00000050F0FFFF20000000000E10460E184A0F0B770880003F1A3B2A332422000000001C000000440000003EF1FFFF1000000000410E108602430D064B0C07080000002C0000006400000038F1FFFF7F0C000000450C0A00491006027600450F0376780603660C0C0A00450C070800000000002C0000009400000088FDFFFF6600000000410E108602430D06428F03458E04478D058C06488307024B0C07080000000014000000C4000000C8FDFFFF01000000000000000000000000000000
2626 Symbols:
27 Global:
28 - Name: myfunc
29 Type: STT_FUNC
30 Section: .text
31 Value: 0x0000000000400000
27 - Name: myfunc
28 Type: STT_FUNC
29 Section: .text
30 Value: 0x0000000000400000
31 Binding: STB_GLOBAL
3232 ProgramHeaders:
3333 - Type: PT_LOAD
3434 Flags: [ PF_X, PF_R ]
7272 Members:
7373 - SectionOrType: GRP_COMDAT
7474 - SectionOrType: .foo
75 Symbols:
76 Local:
77 - Name: bar
78 Section: .group
79 - Name: zed
80 Section: .group1
75 Symbols:
76 - Name: bar
77 Section: .group
78 - Name: zed
79 Section: .group1
209209 Link: .symtab
210210 Content: "0102"
211211 Symbols:
212 Global:
213 - Name: _Z3fooc
214 Type: STT_FUNC
215 Section: .text.foo
216 - Name: _Z4blahf
217 Type: STT_FUNC
218 Section: .text.foo
212 - Name: _Z3fooc
213 Type: STT_FUNC
214 Section: .text.foo
215 Binding: STB_GLOBAL
216 - Name: _Z4blahf
217 Type: STT_FUNC
218 Section: .text.foo
219 Binding: STB_GLOBAL
219220 ProgramHeaders:
220221 - Type: PT_LOAD
221222 Flags: [ PF_R, PF_X ]
2727 - Name: .text
2828 Type: SHT_PROGBITS
2929 Symbols:
30 Global:
31 - Name: foobar
32 Section: .text
30 - Name: foobar
31 Section: .text
32 Binding: STB_GLOBAL
4040 AddressAlign: 0x0000000000000001
4141 Content: 41505332088020020108800280010202088180808010818080802002080181808080100802818080802004020C7E048180808010088180808020
4242 Symbols:
43 Global:
44 - Name: sym1
45 - Name: sym2
43 - Name: sym1
44 Binding: STB_GLOBAL
45 - Name: sym2
46 Binding: STB_GLOBAL
4647 ...
4748
4849 # RUN: yaml2obj -docnum 2 %s | llvm-readobj -elf-output-style=LLVM -relocations - | FileCheck --check-prefix=LLVM2 %s
8990 AddressAlign: 0x0000000000000001
9091 Content: 415053320A80200202088102830408037C08
9192 Symbols:
92 Global:
93 - Name: sym1
94 - Name: sym2
93 - Name: sym1
94 Binding: STB_GLOBAL
95 - Name: sym2
96 Binding: STB_GLOBAL
9597 ...
9698
9799 # RUN: yaml2obj -docnum 3 %s | llvm-readobj -elf-output-style=LLVM -relocations - | FileCheck --check-prefix=LLVM3 %s
131133 AddressAlign: 0x0000000000000001
132134 Content: 415053320680200208800208008001080802008001818080801008818080802002080881808080100008818080802008
133135 Symbols:
134 Global:
135 - Name: sym1
136 - Name: sym2
136 - Name: sym1
137 Binding: STB_GLOBAL
138 - Name: sym2
139 Binding: STB_GLOBAL
137140 ...
5959 Type: R_X86_64_NONE
6060 Addend: -1
6161 DynamicSymbols:
62 Global:
63 - Name: force_dynsym
62 - Name: force_dynsym
63 Binding: STB_GLOBAL
6464 ProgramHeaders:
6565 - Type: PT_LOAD
6666 VAddr: 0x1000
8383 Symbol: f3
8484 Type: R_X86_64_JUMP_SLOT
8585 Symbols:
86 Global:
87 - Name: f1
88 - Name: f2
89 - Name: g1
90 - Name: _Z2f1v
91 - Name: f3
86 - Name: f1
87 Binding: STB_GLOBAL
88 - Name: f2
89 Binding: STB_GLOBAL
90 - Name: g1
91 Binding: STB_GLOBAL
92 - Name: _Z2f1v
93 Binding: STB_GLOBAL
94 - Name: f3
95 Binding: STB_GLOBAL
9296 DynamicSymbols:
93 Global:
94 - Name: f1
95 - Name: f2
96 - Name: g1
97 - Name: _Z2f1v
98 - Name: f3
97 - Name: f1
98 Binding: STB_GLOBAL
99 - Name: f2
100 Binding: STB_GLOBAL
101 - Name: g1
102 Binding: STB_GLOBAL
103 - Name: _Z2f1v
104 Binding: STB_GLOBAL
105 - Name: f3
106 Binding: STB_GLOBAL
99107 ...
7373 Addend: 1
7474 Symbol: sym
7575 Symbols:
76 Global:
77 - Name: sym
78 Value: 0
79 Section: .text
76 - Name: sym
77 Value: 0
78 Section: .text
79 Binding: STB_GLOBAL
8080 DynamicSymbols:
81 Global:
82 - Name: sym
83 Value: 0
84 Section: .text
81 - Name: sym
82 Value: 0
83 Section: .text
84 Binding: STB_GLOBAL
8585 ProgramHeaders:
8686 - Type: PT_LOAD
8787 VAddr: 0x1000
217217 - Name: hiuser
218218 Type: 0xffffffff
219219 Symbols:
220 Global:
221 - Name: foo
220 - Name: foo
221 Binding: STB_GLOBAL
1717 Type: ET_REL
1818 Machine: EM_X86_64
1919 Symbols:
20 Local:
21 - Name: a_sym
22 Value: 0xfedcba9876543210
23 Size: 0x0123456789abcdef
20 - Name: a_sym
21 Value: 0xfedcba9876543210
22 Size: 0x0123456789abcdef
5151 # Symbol with st_name = 19, binding = 0xf
5252 Content: "0000000000000000000000000000000001000000000000000000000030000000090000000000000000000000a0000000100000000000000000000000b0000000130000000000000000000000f0000000"
5353 Symbols:
54 Local:
55 - Name: local
56 Global:
57 - Name: global
58 Weak:
59 - Name: weak
54 - Name: local
55 - Name: global
56 Binding: STB_GLOBAL
57 - Name: weak
58 Binding: STB_WEAK
7474 EntSize: 4
7575 Content: "0000000001000000"
7676 Symbols:
77 Global:
78 - Name: undef
79 - Name: normal
80 Section: .text
81 - Name: common
82 Index: SHN_COMMON
83 - Name: absolute
84 Index: SHN_ABS
85 - Name: proc
86 Index: 0xff01
87 - Name: os
88 Index: 0xff21
89 - Name: reserved
90 Index: 0xfffe
77 - Name: undef
78 Binding: STB_GLOBAL
79 - Name: normal
80 Section: .text
81 Binding: STB_GLOBAL
82 - Name: common
83 Index: SHN_COMMON
84 Binding: STB_GLOBAL
85 - Name: absolute
86 Index: SHN_ABS
87 Binding: STB_GLOBAL
88 - Name: proc
89 Index: 0xff01
90 Binding: STB_GLOBAL
91 - Name: os
92 Index: 0xff21
93 Binding: STB_GLOBAL
94 - Name: reserved
95 Index: 0xfffe
96 Binding: STB_GLOBAL
9197
9298 --- !ELF
9399 FileHeader:
96102 Type: ET_REL
97103 Machine: EM_386
98104 Symbols:
99 Global:
100 - Name: bad
101 Index: 0x42
105 - Name: bad
106 Index: 0x42
107 Binding: STB_GLOBAL
5050 - Name: .text
5151 Type: SHT_PROGBITS
5252 Symbols:
53 Global:
54 - Name: notype
55 Type: STT_NOTYPE
56 - Name: object
57 Type: STT_OBJECT
58 - Name: func
59 Type: STT_FUNC
60 - Name: .text
61 Type: STT_SECTION
62 Section: .text
63 - Name: file
64 Type: STT_FILE
65 - Name: common
66 Type: STT_COMMON
67 - Name: tls
68 Type: STT_TLS
69 - Name: gnu_ifunc
70 Type: STT_GNU_IFUNC
71 - Name: os_specific
72 Type: 11
73 - Name: proc_specific
74 Type: 13
75 - Name: unknown
76 Type: 7
53 - Name: notype
54 Type: STT_NOTYPE
55 Binding: STB_GLOBAL
56 - Name: object
57 Type: STT_OBJECT
58 Binding: STB_GLOBAL
59 - Name: func
60 Type: STT_FUNC
61 Binding: STB_GLOBAL
62 - Name: .text
63 Type: STT_SECTION
64 Section: .text
65 Binding: STB_GLOBAL
66 - Name: file
67 Type: STT_FILE
68 Binding: STB_GLOBAL
69 - Name: common
70 Type: STT_COMMON
71 Binding: STB_GLOBAL
72 - Name: tls
73 Type: STT_TLS
74 Binding: STB_GLOBAL
75 - Name: gnu_ifunc
76 Type: STT_GNU_IFUNC
77 Binding: STB_GLOBAL
78 - Name: os_specific
79 Type: 11
80 Binding: STB_GLOBAL
81 - Name: proc_specific
82 Type: 13
83 Binding: STB_GLOBAL
84 - Name: unknown
85 Type: 7
86 Binding: STB_GLOBAL
5151 # Symbol with st_name = 1, st_other = 0x4
5252 Content: "0000000000000000000000000000000001000000000000000000000000040000"
5353 Symbols:
54 Global:
55 - Name: default
56 Visibility: STV_DEFAULT
57 - Name: internal
58 Visibility: STV_INTERNAL
59 - Name: hidden
60 Visibility: STV_HIDDEN
61 - Name: protected
62 Visibility: STV_PROTECTED
54 - Name: default
55 Visibility: STV_DEFAULT
56 Binding: STB_GLOBAL
57 - Name: internal
58 Visibility: STV_INTERNAL
59 Binding: STB_GLOBAL
60 - Name: hidden
61 Visibility: STV_HIDDEN
62 Binding: STB_GLOBAL
63 - Name: protected
64 Visibility: STV_PROTECTED
65 Binding: STB_GLOBAL
100100 AddressAlign: 0x0000000000000004
101101 Content: 040000000900000004000000474E5500676F6C6420312E3131000000
102102 Symbols:
103 Local:
104 - Name: reduced.c
105 Type: STT_FILE
106 - Type: STT_FILE
107 Global:
108 - Name: main
109 Type: STT_FUNC
110 Section: .text
111 Value: 0x0000000000400140
112 Size: 0x0000000000000003
113 - Name: _edata
114 Value: 0x0000000000401000
115 - Name: __bss_start
116 Value: 0x0000000000401000
117 - Name: _end
118 Value: 0x0000000000401000
103 - Name: reduced.c
104 Type: STT_FILE
105 - Type: STT_FILE
106 - Name: main
107 Type: STT_FUNC
108 Section: .text
109 Value: 0x0000000000400140
110 Size: 0x0000000000000003
111 Binding: STB_GLOBAL
112 - Name: _edata
113 Value: 0x0000000000401000
114 Binding: STB_GLOBAL
115 - Name: __bss_start
116 Value: 0x0000000000401000
117 Binding: STB_GLOBAL
118 - Name: _end
119 Value: 0x0000000000401000
120 Binding: STB_GLOBAL
119121 ...
1010 # CHECK-NEXT: Type: ET_REL
1111 # CHECK-NEXT: Machine: EM_X86_64
1212 # CHECK-NEXT: Symbols:
13 # CHECK-NEXT: GNUUnique:
14 # CHECK-NEXT: - Name: foo
15 # CHECK-NEXT: Type: STT_OBJECT
16 # CHECK-NEXT: DynamicSymbols: {}
13 # CHECK-NEXT: - Name: foo
14 # CHECK-NEXT: Type: STT_OBJECT
15 # CHECK-NEXT: Binding: STB_GNU_UNIQUE
1716 # CHECK-NEXT: ...
1817
1918 --- !ELF
2423 Type: ET_REL
2524 Machine: EM_X86_64
2625 Symbols:
27 GNUUnique:
28 - Name: foo
29 Type: STT_OBJECT
26 - Name: foo
27 Type: STT_OBJECT
28 Binding: STB_GNU_UNIQUE
11 # test that we don't crash when passed object files without a symbol table
22 # CHECK-LABEL: FileHeader:
33 # CHECK-LABEL: Sections:
4 # CHECK-LABEL: Symbols:
4 # CHECK-NOT: Symbols:
33 ## Test checks that we are able to handle symbols with special/reserved indices.
44
55 # CHECK: Symbols:
6 # CHECK-NEXT: Global:
7 # CHECK-NEXT: - Name: absolute
8 # CHECK-NEXT: Index: SHN_ABS
9 # CHECK-NEXT: Value: 0x0000000000001234
10 # CHECK-NEXT: - Name: common
11 # CHECK-NEXT: Index: SHN_COMMON
12 # CHECK-NEXT: - Name: valid_index
13 # CHECK-NEXT: Section: .text
14 # CHECK-NEXT: - Name: processor_specific_index
15 # CHECK-NEXT: Index: SHN_HEXAGON_SCOMMON_1
16 # CHECK-NEXT: - Name: unknown_index
17 # CHECK-NEXT: Index: 0x0000FFFE
6 # CHECK-NEXT: - Name: absolute
7 # CHECK-NEXT: Index: SHN_ABS
8 # CHECK-NEXT: Binding: STB_GLOBAL
9 # CHECK-NEXT: Value: 0x0000000000001234
10 # CHECK-NEXT: - Name: common
11 # CHECK-NEXT: Index: SHN_COMMON
12 # CHECK-NEXT: Binding: STB_GLOBAL
13 # CHECK-NEXT: - Name: valid_index
14 # CHECK-NEXT: Section: .text
15 # CHECK-NEXT: Binding: STB_GLOBAL
16 # CHECK-NEXT: - Name: processor_specific_index
17 # CHECK-NEXT: Index: SHN_HEXAGON_SCOMMON_1
18 # CHECK-NEXT: Binding: STB_GLOBAL
19 # CHECK-NEXT: - Name: unknown_index
20 # CHECK-NEXT: Index: 0x0000FFFE
21 # CHECK-NEXT: Binding: STB_GLOBAL
1822
1923 !ELF
2024 FileHeader:
2630 - Name: .text
2731 Type: SHT_PROGBITS
2832 Symbols:
29 Global:
30 - Name: absolute
31 Index: SHN_ABS
32 Value: 0x1234
33 - Name: common
34 Index: SHN_COMMON
35 - Name: valid_index
36 Index: 0x1
37 - Name: processor_specific_index
38 Index: SHN_HEXAGON_SCOMMON_1
39 - Name: unknown_index
40 Index: 0xfffe
33 - Name: absolute
34 Index: SHN_ABS
35 Value: 0x1234
36 Binding: STB_GLOBAL
37 - Name: common
38 Index: SHN_COMMON
39 Binding: STB_GLOBAL
40 - Name: valid_index
41 Index: 0x1
42 Binding: STB_GLOBAL
43 - Name: processor_specific_index
44 Index: SHN_HEXAGON_SCOMMON_1
45 Binding: STB_GLOBAL
46 - Name: unknown_index
47 Index: 0xfffe
48 Binding: STB_GLOBAL
4149
4250 ## shn_xindex.o contains a symbol with st_shndx == SHN_XINDEX.
4351 ## We do not support it at this moment.
11 # RUN: obj2yaml %t | FileCheck %s
22
33 # CHECK: Symbols:
4 # CHECK-NEXT: Global:
5 # CHECK-NEXT: - Name: a_known_type
6 # CHECK-NEXT: Type: STT_OBJECT
7 # CHECK-NEXT: - Name: an_unknown_type
8 # CHECK-NEXT: Type: 0x07
4 # CHECK-NEXT: - Name: a_known_type
5 # CHECK-NEXT: Type: STT_OBJECT
6 # CHECK-NEXT: Binding: STB_GLOBAL
7 # CHECK-NEXT: - Name: an_unknown_type
8 # CHECK-NEXT: Type: 0x07
9 # CHECK-NEXT: Binding: STB_GLOBAL
910
1011 !ELF
1112 FileHeader:
1415 Type: ET_REL
1516 Machine: EM_X86_64
1617 Symbols:
17 Global:
18 - Name: a_known_type
19 Type: STT_OBJECT
20 - Name: an_unknown_type
21 Type: 0x7
18 - Name: a_known_type
19 Type: STT_OBJECT
20 Binding: STB_GLOBAL
21 - Name: an_unknown_type
22 Type: 0x7
23 Binding: STB_GLOBAL
6666 - VERSION_2
6767 - VERSION_3
6868 DynamicSymbols:
69 Global:
70 - Name: foo
69 - Name: foo
70 Binding: STB_GLOBAL
7171 ...
6464 Flags: 12
6565 Other: 2
6666 DynamicSymbols:
67 Global:
68 - Name: f1
67 - Name: f1
68 Binding: STB_GLOBAL
1818 # CHECK-NEXT: AddressAlign: 0x0000000000000002
1919 # CHECK-NEXT: EntSize: 0x0000000000000002
2020 # CHECK-NEXT: Entries: [ 0, 3, 4 ]
21 # CHECK-NEXT: Symbols: {}
2221 # CHECK-NEXT: DynamicSymbols:
23 # CHECK-NEXT: Global:
24 # CHECK-NEXT: - Name: f1
25 # CHECK-NEXT: - Name: f2
22 # CHECK-NEXT: - Name: f1
23 # CHECK-NEXT: Binding: STB_GLOBAL
24 # CHECK-NEXT: - Name: f2
25 # CHECK-NEXT: Binding: STB_GLOBAL
2626
2727 --- !ELF
2828 FileHeader:
4141 EntSize: 0x0000000000000002
4242 Entries: [ 0, 3, 4 ]
4343 DynamicSymbols:
44 Global:
45 - Name: f1
46 - Name: f2
44 - Name: f1
45 Binding: STB_GLOBAL
46 - Name: f2
47 Binding: STB_GLOBAL
4748 ...
170170 Relocations:
171171 - Offset: 0x0000000000000027
172172 Type: R_X86_64_64
173 Symbols:
174 Local:
175 - Name: f.c
176 Type: STT_FILE
177 - Type: STT_SECTION
178 Section: .text
179 - Type: STT_SECTION
180 Section: .debug_str
181 - Type: STT_SECTION
182 Section: .debug_abbrev
183 - Type: STT_SECTION
184 Section: .debug_info
185 - Type: STT_SECTION
186 Section: .debug_line
187 Global:
188 - Name: f1
189 Type: STT_FUNC
190 Section: .text
191 Size: 0x0000000000000006
192 - Name: f2
193 Type: STT_FUNC
194 Section: .text
195 Value: 0x0000000000000010
196 Size: 0x0000000000000006
197 - Name: f3
198 Type: STT_FUNC
199 Section: .text
200 Value: 0x0000000000000020
201 Size: 0x0000000000000006
173 Symbols:
174 - Name: f.c
175 Type: STT_FILE
176 - Type: STT_SECTION
177 Section: .text
178 - Type: STT_SECTION
179 Section: .debug_str
180 - Type: STT_SECTION
181 Section: .debug_abbrev
182 - Type: STT_SECTION
183 Section: .debug_info
184 - Type: STT_SECTION
185 Section: .debug_line
186 - Name: f1
187 Type: STT_FUNC
188 Section: .text
189 Size: 0x0000000000000006
190 Binding: STB_GLOBAL
191 - Name: f2
192 Type: STT_FUNC
193 Section: .text
194 Value: 0x0000000000000010
195 Size: 0x0000000000000006
196 Binding: STB_GLOBAL
197 - Name: f3
198 Type: STT_FUNC
199 Section: .text
200 Value: 0x0000000000000020
201 Size: 0x0000000000000006
202 Binding: STB_GLOBAL
202203 ...
1313 Type: SHT_PROGBITS
1414 Flags: [ SHF_ALLOC, SHF_WRITE ]
1515 DynamicSymbols:
16 Global:
17 - Name: dynglobal
18 Type: STT_OBJECT
19 Section: .data
20 Weak:
21 - Name: dynweak
22 Type: STT_OBJECT
23 Section: .data
24 Local:
25 - Name: dynlocal
26 Type: STT_OBJECT
27 Section: .data
16 - Name: dynglobal
17 Type: STT_OBJECT
18 Section: .data
19 Binding: STB_GLOBAL
20 - Name: dynweak
21 Type: STT_OBJECT
22 Section: .data
23 Binding: STB_WEAK
24 - Name: dynlocal
25 Type: STT_OBJECT
26 Section: .data
27 Binding: STB_LOCAL
2828
2929 # SECTION: Name: .dynsym
3030 # SECTION-NEXT: Type: SHT_DYNSYM
3535 Address: 0x2000
3636 EntSize: 0x18
3737 DynamicSymbols:
38 Global:
39 - Name: foo
38 - Name: foo
39 Binding: STB_GLOBAL
1515 - SectionOrType: 0xFF
1616 - SectionOrType: 3
1717 Symbols:
18 Global:
19 - Name: foo
18 - Name: foo
19 - Binding: STB_GLOBAL
2020
2121 ## Check we are able to produce SHT_GROUP section with a custom Type (0xFF).
2222 # CHECK: Groups {
1515 Type: ET_REL
1616 Machine: EM_X86_64
1717 Symbols:
18 GNUUnique:
19 - Name: foo
20 Type: STT_OBJECT
18 - Name: foo
19 Type: STT_OBJECT
20 Binding: STB_GNU_UNIQUE
0 ## Check we restrict placing local symbols after global in .symtab
1 ## We might want to change it later to allow doing that
2 ## for producing broken outputs.
3
4 # RUN: not yaml2obj %s -o %t 2>&1 | FileCheck %s
5 # CHECK: error: Local symbol 'bar' after global in Symbols list.
6
7 --- !ELF
8 FileHeader:
9 Class: ELFCLASS64
10 Data: ELFDATA2LSB
11 Type: ET_REL
12 Machine: EM_X86_64
13 Symbols:
14 - Name: foo
15 Binding: STB_GLOBAL
16 - Name: bar
17 Binding: STB_LOCAL
3535 Info: 26
3636 Type: SHT_SYMTAB
3737 Symbols:
38 Global:
39 - Name: foo