Revert: PowerPC: Don't generate unused section symbols

Blindly following x86 broke linux kernel builds.

bfd/
	* elf32-ppc.c (TARGET_KEEP_UNUSED_SECTION_SYMBOLS): Define as true.
	* elf64-ppc.c (TARGET_KEEP_UNUSED_SECTION_SYMBOLS): Likewise.
gas/
	* testsuite/gas/ppc/power4.d: Adjust for section sym change.
	* testsuite/gas/ppc/test1elf32.d: Likewise.
	* testsuite/gas/ppc/test1elf64.d: Likewise.
ld/
	* testsuite/ld-powerpc/tlsexe.r: Adjust for section sym change.
	* testsuite/ld-powerpc/tlsexe32.r: Likewise.
	* testsuite/ld-powerpc/tlsexe32no.r: Likewise.
	* testsuite/ld-powerpc/tlsexeno.r: Likewise.
	* testsuite/ld-powerpc/tlsexenors.r: Likewise.
	* testsuite/ld-powerpc/tlsexers.r: Likewise.
	* testsuite/ld-powerpc/tlsexetoc.r: Likewise.
	* testsuite/ld-powerpc/tlsexetocrs.r: Likewise.
	* testsuite/ld-powerpc/tlsget.d: Likewise.
	* testsuite/ld-powerpc/tlsget.wf: Likewise.
	* testsuite/ld-powerpc/tlsget2.d: Likewise.
	* testsuite/ld-powerpc/tlsget2.wf: Likewise.
	* testsuite/ld-powerpc/tlsso.r: Likewise.
	* testsuite/ld-powerpc/tlsso32.r: Likewise.
	* testsuite/ld-powerpc/tlstocso.r: Likewise.

(cherry picked from commit c09c8b4202)
This commit is contained in:
Alan Modra 2021-07-24 15:34:55 +09:30
parent 6afc66a777
commit 9a98fad216
20 changed files with 170 additions and 27 deletions

View File

@ -19,8 +19,10 @@
Free Software Foundation, Inc., 51 Franklin Street - Fifth Floor,
Boston, MA 02110-1301, USA. */
/* Don't generate unused section symbols. */
#define TARGET_KEEP_UNUSED_SECTION_SYMBOLS false
/* The assembler should generate a full set of section symbols even
when they appear unused. The linux kernel build tool recordmcount
needs them. */
#define TARGET_KEEP_UNUSED_SECTION_SYMBOLS true
#include "sysdep.h"
#include <stdarg.h>

View File

@ -25,8 +25,10 @@
http://www.linuxbase.org/spec/ELF/ppc64/PPC-elf64abi.txt, and
http://www.linuxbase.org/spec/ELF/ppc64/spec/book1.html */
/* Don't generate unused section symbols. */
#define TARGET_KEEP_UNUSED_SECTION_SYMBOLS false
/* The assembler should generate a full set of section symbols even
when they appear unused. The linux kernel build tool recordmcount
needs them. */
#define TARGET_KEEP_UNUSED_SECTION_SYMBOLS true
#include "sysdep.h"
#include <stdarg.h>

View File

@ -21,6 +21,7 @@ Idx Name +Size +VMA +LMA +File off +Algn
SYMBOL TABLE:
0+ l +d +\.text 0+ (|\.text)
0+ l +d +\.data 0+ (|\.data)
0+ l +d +\.bss 0+ (|\.bss)
0+ l +\.data 0+ dsym0
0+10 l +\.data 0+ dsym1
0+ l +d +\.toc 0+ (|\.toc)

View File

@ -18,6 +18,7 @@ Idx Name +Size +VMA +LMA +File off +Algn
SYMBOL TABLE:
0+0000 l d \.text 0+0000 (|\.text)
0+0000 l d \.data 0+0000 (|\.data)
0+0000 l d \.bss 0+0000 (|\.bss)
0+0000 l \.data 0+0000 dsym0
0+0004 l \.data 0+0000 dsym1
0+0004 l \.data 0+0000 usym0

View File

@ -21,6 +21,7 @@ Idx Name Size VMA LMA File off Algn
SYMBOL TABLE:
0000000000000000 l d \.text 0000000000000000 (|\.text)
0000000000000000 l d \.data 0000000000000000 (|\.data)
0000000000000000 l d \.bss 0000000000000000 (|\.bss)
0000000000000000 l \.data 0000000000000000 dsym0
0000000000000008 l \.data 0000000000000000 dsym1
0000000000000000 l d \.toc 0000000000000000 (|\.toc)

View File

@ -70,6 +70,19 @@ Symbol table '\.dynsym' contains [0-9]+ entries:
Symbol table '\.symtab' contains [0-9]+ entries:
+Num: +Value +Size +Type +Bind +Vis +Ndx +Name
.* 0+ +0 +NOTYPE +LOCAL +DEFAULT +UND *
.* SECTION +LOCAL +DEFAULT +1 \.interp
.* SECTION +LOCAL +DEFAULT +2 \.hash
.* SECTION +LOCAL +DEFAULT +3 \.dynsym
.* SECTION +LOCAL +DEFAULT +4 \.dynstr
.* SECTION +LOCAL +DEFAULT +5 \.rela\.dyn
.* SECTION +LOCAL +DEFAULT +6 \.rela\.plt
.* SECTION +LOCAL +DEFAULT +7 \.text
.* SECTION +LOCAL +DEFAULT +8 \.tdata
.* SECTION +LOCAL +DEFAULT +9 \.tbss
.* SECTION +LOCAL +DEFAULT +10 \.dynamic
.* SECTION +LOCAL +DEFAULT +11 \.opd
.* SECTION +LOCAL +DEFAULT +12 \.got
.* SECTION +LOCAL +DEFAULT +13 \.plt
.* FILE +LOCAL +DEFAULT +ABS .*
.* NOTYPE +LOCAL +DEFAULT +ABS TLSMARK
.* TLS +LOCAL +DEFAULT +8 gd4

View File

@ -69,6 +69,18 @@ Symbol table '\.dynsym' contains [0-9]+ entries:
Symbol table '\.symtab' contains [0-9]+ entries:
+Num: +Value +Size +Type +Bind +Vis +Ndx +Name
.* NOTYPE +LOCAL +DEFAULT +UND
.* SECTION +LOCAL +DEFAULT +1 \.interp
.* SECTION +LOCAL +DEFAULT +2 \.hash
.* SECTION +LOCAL +DEFAULT +3 \.dynsym
.* SECTION +LOCAL +DEFAULT +4 \.dynstr
.* SECTION +LOCAL +DEFAULT +5 \.rela\.dyn
.* SECTION +LOCAL +DEFAULT +6 \.rela\.plt
.* SECTION +LOCAL +DEFAULT +7 \.text
.* SECTION +LOCAL +DEFAULT +8 \.tdata
.* SECTION +LOCAL +DEFAULT +9 \.tbss
.* SECTION +LOCAL +DEFAULT +10 \.dynamic
.* SECTION +LOCAL +DEFAULT +11 \.got
.* SECTION +LOCAL +DEFAULT +12 \.plt
.* FILE +LOCAL +DEFAULT +ABS .*
.* NOTYPE +LOCAL +DEFAULT +ABS TLSMARK
.* TLS +LOCAL +DEFAULT +8 gd4

View File

@ -70,6 +70,18 @@ Symbol table '\.dynsym' contains [0-9]+ entries:
Symbol table '\.symtab' contains [0-9]+ entries:
+Num: +Value +Size +Type +Bind +Vis +Ndx +Name
.* NOTYPE +LOCAL +DEFAULT +UND
.* SECTION +LOCAL +DEFAULT +1 \.interp
.* SECTION +LOCAL +DEFAULT +2 \.hash
.* SECTION +LOCAL +DEFAULT +3 \.dynsym
.* SECTION +LOCAL +DEFAULT +4 \.dynstr
.* SECTION +LOCAL +DEFAULT +5 \.rela\.dyn
.* SECTION +LOCAL +DEFAULT +6 \.rela\.plt
.* SECTION +LOCAL +DEFAULT +7 \.text
.* SECTION +LOCAL +DEFAULT +8 \.tdata
.* SECTION +LOCAL +DEFAULT +9 \.tbss
.* SECTION +LOCAL +DEFAULT +10 \.dynamic
.* SECTION +LOCAL +DEFAULT +11 \.got
.* SECTION +LOCAL +DEFAULT +12 \.plt
.* FILE +LOCAL +DEFAULT +ABS .*
.* NOTYPE +LOCAL +DEFAULT +ABS TLSMARK
.* TLS +LOCAL +DEFAULT +8 gd4

View File

@ -71,6 +71,19 @@ Symbol table '\.dynsym' contains [0-9]+ entries:
Symbol table '\.symtab' contains [0-9]+ entries:
+Num: +Value +Size +Type +Bind +Vis +Ndx +Name
.* 0+ +0 +NOTYPE +LOCAL +DEFAULT +UND *
.* SECTION +LOCAL +DEFAULT +1 \.interp
.* SECTION +LOCAL +DEFAULT +2 \.hash
.* SECTION +LOCAL +DEFAULT +3 \.dynsym
.* SECTION +LOCAL +DEFAULT +4 \.dynstr
.* SECTION +LOCAL +DEFAULT +5 \.rela\.dyn
.* SECTION +LOCAL +DEFAULT +6 \.rela\.plt
.* SECTION +LOCAL +DEFAULT +7 \.text
.* SECTION +LOCAL +DEFAULT +8 \.tdata
.* SECTION +LOCAL +DEFAULT +9 \.tbss
.* SECTION +LOCAL +DEFAULT +10 \.dynamic
.* SECTION +LOCAL +DEFAULT +11 \.opd
.* SECTION +LOCAL +DEFAULT +12 \.got
.* SECTION +LOCAL +DEFAULT +13 \.plt
.* FILE +LOCAL +DEFAULT +ABS .*
.* NOTYPE +LOCAL +DEFAULT +ABS TLSMARK
.* TLS +LOCAL +DEFAULT +8 gd4

View File

@ -71,6 +71,19 @@ Symbol table '\.dynsym' contains [0-9]+ entries:
Symbol table '\.symtab' contains [0-9]+ entries:
+Num: +Value +Size +Type +Bind +Vis +Ndx +Name
.* 0+ +0 +NOTYPE +LOCAL +DEFAULT +UND *
.* SECTION +LOCAL +DEFAULT +1 \.interp
.* SECTION +LOCAL +DEFAULT +2 \.hash
.* SECTION +LOCAL +DEFAULT +3 \.dynsym
.* SECTION +LOCAL +DEFAULT +4 \.dynstr
.* SECTION +LOCAL +DEFAULT +5 \.rela\.dyn
.* SECTION +LOCAL +DEFAULT +6 \.rela\.plt
.* SECTION +LOCAL +DEFAULT +7 \.text
.* SECTION +LOCAL +DEFAULT +8 \.tdata
.* SECTION +LOCAL +DEFAULT +9 \.tbss
.* SECTION +LOCAL +DEFAULT +10 \.dynamic
.* SECTION +LOCAL +DEFAULT +11 \.opd
.* SECTION +LOCAL +DEFAULT +12 \.got
.* SECTION +LOCAL +DEFAULT +13 \.plt
.* FILE +LOCAL +DEFAULT +ABS .*
.* NOTYPE +LOCAL +DEFAULT +ABS TLSMARK
.* TLS +LOCAL +DEFAULT +8 gd4

View File

@ -70,6 +70,19 @@ Symbol table '\.dynsym' contains [0-9]+ entries:
Symbol table '\.symtab' contains [0-9]+ entries:
+Num: +Value +Size +Type +Bind +Vis +Ndx +Name
.* 0+ +0 +NOTYPE +LOCAL +DEFAULT +UND *
.* SECTION +LOCAL +DEFAULT +1 \.interp
.* SECTION +LOCAL +DEFAULT +2 \.hash
.* SECTION +LOCAL +DEFAULT +3 \.dynsym
.* SECTION +LOCAL +DEFAULT +4 \.dynstr
.* SECTION +LOCAL +DEFAULT +5 \.rela\.dyn
.* SECTION +LOCAL +DEFAULT +6 \.rela\.plt
.* SECTION +LOCAL +DEFAULT +7 \.text
.* SECTION +LOCAL +DEFAULT +8 \.tdata
.* SECTION +LOCAL +DEFAULT +9 \.tbss
.* SECTION +LOCAL +DEFAULT +10 \.dynamic
.* SECTION +LOCAL +DEFAULT +11 \.opd
.* SECTION +LOCAL +DEFAULT +12 \.got
.* SECTION +LOCAL +DEFAULT +13 \.plt
.* FILE +LOCAL +DEFAULT +ABS .*
.* NOTYPE +LOCAL +DEFAULT +ABS TLSMARK
.* TLS +LOCAL +DEFAULT +8 gd4

View File

@ -71,6 +71,19 @@ Symbol table '\.dynsym' contains [0-9]+ entries:
Symbol table '\.symtab' contains [0-9]+ entries:
+Num: +Value +Size +Type +Bind +Vis +Ndx +Name
.* NOTYPE +LOCAL +DEFAULT +UND *
.* SECTION +LOCAL +DEFAULT +1 \.interp
.* SECTION +LOCAL +DEFAULT +2 \.hash
.* SECTION +LOCAL +DEFAULT +3 \.dynsym
.* SECTION +LOCAL +DEFAULT +4 \.dynstr
.* SECTION +LOCAL +DEFAULT +5 \.rela\.dyn
.* SECTION +LOCAL +DEFAULT +6 \.rela\.plt
.* SECTION +LOCAL +DEFAULT +7 \.text
.* SECTION +LOCAL +DEFAULT +8 \.tdata
.* SECTION +LOCAL +DEFAULT +9 \.tbss
.* SECTION +LOCAL +DEFAULT +10 \.dynamic
.* SECTION +LOCAL +DEFAULT +11 \.opd
.* SECTION +LOCAL +DEFAULT +12 \.got
.* SECTION +LOCAL +DEFAULT +13 \.plt
.* FILE +LOCAL +DEFAULT +ABS .*
.* TLS +LOCAL +DEFAULT +8 gd4
.* TLS +LOCAL +DEFAULT +8 ld4

View File

@ -71,6 +71,19 @@ Symbol table '\.dynsym' contains [0-9]+ entries:
Symbol table '\.symtab' contains [0-9]+ entries:
+Num: +Value +Size +Type +Bind +Vis +Ndx +Name
.* NOTYPE +LOCAL +DEFAULT +UND *
.* SECTION +LOCAL +DEFAULT +1 \.interp
.* SECTION +LOCAL +DEFAULT +2 \.hash
.* SECTION +LOCAL +DEFAULT +3 \.dynsym
.* SECTION +LOCAL +DEFAULT +4 \.dynstr
.* SECTION +LOCAL +DEFAULT +5 \.rela\.dyn
.* SECTION +LOCAL +DEFAULT +6 \.rela\.plt
.* SECTION +LOCAL +DEFAULT +7 \.text
.* SECTION +LOCAL +DEFAULT +8 \.tdata
.* SECTION +LOCAL +DEFAULT +9 \.tbss
.* SECTION +LOCAL +DEFAULT +10 \.dynamic
.* SECTION +LOCAL +DEFAULT +11 \.opd
.* SECTION +LOCAL +DEFAULT +12 \.got
.* SECTION +LOCAL +DEFAULT +13 \.plt
.* FILE +LOCAL +DEFAULT +ABS .*
.* TLS +LOCAL +DEFAULT +8 gd4
.* TLS +LOCAL +DEFAULT +8 ld4

View File

@ -8,6 +8,16 @@
Disassembly of section \.text:
.* <.*\.plt_call\..*>:
.*: (04 10 .. ..|.. .. 10 04) pld r12,.*
.*: (e5 80 .. ..|.. .. 80 e5)
.*: (7d 89 03 a6|a6 03 89 7d) mtctr r12
.*: (4e 80 04 20|20 04 80 4e) bctr
.*: (f8 41 00 18|18 00 41 f8) std r2,24\(r1\)
.*: (e9 82 .. ..|.. .. 82 e9) ld r12,.*\(r2\)
.*: (7d 89 03 a6|a6 03 89 7d) mtctr r12
.*: (4e 80 04 20|20 04 80 4e) bctr
.* <.*\.plt_call\.__tls_get_addr_opt.*>:
.*: (e8 03 00 00|00 00 03 e8) ld r0,0\(r3\)
.*: (e9 83 00 08|08 00 83 e9) ld r12,8\(r3\)
@ -38,17 +48,6 @@ Disassembly of section \.text:
.*: (e8 01 00 08|08 00 01 e8) ld r0,8\(r1\)
.*: (7c 08 03 a6|a6 03 08 7c) mtlr r0
.*: (4e 80 00 20|20 00 80 4e) blr
.* <.*\.plt_call\..*>:
.*: (60 00 00 00|00 00 00 60) nop
.*: (04 10 .. ..|.. .. 10 04) pld r12,.*
.*: (e5 80 .. ..|.. .. 80 e5)
.*: (7d 89 03 a6|a6 03 89 7d) mtctr r12
.*: (4e 80 04 20|20 04 80 4e) bctr
.*: (f8 41 00 18|18 00 41 f8) std r2,24\(r1\)
.*: (e9 82 .. ..|.. .. 82 e9) ld r12,.*\(r2\)
.*: (7d 89 03 a6|a6 03 89 7d) mtctr r12
.*: (4e 80 04 20|20 04 80 4e) bctr
#...
.* <_start>:
@ -60,7 +59,7 @@ Disassembly of section \.text:
.*: (4b ff .. ..|.. .. ff 4b) bl .* <.*\.plt_call\.__tls_get_addr_opt.*\+0x30>
.*: (60 00 00 00|00 00 00 60) nop
.*: (4b ff .. ..|.. .. ff 4b) bl .* <.*\.plt_call\..*:[^\+]*>
.*: (4b ff .. ..|.. .. ff 4b) bl .* <.*.plt_call\..*:.*\+0x14>
.*: (4b ff .. ..|.. .. ff 4b) bl .* <.*.plt_call\..*:.*\+0x10>
.*: (e8 41 00 18|18 00 41 e8) ld r2,24\(r1\)
.* <fun>:

View File

@ -9,8 +9,8 @@ Contents of the .eh_frame section:
Augmentation data: 1b
DW_CFA_def_cfa: r1 ofs 0
0+14 0+14 0+18 FDE cie=0+ pc=0+280..0+318
DW_CFA_advance_loc: 96 to 0+2e0
0+14 0+14 0+18 FDE cie=0+ pc=0+280..0+314
DW_CFA_advance_loc: 128 to 0+300
DW_CFA_offset_extended_sf: r65 at cfa\+8
DW_CFA_advance_loc: 16 to .*
DW_CFA_restore_extended: r65

View File

@ -8,6 +8,14 @@
Disassembly of section \.text:
.* <.*\.plt_call\..*>:
.*: (f8 41 00 18|18 00 41 f8) std r2,24\(r1\)
.*: (60 00 00 00|00 00 00 60) nop
.*: (04 10 .. ..|.. .. 10 04) pld r12,.*
.*: (e5 80 .. ..|.. .. 80 e5)
.*: (7d 89 03 a6|a6 03 89 7d) mtctr r12
.*: (4e 80 04 20|20 04 80 4e) bctr
.* <.*\.plt_call\.__tls_get_addr_opt.*>:
.*: (e8 03 00 00|00 00 03 e8) ld r0,0\(r3\)
.*: (e9 83 00 08|08 00 83 e9) ld r12,8\(r3\)
@ -27,14 +35,6 @@ Disassembly of section \.text:
.*: (e8 01 00 08|08 00 01 e8) ld r0,8\(r1\)
.*: (7c 08 03 a6|a6 03 08 7c) mtlr r0
.*: (4e 80 00 20|20 00 80 4e) blr
.* <.*\.plt_call\..*>:
.*: (f8 41 00 18|18 00 41 f8) std r2,24\(r1\)
.*: (60 00 00 00|00 00 00 60) nop
.*: (04 10 .. ..|.. .. 10 04) pld r12,.*
.*: (e5 80 .. ..|.. .. 80 e5)
.*: (7d 89 03 a6|a6 03 89 7d) mtctr r12
.*: (4e 80 04 20|20 04 80 4e) bctr
#...
.* <_start>:

View File

@ -10,7 +10,7 @@ Contents of the .eh_frame section:
DW_CFA_def_cfa: r1 ofs 0
0+14 0+14 0+18 FDE cie=0+ pc=0+280..0+2e0
DW_CFA_advance_loc: 52 to 0+2b4
DW_CFA_advance_loc: 76 to 0+2cc
DW_CFA_offset_extended_sf: r65 at cfa\+8
DW_CFA_advance_loc: 16 to .*
DW_CFA_restore_extended: r65

View File

@ -91,6 +91,18 @@ Symbol table '\.dynsym' contains [0-9]+ entries:
Symbol table '\.symtab' contains [0-9]+ entries:
+Num: +Value +Size +Type +Bind +Vis +Ndx +Name
.* NOTYPE +LOCAL +DEFAULT +UND *
.* SECTION +LOCAL +DEFAULT +1 \.hash
.* SECTION +LOCAL +DEFAULT +2 \.dynsym
.* SECTION +LOCAL +DEFAULT +3 \.dynstr
.* SECTION +LOCAL +DEFAULT +4 \.rela\.dyn
.* SECTION +LOCAL +DEFAULT +5 \.rela\.plt
.* SECTION +LOCAL +DEFAULT +6 \.text
.* SECTION +LOCAL +DEFAULT +7 \.tdata
.* SECTION +LOCAL +DEFAULT +8 \.tbss
.* SECTION +LOCAL +DEFAULT +9 \.dynamic
.* SECTION +LOCAL +DEFAULT +10 \.opd
.* SECTION +LOCAL +DEFAULT +11 \.got
.* SECTION +LOCAL +DEFAULT +12 \.plt
.* FILE +LOCAL +DEFAULT +ABS .*
.* NOTYPE +LOCAL +DEFAULT +ABS TLSMARK
.* TLS +LOCAL +DEFAULT +7 gd4

View File

@ -89,6 +89,17 @@ Symbol table '\.dynsym' contains [0-9]+ entries:
Symbol table '\.symtab' contains [0-9]+ entries:
+Num: +Value +Size +Type +Bind +Vis +Ndx +Name
.* NOTYPE +LOCAL +DEFAULT +UND
.* SECTION +LOCAL +DEFAULT +1 \.hash
.* SECTION +LOCAL +DEFAULT +2 \.dynsym
.* SECTION +LOCAL +DEFAULT +3 \.dynstr
.* SECTION +LOCAL +DEFAULT +4 \.rela\.dyn
.* SECTION +LOCAL +DEFAULT +5 \.rela\.plt
.* SECTION +LOCAL +DEFAULT +6 \.text
.* SECTION +LOCAL +DEFAULT +7 \.tdata
.* SECTION +LOCAL +DEFAULT +8 \.tbss
.* SECTION +LOCAL +DEFAULT +9 \.dynamic
.* SECTION +LOCAL +DEFAULT +10 \.got
.* SECTION +LOCAL +DEFAULT +11 \.plt
.* FILE +LOCAL +DEFAULT +ABS .*
.* NOTYPE +LOCAL +DEFAULT +ABS TLSMARK
.* TLS +LOCAL +DEFAULT +7 gd4

View File

@ -84,6 +84,18 @@ Symbol table '\.dynsym' contains [0-9]+ entries:
Symbol table '\.symtab' contains [0-9]+ entries:
+Num: +Value +Size +Type +Bind +Vis +Ndx +Name
.* NOTYPE +LOCAL +DEFAULT +UND *
.* SECTION +LOCAL +DEFAULT +1 \.hash
.* SECTION +LOCAL +DEFAULT +2 \.dynsym
.* SECTION +LOCAL +DEFAULT +3 \.dynstr
.* SECTION +LOCAL +DEFAULT +4 \.rela\.dyn
.* SECTION +LOCAL +DEFAULT +5 \.rela\.plt
.* SECTION +LOCAL +DEFAULT +6 \.text
.* SECTION +LOCAL +DEFAULT +7 \.tdata
.* SECTION +LOCAL +DEFAULT +8 \.tbss
.* SECTION +LOCAL +DEFAULT +9 \.dynamic
.* SECTION +LOCAL +DEFAULT +10 \.opd
.* SECTION +LOCAL +DEFAULT +11 \.got
.* SECTION +LOCAL +DEFAULT +12 \.plt
.* FILE +LOCAL +DEFAULT +ABS .*
.* TLS +LOCAL +DEFAULT +7 gd4
.* TLS +LOCAL +DEFAULT +7 ld4