binutils-gdb/ld/emultempl
Alan Modra b209b5a6b8 SHF_LINK_ORDER fixup_link_order in ld
This moves the SHF_LINK_ORDER sorting from bfd_elf_final_link to
the linker which means generic ELF targets now support SHF_LINK_ORDER
and  we cope with odd cases that require resizing of output sections.
The patch also fixes two bugs in the current implementation,
introduced by commit cd6d537c48.  The pattern test used by that
commit meant that sections matching something like
"*(.IA_64.unwind* .gnu.linkonce.ia64unw.*)" would not properly sort a
mix of sections matching the two wildcards.  That commit also assumed
a stable qsort.

bfd/
	PR 27160
	* section.c (struct bfd_section): Remove pattern field.
	(BFD_FAKE_SECTION): Adjust to suit.
	* bfd-in2.h: Regenerate.
	* elflink.c (compare_link_order, elf_fixup_link_order): Delete.
	(bfd_elf_final_link): Don't call elf_fixup_link_order.
ld/
	PR 27160
	* ldlang.h (lang_output_section_statement_type): Add data field.
	(lang_input_section_type, lang_section_bst_type): Add pattern field.
	(statement_list): Declare.
	(lang_add_section): Adjust prototype.
	* emultempl/aarch64elf.em: Adjust lang_add_section calls.
	* emultempl/armelf.em: Likewise.
	* emultempl/beos.em: Likewise.
	* emultempl/cskyelf.em: Likewise.
	* emultempl/hppaelf.em: Likewise.
	* emultempl/m68hc1xelf.em: Likewise.
	* emultempl/metagelf.em: Likewise.
	* emultempl/mipself.em: Likewise.
	* emultempl/mmo.em: Likewise.
	* emultempl/msp430.em: Likewise.
	* emultempl/nios2elf.em: Likewise.
	* emultempl/pe.em: Likewise.
	* emultempl/pep.em: Likewise.
	* emultempl/ppc64elf.em: Likewise.
	* emultempl/spuelf.em: Likewise.
	* emultempl/vms.em: Likewise.
	* ldelf.c: Likewise.
	* ldelfgen.c: Include ldctor.h.
	(struct os_sections): New.
	(add_link_order_input_section, link_order_scan): New functions.
	(compare_link_order, fixup_link_order): New functions.
	(ldelf_map_segments): Call link_order_scan and fixup_link_order.
	* ldlang.c (statement_list): Make global.
	(output_section_callback_fast): Save pattern in tree node.
	(lang_add_section): Add pattern parameter, save in lang_input_section.
	(output_section_callback_tree_to_list): Adjust lang_add_section calls.
	(lang_insert_orphan, output_section_callback): Likewise.
	(ldlang_place_orphan): Likewise.
	(gc_section_callback): Don't set section->pattern
	* testsuite/ld-elf/pr26256-2a.d: Don't xfail generic.
	* testsuite/ld-elf/pr26256-3b.d: Likewise.
	* testsuite/ld-elf/pr26256-2b.d: Likewise.  notarget xgate.
2021-01-13 22:06:02 +10:30
..
aarch64elf.em SHF_LINK_ORDER fixup_link_order in ld 2021-01-13 22:06:02 +10:30
aix.em Update year range in copyright notice of binutils files 2021-01-01 10:31:05 +10:30
alphaelf.em Update year range in copyright notice of binutils files 2021-01-01 10:31:05 +10:30
arclinux.em Update year range in copyright notice of binutils files 2021-01-01 10:31:05 +10:30
armcoff.em Update year range in copyright notice of binutils files 2021-01-01 10:31:05 +10:30
armelf.em SHF_LINK_ORDER fixup_link_order in ld 2021-01-13 22:06:02 +10:30
astring.sed
avrelf.em Update year range in copyright notice of binutils files 2021-01-01 10:31:05 +10:30
beos.em SHF_LINK_ORDER fixup_link_order in ld 2021-01-13 22:06:02 +10:30
bfin.em Update year range in copyright notice of binutils files 2021-01-01 10:31:05 +10:30
cr16elf.em Update year range in copyright notice of binutils files 2021-01-01 10:31:05 +10:30
crxelf.em Update year range in copyright notice of binutils files 2021-01-01 10:31:05 +10:30
cskyelf.em SHF_LINK_ORDER fixup_link_order in ld 2021-01-13 22:06:02 +10:30
elf-generic.em Update year range in copyright notice of binutils files 2021-01-01 10:31:05 +10:30
elf-x86.em Update year range in copyright notice of binutils files 2021-01-01 10:31:05 +10:30
elf.em Update year range in copyright notice of binutils files 2021-01-01 10:31:05 +10:30
epiphanyelf_4x4.em Update year range in copyright notice of binutils files 2021-01-01 10:31:05 +10:30
genelf.em Update year range in copyright notice of binutils files 2021-01-01 10:31:05 +10:30
generic.em Update year range in copyright notice of binutils files 2021-01-01 10:31:05 +10:30
hppaelf.em SHF_LINK_ORDER fixup_link_order in ld 2021-01-13 22:06:02 +10:30
ia64elf.em Update year range in copyright notice of binutils files 2021-01-01 10:31:05 +10:30
irix.em Update year range in copyright notice of binutils files 2021-01-01 10:31:05 +10:30
linux.em Update year range in copyright notice of binutils files 2021-01-01 10:31:05 +10:30
m68hc1xelf.em SHF_LINK_ORDER fixup_link_order in ld 2021-01-13 22:06:02 +10:30
m68kelf.em Update year range in copyright notice of binutils files 2021-01-01 10:31:05 +10:30
metagelf.em SHF_LINK_ORDER fixup_link_order in ld 2021-01-13 22:06:02 +10:30
mipself.em SHF_LINK_ORDER fixup_link_order in ld 2021-01-13 22:06:02 +10:30
mmix-elfnmmo.em Update year range in copyright notice of binutils files 2021-01-01 10:31:05 +10:30
mmixelf.em Update year range in copyright notice of binutils files 2021-01-01 10:31:05 +10:30
mmo.em SHF_LINK_ORDER fixup_link_order in ld 2021-01-13 22:06:02 +10:30
msp430.em SHF_LINK_ORDER fixup_link_order in ld 2021-01-13 22:06:02 +10:30
nds32elf.em Update year range in copyright notice of binutils files 2021-01-01 10:31:05 +10:30
needrelax.em Update year range in copyright notice of binutils files 2021-01-01 10:31:05 +10:30
netbsd.em Update year range in copyright notice of binutils files 2021-01-01 10:31:05 +10:30
nios2elf.em SHF_LINK_ORDER fixup_link_order in ld 2021-01-13 22:06:02 +10:30
ostring.sed
pdp11.em Update year range in copyright notice of binutils files 2021-01-01 10:31:05 +10:30
pe.em SHF_LINK_ORDER fixup_link_order in ld 2021-01-13 22:06:02 +10:30
pep.em SHF_LINK_ORDER fixup_link_order in ld 2021-01-13 22:06:02 +10:30
ppc32elf.em Update year range in copyright notice of binutils files 2021-01-01 10:31:05 +10:30
ppc64elf.em SHF_LINK_ORDER fixup_link_order in ld 2021-01-13 22:06:02 +10:30
pruelf.em Update year range in copyright notice of binutils files 2021-01-01 10:31:05 +10:30
README Update year range in copyright notice of binutils files 2021-01-01 10:31:05 +10:30
riscvelf.em Update year range in copyright notice of binutils files 2021-01-01 10:31:05 +10:30
rxelf.em Update year range in copyright notice of binutils files 2021-01-01 10:31:05 +10:30
rxlinux.em Update year range in copyright notice of binutils files 2021-01-01 10:31:05 +10:30
s390.em Update year range in copyright notice of binutils files 2021-01-01 10:31:05 +10:30
scoreelf.em Update year range in copyright notice of binutils files 2021-01-01 10:31:05 +10:30
solaris2-x86.em Update year range in copyright notice of binutils files 2021-01-01 10:31:05 +10:30
solaris2.em Update year range in copyright notice of binutils files 2021-01-01 10:31:05 +10:30
spu_icache.o_c
spu_icache.S
spu_ovl.o_c
spu_ovl.S Update year range in copyright notice of binutils files 2021-01-01 10:31:05 +10:30
spuelf.em SHF_LINK_ORDER fixup_link_order in ld 2021-01-13 22:06:02 +10:30
tic6xdsbt.em Update year range in copyright notice of binutils files 2021-01-01 10:31:05 +10:30
ticoff.em Update year range in copyright notice of binutils files 2021-01-01 10:31:05 +10:30
v850elf.em Update year range in copyright notice of binutils files 2021-01-01 10:31:05 +10:30
vanilla.em Update year range in copyright notice of binutils files 2021-01-01 10:31:05 +10:30
vms.em SHF_LINK_ORDER fixup_link_order in ld 2021-01-13 22:06:02 +10:30
vxworks.em Update year range in copyright notice of binutils files 2021-01-01 10:31:05 +10:30
xtensaelf.em Update year range in copyright notice of binutils files 2021-01-01 10:31:05 +10:30
z80.em Update year range in copyright notice of binutils files 2021-01-01 10:31:05 +10:30

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

The files in this directory are sourced by genscripts.sh, after
setting some variables to substitute in, to produce
C source files that contain jump tables for each emulation.

Copyright (C) 2012-2021 Free Software Foundation, Inc.

Copying and distribution of this file, with or without modification,
are permitted in any medium without royalty provided the copyright
notice and this notice are preserved.