diff --git a/lld/test/ELF/icf-safe.s b/lld/test/ELF/icf-safe.s --- a/lld/test/ELF/icf-safe.s +++ b/lld/test/ELF/icf-safe.s @@ -61,9 +61,6 @@ # EXPORT: selected section {{.*}}:(.rodata.h3) # EXPORT: removing identical section {{.*}}:(.rodata.h4) # EXPORT-NOT: selected section -# EXPORT: selected section {{.*}}:(.text) -# EXPORT: removing identical section {{.*}}:(.text) -# EXPORT-NOT: selected section # EXPORT: selected section {{.*}}:(.rodata.l3) # EXPORT: removing identical section {{.*}}:(.rodata.l4) # EXPORT-NOT: selected section diff --git a/lld/test/ELF/lto/thinlto-single-module.ll b/lld/test/ELF/lto/thinlto-single-module.ll --- a/lld/test/ELF/lto/thinlto-single-module.ll +++ b/lld/test/ELF/lto/thinlto-single-module.ll @@ -18,6 +18,9 @@ ; DEFAULT: 0000000000000000 0 FILE LOCAL DEFAULT ABS ld-temp.o ; MAIN: Value Size Type Bind Vis Ndx Name ; MAIN: 0000000000000000 0 FILE LOCAL DEFAULT ABS thinlto-single-module.ll +; MAIN-NEXT: 0000000000000000 0 SECTION LOCAL DEFAULT 2 .text +; MAIN-NEXT: 0000000000000000 0 SECTION LOCAL DEFAULT 3 .text._start +; MAIN-NEXT: 0000000000000000 0 SECTION LOCAL DEFAULT 4 .note.GNU-stack ; MAIN-NEXT: 0000000000000000 3 FUNC GLOBAL DEFAULT 3 _start ;; --thinlto-single-module=thin.a should result in only thin1.o and thin2.o compiled. @@ -36,9 +39,15 @@ ; FOO: Value Size Type Bind Vis Ndx Name ; FOO: 0000000000000000 0 FILE LOCAL DEFAULT ABS thin1.ll +; FOO-NEXT: 0000000000000000 0 SECTION LOCAL DEFAULT 2 .text +; FOO-NEXT: 0000000000000000 0 SECTION LOCAL DEFAULT 3 .text.foo +; FOO-NEXT: 0000000000000000 0 SECTION LOCAL DEFAULT 4 .note.GNU-stack ; FOO-NEXT: 0000000000000000 6 FUNC GLOBAL DEFAULT 3 foo ; BLAH: Value Size Type Bind Vis Ndx Name ; BLAH: 0000000000000000 0 FILE LOCAL DEFAULT ABS thin2.ll +; BLAH-NEXT: 0000000000000000 0 SECTION LOCAL DEFAULT 2 .text +; BLAH-NEXT: 0000000000000000 0 SECTION LOCAL DEFAULT 3 .text.blah +; BLAH-NEXT: 0000000000000000 0 SECTION LOCAL DEFAULT 4 .note.GNU-stack ; BLAH-NEXT: 0000000000000000 4 FUNC GLOBAL DEFAULT 3 blah ;; Check only main.o is in the result thin index file. diff --git a/llvm/lib/MC/ELFObjectWriter.cpp b/llvm/lib/MC/ELFObjectWriter.cpp --- a/llvm/lib/MC/ELFObjectWriter.cpp +++ b/llvm/lib/MC/ELFObjectWriter.cpp @@ -598,9 +598,6 @@ if (Symbol.isTemporary()) return false; - if (Symbol.getType() == ELF::STT_SECTION) - return false; - return true; } diff --git a/llvm/test/CodeGen/PowerPC/pcrel-tls-general-dynamic.ll b/llvm/test/CodeGen/PowerPC/pcrel-tls-general-dynamic.ll --- a/llvm/test/CodeGen/PowerPC/pcrel-tls-general-dynamic.ll +++ b/llvm/test/CodeGen/PowerPC/pcrel-tls-general-dynamic.ll @@ -45,8 +45,8 @@ ; CHECK-O-NEXT: 0000000000000054: R_PPC64_REL24_NOTOC __tls_get_addr ; CHECK-O-NEXT: 58: 00 00 63 80 lwz 3, 0(3) - ; CHECK-SYM-LABEL: Symbol table '.symtab' contains 7 entries - ; CHECK-SYM: 6: 0000000000000000 0 TLS GLOBAL DEFAULT UND x + ; CHECK-SYM-LABEL: Symbol table '.symtab' contains 9 entries + ; CHECK-SYM: 8: 0000000000000000 0 TLS GLOBAL DEFAULT UND x entry: %0 = load i32, i32* @x, align 4 ret i32 %0 diff --git a/llvm/test/CodeGen/PowerPC/pcrel-tls-initial-exec.ll b/llvm/test/CodeGen/PowerPC/pcrel-tls-initial-exec.ll --- a/llvm/test/CodeGen/PowerPC/pcrel-tls-initial-exec.ll +++ b/llvm/test/CodeGen/PowerPC/pcrel-tls-initial-exec.ll @@ -42,8 +42,8 @@ ; CHECK-O-NEXT: 0000000000000029: R_PPC64_TLS x ; CHECK-O-NEXT: 20 00 80 4e blr -; CHECK-SYM-LABEL: Symbol table '.symtab' contains 6 entries -; CHECK-SYM: 5: 0000000000000000 0 TLS GLOBAL DEFAULT UND x +; CHECK-SYM-LABEL: Symbol table '.symtab' contains 8 entries +; CHECK-SYM: 7: 0000000000000000 0 TLS GLOBAL DEFAULT UND x entry: %0 = load i32, i32* @x, align 4 ret i32 %0 diff --git a/llvm/test/MC/AArch64/size-directive.s b/llvm/test/MC/AArch64/size-directive.s --- a/llvm/test/MC/AArch64/size-directive.s +++ b/llvm/test/MC/AArch64/size-directive.s @@ -33,6 +33,8 @@ // SYMS: Type Bind Vis Ndx Name // SYMS: NOTYPE LOCAL DEFAULT 3 $d.0 +// SYMS-NEXT: SECTION LOCAL DEFAULT 2 .text +// SYMS-NEXT: SECTION LOCAL DEFAULT 3 .size.aarch64_size // SYMS-NEXT: FUNC GLOBAL DEFAULT 3 aarch64_size // SYMS-NEXT: NOTYPE GLOBAL DEFAULT UND also_double_word // SYMS-NEXT: NOTYPE GLOBAL DEFAULT UND double_word diff --git a/llvm/test/MC/ELF/alias.s b/llvm/test/MC/ELF/alias.s --- a/llvm/test/MC/ELF/alias.s +++ b/llvm/test/MC/ELF/alias.s @@ -107,6 +107,15 @@ // CHECK-NEXT: Section: .text // CHECK-NEXT: } // CHECK-NEXT: Symbol { +// CHECK-NEXT: Name: .text (0) +// CHECK-NEXT: Value: 0x0 +// CHECK-NEXT: Size: 0 +// CHECK-NEXT: Binding: Local (0x0) +// CHECK-NEXT: Type: Section (0x3) +// CHECK-NEXT: Other: 0 +// CHECK-NEXT: Section: .text (0x2) +// CHECK-NEXT: } +// CHECK-NEXT: Symbol { // CHECK-NEXT: Name: .data (0) // CHECK-NOT: Symbol { // CHECK: } diff --git a/llvm/test/MC/ELF/cgprofile.s b/llvm/test/MC/ELF/cgprofile.s --- a/llvm/test/MC/ELF/cgprofile.s +++ b/llvm/test/MC/ELF/cgprofile.s @@ -27,10 +27,10 @@ # CHECK-NEXT: AddressAlignment: 1 # CHECK-NEXT: EntrySize: 16 # CHECK-NEXT: SectionData ( -# CHECK-NEXT: 0000: 01000000 05000000 20000000 00000000 -# CHECK-NEXT: 0010: 06000000 01000000 0B000000 00000000 -# CHECK-NEXT: 0020: 07000000 02000000 14000000 00000000 -# CHECK-NEXT: 0030: 04000000 05000000 2A000000 00000000 +# CHECK-NEXT: 0000: 01000000 06000000 20000000 00000000 +# CHECK-NEXT: 0010: 07000000 01000000 0B000000 00000000 +# CHECK-NEXT: 0020: 08000000 02000000 14000000 00000000 +# CHECK-NEXT: 0030: 05000000 06000000 2A000000 00000000 # CHECK-NEXT: ) # CHECK: Symbols [ @@ -55,6 +55,20 @@ # CHECK-NEXT: Type: # CHECK-NEXT: Other: # CHECK-NEXT: Section: .test +# CHECK: Name: .text +# CHECK-NEXT: Value: 0x0 +# CHECK-NEXT: Size: 0 +# CHECK-NEXT: Binding: Local +# CHECK-NEXT: Type: Section +# CHECK-NEXT: Other: 0 +# CHECK-NEXT: Section: .text +# CHECK: Name: .test +# CHECK-NEXT: Value: 0x0 +# CHECK-NEXT: Size: 0 +# CHECK-NEXT: Binding: Local +# CHECK-NEXT: Type: Section +# CHECK-NEXT: Other: 0 +# CHECK-NEXT: Section: .test # CHECK: Name: b # CHECK-NEXT: Value: # CHECK-NEXT: Size: @@ -97,4 +111,4 @@ # CHECK-NEXT: To: b # CHECK-NEXT: Weight: 42 # CHECK-NEXT: } -# CHECK-NEXT: ] \ No newline at end of file +# CHECK-NEXT: ] diff --git a/llvm/test/MC/ELF/comdat.s b/llvm/test/MC/ELF/comdat.s --- a/llvm/test/MC/ELF/comdat.s +++ b/llvm/test/MC/ELF/comdat.s @@ -46,7 +46,7 @@ // CHECK-NEXT: Offset: // CHECK-NEXT: Size: 12 // CHECK-NEXT: Link: -// CHECK-NEXT: Info: 3 +// CHECK-NEXT: Info: 8 // CHECK-NEXT: AddressAlignment: 4 // CHECK-NEXT: EntrySize: 4 // CHECK-NEXT: SectionData ( diff --git a/llvm/test/MC/ELF/empty.s b/llvm/test/MC/ELF/empty.s --- a/llvm/test/MC/ELF/empty.s +++ b/llvm/test/MC/ELF/empty.s @@ -48,9 +48,9 @@ // CHECK-NEXT: ] // CHECK-NEXT: Address: 0x0 // CHECK-NEXT: Offset: -// CHECK-NEXT: Size: 24 +// CHECK-NEXT: Size: 48 // CHECK-NEXT: Link: -// CHECK-NEXT: Info: 1 +// CHECK-NEXT: Info: 2 // CHECK-NEXT: AddressAlignment: 8 // CHECK-NEXT: EntrySize: 24 // CHECK-NEXT: } diff --git a/llvm/test/MC/ELF/reloc-same-name-section.s b/llvm/test/MC/ELF/reloc-same-name-section.s --- a/llvm/test/MC/ELF/reloc-same-name-section.s +++ b/llvm/test/MC/ELF/reloc-same-name-section.s @@ -7,13 +7,13 @@ // CHECK-NEXT: Relocation { // CHECK-NEXT: Offset: // CHECK-NEXT: Type: -// CHECK-NEXT: Symbol: .foo (4) +// CHECK-NEXT: Symbol: .foo (5) // CHECK-NEXT: Addend: // CHECK-NEXT: } // CHECK-NEXT: Relocation { // CHECK-NEXT: Offset: // CHECK-NEXT: Type: -// CHECK-NEXT: Symbol: .foo (5) +// CHECK-NEXT: Symbol: .foo (6) // CHECK-NEXT: Addend: // CHECK-NEXT: } // CHECK-NEXT: } diff --git a/llvm/test/MC/ELF/relocation-alias.s b/llvm/test/MC/ELF/relocation-alias.s --- a/llvm/test/MC/ELF/relocation-alias.s +++ b/llvm/test/MC/ELF/relocation-alias.s @@ -48,6 +48,7 @@ # SYM: NOTYPE LOCAL DEFAULT UND # SYM-NEXT: NOTYPE LOCAL DEFAULT ABS abs # SYM-NEXT: NOTYPE LOCAL DEFAULT 4 data_alias_l +# SYM-NEXT: SECTION LOCAL DEFAULT 2 .text # SYM-NEXT: SECTION LOCAL DEFAULT 4 .data # SYM-NEXT: NOTYPE GLOBAL DEFAULT UND __GI_memcpy # SYM-NEXT: NOTYPE GLOBAL DEFAULT 4 data diff --git a/llvm/test/MC/ELF/section-sym.s b/llvm/test/MC/ELF/section-sym.s --- a/llvm/test/MC/ELF/section-sym.s +++ b/llvm/test/MC/ELF/section-sym.s @@ -40,13 +40,13 @@ // CHECK-NEXT: EntrySize: 0 // CHECK-NEXT: } -// The relocation points to symbol 3 +// The relocation points to symbol 4 // CHECK: Relocations [ // CHECK-NEXT: Section ({{.*}}) .relabar { // CHECK-NEXT: Relocation { // CHECK-NEXT: Offset: 0x0 // CHECK-NEXT: Type: R_X86_64_32 (10) -// CHECK-NEXT: Symbol: foo (3) +// CHECK-NEXT: Symbol: foo (4) // CHECK-NEXT: Addend: 0x0 // CHECK-NEXT: } // CHECK-NEXT: } @@ -82,6 +82,15 @@ // CHECK-NEXT: Section: .group // CHECK-NEXT: } // CHECK-NEXT: Symbol { +// CHECK-NEXT: Name: .text (0) +// CHECK-NEXT: Value: 0x0 +// CHECK-NEXT: Size: 0 +// CHECK-NEXT: Binding: Local (0x0) +// CHECK-NEXT: Type: Section (0x3) +// CHECK-NEXT: Other: 0 +// CHECK-NEXT: Section: .text (0x2) +// CHECK-NEXT: } +// CHECK-NEXT: Symbol { // CHECK-NEXT: Name: foo (0) // CHECK-NEXT: Value: 0x0 // CHECK-NEXT: Size: 0 @@ -90,4 +99,22 @@ // CHECK-NEXT: Other: 0 // CHECK-NEXT: Section: foo (0x4) // CHECK-NEXT: } +// CHECK-NEXT: Symbol { +// CHECK-NEXT: Name: foo (0) +// CHECK-NEXT: Value: 0x0 +// CHECK-NEXT: Size: 0 +// CHECK-NEXT: Binding: Local (0x0) +// CHECK-NEXT: Type: Section (0x3) +// CHECK-NEXT: Other: 0 +// CHECK-NEXT: Section: foo (0x6) +// CHECK-NEXT: } +// CHECK-NEXT: Symbol { +// CHECK-NEXT: Name: bar (0) +// CHECK-NEXT: Value: 0x0 +// CHECK-NEXT: Size: 0 +// CHECK-NEXT: Binding: Local (0x0) +// CHECK-NEXT: Type: Section (0x3) +// CHECK-NEXT: Other: 0 +// CHECK-NEXT: Section: bar (0x7) +// CHECK-NEXT: } // CHECK-NEXT: ] diff --git a/llvm/test/MC/ELF/undef.s b/llvm/test/MC/ELF/undef.s --- a/llvm/test/MC/ELF/undef.s +++ b/llvm/test/MC/ELF/undef.s @@ -43,6 +43,24 @@ // CHECK-NEXT: Section: .rodata.str1.1 // CHECK-NEXT: } // CHECK-NEXT: Symbol { +// CHECK-NEXT: Name: .text (0) +// CHECK-NEXT: Value: 0x0 +// CHECK-NEXT: Size: 0 +// CHECK-NEXT: Binding: Local (0x0) +// CHECK-NEXT: Type: Section (0x3) +// CHECK-NEXT: Other: 0 +// CHECK-NEXT: Section: .text (0x2) +// CHECK-NEXT: } +// CHECK-NEXT: Symbol { +// CHECK-NEXT: Name: .rodata.str1.1 (0) +// CHECK-NEXT: Value: 0x0 +// CHECK-NEXT: Size: 0 +// CHECK-NEXT: Binding: Local (0x0) +// CHECK-NEXT: Type: Section (0x3) +// CHECK-NEXT: Other: 0 +// CHECK-NEXT: Section: .rodata.str1.1 (0x4) +// CHECK-NEXT: } +// CHECK-NEXT: Symbol { // CHECK-NEXT: Name: hidden // CHECK-NEXT: Value: 0x0 // CHECK-NEXT: Size: 0 diff --git a/llvm/test/tools/llvm-objdump/X86/demangle.s b/llvm/test/tools/llvm-objdump/X86/demangle.s --- a/llvm/test/tools/llvm-objdump/X86/demangle.s +++ b/llvm/test/tools/llvm-objdump/X86/demangle.s @@ -3,6 +3,7 @@ ## Check we demangle symbols when printing symbol table. # CHECK: SYMBOL TABLE: +# CHECK-NEXT: 0000000000000000 l d .text 0000000000000000 .text # CHECK-NEXT: 0000000000000000 g F .text 0000000000000000 foo() ## Check we demangle symbols when printing relocations. diff --git a/llvm/test/tools/llvm-readobj/ELF/many-sections2.s b/llvm/test/tools/llvm-readobj/ELF/many-sections2.s --- a/llvm/test/tools/llvm-readobj/ELF/many-sections2.s +++ b/llvm/test/tools/llvm-readobj/ELF/many-sections2.s @@ -19,6 +19,6 @@ .endr .endr -# CHECK: 65278: 0000000000000000 0 NOTYPE GLOBAL DEFAULT 65280 sym_65277 -# CHECK: 65310: 0000000000000000 0 NOTYPE GLOBAL DEFAULT 65312 sym_65309 -# CHECK: 65342: 0000000000000000 0 NOTYPE GLOBAL DEFAULT 65344 sym_65341 +# CHECK: 135279: 0000000000000000 0 NOTYPE GLOBAL DEFAULT 65280 sym_65277 +# CHECK: 135311: 0000000000000000 0 NOTYPE GLOBAL DEFAULT 65312 sym_65309 +# CHECK: 135343: 0000000000000000 0 NOTYPE GLOBAL DEFAULT 65344 sym_65341