From e86fc4a5bc3747a6b811d93648a2afa4c1c74217 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Chigot?= Date: Fri, 15 Oct 2021 16:12:39 +0200 Subject: 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. --- bfd/coff-rs6000.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'bfd/coff-rs6000.c') diff --git a/bfd/coff-rs6000.c b/bfd/coff-rs6000.c index 31d9119..1cc2162 100644 --- a/bfd/coff-rs6000.c +++ b/bfd/coff-rs6000.c @@ -489,12 +489,13 @@ _bfd_xcoff_swap_aux_in (bfd *abfd, void * ext1, int type ATTRIBUTE_UNUSED, case C_FILE: if (ext->x_file.x_n.x_fname[0] == 0) { - in->x_file.x_n.x_zeroes = 0; - in->x_file.x_n.x_offset = + in->x_file.x_n.x_n.x_zeroes = 0; + in->x_file.x_n.x_n.x_offset = H_GET_32 (abfd, ext->x_file.x_n.x_n.x_offset); } else - memcpy (in->x_file.x_fname, ext->x_file.x_n.x_fname, FILNMLEN); + memcpy (in->x_file.x_n.x_fname, ext->x_file.x_n.x_fname, FILNMLEN); + in->x_file.x_ftype = H_GET_8 (abfd, ext->x_file.x_ftype); break; /* RS/6000 "csect" auxents. @@ -573,14 +574,15 @@ _bfd_xcoff_swap_aux_out (bfd *abfd, void * inp, int type ATTRIBUTE_UNUSED, break; case C_FILE: - if (in->x_file.x_fname[0] == 0) + if (in->x_file.x_n.x_fname[0] == 0) { H_PUT_32 (abfd, 0, ext->x_file.x_n.x_n.x_zeroes); - H_PUT_32 (abfd, in->x_file.x_n.x_offset, + H_PUT_32 (abfd, in->x_file.x_n.x_n.x_offset, ext->x_file.x_n.x_n.x_offset); } else - memcpy (ext->x_file.x_n.x_fname, in->x_file.x_fname, FILNMLEN); + memcpy (ext->x_file.x_n.x_fname, in->x_file.x_n.x_fname, FILNMLEN); + H_PUT_8 (abfd, in->x_file.x_ftype, ext->x_file.x_ftype); break; /* RS/6000 "csect" auxents */ -- cgit v1.1