binutils-gdb/ld/scripttempl
Clément Chigot 1b2cb8e2ee aix: implement TLS relocation for gas and ld
Add support for TLS in XCOFF. Amongst the things done by this commit:
 - Update XCOFF auxialiary header to match new version and allow TLS
   sections.
 - Add TLS sections (.tdata and .tbss) support in gas and ld.
 - Add support for the TLS relocations in gas and ld.
   Two different types BFD_RELOC are created for PPC and PPC64 as
   the size is a pointer, thus distinct in 32 or 64bit.

The addresses given by ld to .tdata and .tbss is a bit special. In
XCOFF, these addresses are actually offsets from the TLS pointer
computed at runtime. AIX assembly and linker does the same. In
top of that, the .tdata must be before .data (this is mandatory for AIX
loader). Thus, the aix ld script is recomputing "." before .data to restore
its original value. There might be a simpler way, but this one is working.

Optimisation linked to TLS relocations aren't yet implemented.

bfd/
	* reloc.c (BFD_RELOC_PPC_TLS_LE, BFD_RELOC_PPC_TLS_IE,
	BFD_RELOC_PPC_TLS_M, BFD_RELOC_PPC_TLS_ML, BFD_RELOC_PPC64_TLS_GD,
	BFD_RELOC_PPC64_TLS_LD, BFD_RELOC_PPC64_TLS_LE,
	BFD_RELOC_PPC64_TLS_IE, BFD_RELOC_PPC64_TLS_M,
	BFD_RELOC_PPC64_TLS_ML): New relocations.
	* bfd-in2.h: Regenerate.
	* libbfd.h: Regenerate.
	* coff-rs6000.c (xcoff_calculate_relocation): Call
	xcoff_reloc_type_tls for TLS relocations.
	(xcoff_howto_table): Implement TLS relocations.
	(_bfd_xcoff_reloc_type_lookup): Add cases TLS relocations.
	(xcoff_reloc_type_tls): New function.
	* coff64-rs6000.c (xcoff_calculate_relocation): Likewise.
	(xcoff_howto_table): Likewise.
	(_bfd_xcoff_reloc_type_lookup): Likewise.
	* coffcode.h (sec_to_styp_flags): Handle TLS sections.
	(styp_to_sec_flags): Likewise.
	(coff_compute_section_file_positions): Avoid file offset
	optimisation for .data when the previous section is .tdata.
	(coff_write_object_contents): Handle TLS sections.
	* coffswap.h (coff_swap_aouthdr_out): Add support for
	new fields in aouthdr.
	* libxcoff.h (xcoff_reloc_type_tls): Add prototype.
	* xcofflink.c (xcoff_link_add_symbols): Handle XMC_UL.
	(xcoff_need_ldrel_p): Add cases for TLS relocations.
	(xcoff_create_ldrel): Add l_symndx for TLS sections.
gas/
	* config/tc-ppc.c (ppc_xcoff_text_section, ppc_xcoff_data_section,
	(ppc_xcoff_bss_section, ppc_xcoff_tdata_section,
	(ppc_xcoff_tbss_section): New variables.
	(ppc_text_subsegment, ppc_text_csects, ppc_data_subgments,
	(ppc_data_csects): Removed.
	(ppc_xcoff_section_is_initialized, ppc_init_xcoff_section,
	ppc_xcoff_parse_cons): New functions.
	(md_being): Initialize XCOFF sections.
	(ppc_xcoff_suffix): Add support for TLS relocations
	(fixup_size, md_apply_fix): Add support for new BFD_RELOC.
	(ppc_change_csect): Handle XMC_TL, XMC_UL.  Correctly, add XMC_BS
	to .bss section.  Handle new XCOFF section variables.
	(ppc_comm): Likewise.
	(ppc_toc): Likewise.
	(ppc_symbol_new_hook): Likewise.
	(ppc_frob_symbol): Likewise.
	(ppc_fix_adjustable): Add tbss support.
	* config/tc-ppc.h (TC_PARSE_CONS_EXPRESSION): New define.
	(ppc_xcoff_parse_cons): Add prototype.
	(struct ppc_xcoff_section): New structure.
ld/
	* emultempl/aix.em: Ensure .tdata section is removed
	if empty, even with -r flag.
	* scripttempl/aix.sc: Handle TLS sections.
	* testsuite/ld-powerpc/aix52.exp: Add new tests.
	* testsuite/ld-powerpc/aix-tls-reloc-32.d: New test.
	* testsuite/ld-powerpc/aix-tls-reloc-64.d: New test.
	* testsuite/ld-powerpc/aix-tls-reloc.ex: New test.
	* testsuite/ld-powerpc/aix-tls-reloc.s: New test.
	* testsuite/ld-powerpc/aix-tls-section-32.d: New test.
	* testsuite/ld-powerpc/aix-tls-section-64.d: New test.
	* testsuite/ld-powerpc/aix-tls-section.ex: New test.
	* testsuite/ld-powerpc/aix-tls-section.s: New test.
include/
	* coff/internal.h (struct internal_aouthdr): Add new fields.
	* coff/rs6000.h (AOUTHDRÃ): Add new fields.
	* coff/rs6k64.h (struct external_filehdr): Likewise.
	* coff/xcoff.h (_TDATA), _TBSS): New defines
	(RS6K_AOUTHDR_TLS_LE, RS6K_AOUTHDR_RAS, RS6K_AOUTHDR_ALGNTDATA,
	RS6K_AOUTHDR_SHR_SYMTAB, RS6K_AOUTHDR_FORK_POLICY,
	RS6K_AOUTHDR_FORK_COR): New defines.
	(XMC_TU): Removed.
	(XMC_UL): New define.
2021-03-12 22:47:33 +10:30
..
aix.sc aix: implement TLS relocation for gas and ld 2021-03-12 22:47:33 +10:30
alpha.sc Update year range in copyright notice of binutils files 2021-01-01 10:31:05 +10:30
alphavms.sc Update year range in copyright notice of binutils files 2021-01-01 10:31:05 +10:30
aout.sc Update year range in copyright notice of binutils files 2021-01-01 10:31:05 +10:30
arclinux.sc Update year range in copyright notice of binutils files 2021-01-01 10:31:05 +10:30
avr.sc Update year range in copyright notice of binutils files 2021-01-01 10:31:05 +10:30
crisaout.sc Update year range in copyright notice of binutils files 2021-01-01 10:31:05 +10:30
dlx.sc Update year range in copyright notice of binutils files 2021-01-01 10:31:05 +10:30
DWARF.sc Add some more DWARF-5 sections 2021-01-25 11:35:57 +00:00
elf32cr16.sc Update year range in copyright notice of binutils files 2021-01-01 10:31:05 +10:30
elf32crx.sc Update year range in copyright notice of binutils files 2021-01-01 10:31:05 +10:30
elf32msp430.sc Update year range in copyright notice of binutils files 2021-01-01 10:31:05 +10:30
elf32xc16x.sc Update year range in copyright notice of binutils files 2021-01-01 10:31:05 +10:30
elf32xc16xl.sc Update year range in copyright notice of binutils files 2021-01-01 10:31:05 +10:30
elf32xc16xs.sc Update year range in copyright notice of binutils files 2021-01-01 10:31:05 +10:30
elf64bpf.sc Update year range in copyright notice of binutils files 2021-01-01 10:31:05 +10:30
elf64hppa.sc Update year range in copyright notice of binutils files 2021-01-01 10:31:05 +10:30
elf_chaos.sc Update year range in copyright notice of binutils files 2021-01-01 10:31:05 +10:30
elf.sc Update year range in copyright notice of binutils files 2021-01-01 10:31:05 +10:30
elfarc.sc arc: Enable -Ttext-segment 2020-12-01 04:27:41 -08:00
elfarcv2.sc ELF: Support .noinit and .persistent sections 2020-11-27 10:45:35 +00:00
elfd10v.sc Update year range in copyright notice of binutils files 2021-01-01 10:31:05 +10:30
elfd30v.sc Update year range in copyright notice of binutils files 2021-01-01 10:31:05 +10:30
elfm9s12z.sc Update year range in copyright notice of binutils files 2021-01-01 10:31:05 +10:30
elfm68hc11.sc Update year range in copyright notice of binutils files 2021-01-01 10:31:05 +10:30
elfm68hc12.sc Update year range in copyright notice of binutils files 2021-01-01 10:31:05 +10:30
elfmicroblaze.sc Update year range in copyright notice of binutils files 2021-01-01 10:31:05 +10:30
elfxgate.sc Update year range in copyright notice of binutils files 2021-01-01 10:31:05 +10:30
elfxtensa.sc Update year range in copyright notice of binutils files 2021-01-01 10:31:05 +10:30
epiphany_4x4.sc Update year range in copyright notice of binutils files 2021-01-01 10:31:05 +10:30
ft32.sc Add SORT_NONE to .init and .fini in scripts 2019-03-21 22:19:20 +10:30
hppaelf.sc Update year range in copyright notice of binutils files 2021-01-01 10:31:05 +10:30
i386beos.sc Update year range in copyright notice of binutils files 2021-01-01 10:31:05 +10:30
i386go32.sc Update year range in copyright notice of binutils files 2021-01-01 10:31:05 +10:30
i386msdos.sc Update year range in copyright notice of binutils files 2021-01-01 10:31:05 +10:30
ia64vms.sc Update year range in copyright notice of binutils files 2021-01-01 10:31:05 +10:30
ip2k.sc Update year range in copyright notice of binutils files 2021-01-01 10:31:05 +10:30
iq2000.sc Update year range in copyright notice of binutils files 2021-01-01 10:31:05 +10:30
mcorepe.sc bfd: strip symbols not representable in COFF/PE symbol table 2021-03-10 08:12:37 +01:00
mep.sc Update year range in copyright notice of binutils files 2021-01-01 10:31:05 +10:30
mips.sc Update year range in copyright notice of binutils files 2021-01-01 10:31:05 +10:30
mipsbsd.sc Update year range in copyright notice of binutils files 2021-01-01 10:31:05 +10:30
mmo.sc Update year range in copyright notice of binutils files 2021-01-01 10:31:05 +10:30
moxie.sc Update year range in copyright notice of binutils files 2021-01-01 10:31:05 +10:30
nds32elf.sc Update year range in copyright notice of binutils files 2021-01-01 10:31:05 +10:30
pdp11.sc PR27226, ld.bfd contains huge .rodata section 2021-01-26 20:54:43 +10:30
pe.sc Add DWARF-5 section names to PE and PEP linker scripts. 2021-03-01 16:25:06 +00:00
pep.sc Add DWARF-5 section names to PE and PEP linker scripts. 2021-03-01 16:25:06 +00:00
pj.sc Update year range in copyright notice of binutils files 2021-01-01 10:31:05 +10:30
pru.sc ELF: Support .noinit and .persistent sections 2020-11-27 10:45:35 +00:00
README Update year range in copyright notice of binutils files 2021-01-01 10:31:05 +10:30
sh.sc Update year range in copyright notice of binutils files 2021-01-01 10:31:05 +10:30
tic4xcoff.sc Update year range in copyright notice of binutils files 2021-01-01 10:31:05 +10:30
tic30coff.sc Update year range in copyright notice of binutils files 2021-01-01 10:31:05 +10:30
tic54xcoff.sc Update year range in copyright notice of binutils files 2021-01-01 10:31:05 +10:30
v850_rh850.sc Update year range in copyright notice of binutils files 2021-01-01 10:31:05 +10:30
v850.sc Update year range in copyright notice of binutils files 2021-01-01 10:31:05 +10:30
vanilla.sc Update year range in copyright notice of binutils files 2021-01-01 10:31:05 +10:30
visium.sc Update year range in copyright notice of binutils files 2021-01-01 10:31:05 +10:30
xstormy16.sc Update year range in copyright notice of binutils files 2021-01-01 10:31:05 +10:30
z80.sc Update year range in copyright notice of binutils files 2021-01-01 10:31:05 +10:30
z8000.sc 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 linker script templates.
genscripts.sh sets some shell variables, then sources
EMULATION.sc, to generate EMULATION.{x,xr,xu,xn,xbn} -- the script
files for default, -r, -Ur, -n, -N.

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.