PR 28447: implement multiple parameters for .file on XCOFF

On XCOFF, ".file" pseudo-op allows 3 extras parameters to provide
additional information to AIX linker, or its debugger. These are
stored in auxiliary entries of the C_FILE symbol.

bfd/
	PR 28447
	* coffcode.h (combined_entry_type): Add extrap field.
	(coff_bigobj_swap_aux_in): Adjust names of x_file fields.
	(coff_bigobj_swap_aux_out): Likewise.
	* coffgen.c (coff_write_auxent_fname): New function.
	(coff_fix_symbol_name): Write x_file using
	 coff_write_auxent_fname.
	(coff_write_symbol): Likewise.
	(coff_write_symbols): Add C_FILE auxiliary entries to
	string table if needed.
	(coff_get_normalized_symtab): Adjust names of x_file fields.
	Normalize C_FILE auxiliary entries.
	(coff_print_symbol): Print C_FILE auxiliary entries.
	* coff-rs6000.c (_bfd_xcoff_swap_aux_in): Adjust names of
	x_file fields.
	(_bfd_xcoff_swap_aux_out): Likewise.
	* coff64-rs6000.c (_bfd_xcoff64_swap_aux_in): Likewise.
	(_bfd_xcoff64_swap_aux_out): Likewise.
	* cofflink.c (_bfd_coff_final_link): Likewise.
	(_bfd_coff_link_input_bfd): Likewise.
	* coffswap.h (coff_swap_aux_in): Likewise.
	* peXXigen.c (_bfd_XXi_swap_aux_in): Likewise.
	(_bfd_XXi_swap_aux_out): Likewise.
	* xcofflink.c (xcoff_link_input_bfd): Likewise.
	* libcoff.h: Regenerate.
gas/
	* config/tc-ppc.c (ppc_file): New function.
	* config/tc-ppc.h (OBJ_COFF_MAX_AUXENTRIES): Change to 4.
	* testsuite/gas/ppc/aix.exp: Add tests.
	* testsuite/gas/ppc/xcoff-file-32.d: New test.
	* testsuite/gas/ppc/xcoff-file-64.d: New test.
	* testsuite/gas/ppc/xcoff-file.s: New test.
include/
	* coff/internal.h (union internal_auxent): Change x_file to be a
	  struct instead of a union. Add x_ftype field.
	* coff/rs6000.h (union external_auxent): Add x_resv field.
	* coff/xcoff.h (XFT_FN): New define.
	(XFT_CT): Likewise.
	(XFT_CV): Likewise.
	(XFT_CD): Likewise.
This commit is contained in:
Clément Chigot
2021-10-15 16:12:39 +02:00
committed by Alan Modra
parent f493b71179
commit e86fc4a5bc
18 changed files with 273 additions and 82 deletions

View File

@@ -326,6 +326,10 @@ CODE_FRAGMENT
.
. {* Selector for the union above. *}
. bool is_sym;
.
. {* An extra pointer which can used by format based on COFF (like XCOFF)
. to provide extra information to their backend. *}
. void *extrap;
.} combined_entry_type;
.
.
@@ -5663,11 +5667,11 @@ coff_bigobj_swap_aux_in (bfd *abfd,
if (numaux > 1)
{
if (indx == 0)
memcpy (in->x_file.x_fname, ext->File.Name,
memcpy (in->x_file.x_n.x_fname, ext->File.Name,
numaux * sizeof (AUXENT_BIGOBJ));
}
else
memcpy (in->x_file.x_fname, ext->File.Name, sizeof (ext->File.Name));
memcpy (in->x_file.x_n.x_fname, ext->File.Name, sizeof (ext->File.Name));
break;
case C_STAT:
@@ -5712,7 +5716,7 @@ coff_bigobj_swap_aux_out (bfd * abfd,
switch (in_class)
{
case C_FILE:
memcpy (ext->File.Name, in->x_file.x_fname, sizeof (ext->File.Name));
memcpy (ext->File.Name, in->x_file.x_n.x_fname, sizeof (ext->File.Name));
return AUXESZ;