diff options
author | Clément Chigot <clement.chigot@atos.net> | 2021-10-15 16:12:39 +0200 |
---|---|---|
committer | Alan Modra <amodra@gmail.com> | 2021-11-10 14:43:24 +1030 |
commit | e86fc4a5bc3747a6b811d93648a2afa4c1c74217 (patch) | |
tree | 00a19a31cfdddd830170cb363782279a0d39c212 /gas/config/tc-ppc.c | |
parent | f493b71179ab70d5e278234cb763eede55d44e61 (diff) | |
download | fsf-binutils-gdb-e86fc4a5bc3747a6b811d93648a2afa4c1c74217.zip fsf-binutils-gdb-e86fc4a5bc3747a6b811d93648a2afa4c1c74217.tar.gz fsf-binutils-gdb-e86fc4a5bc3747a6b811d93648a2afa4c1c74217.tar.bz2 |
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.
Diffstat (limited to 'gas/config/tc-ppc.c')
-rw-r--r-- | gas/config/tc-ppc.c | 63 |
1 files changed, 63 insertions, 0 deletions
diff --git a/gas/config/tc-ppc.c b/gas/config/tc-ppc.c index af025af..8750e37 100644 --- a/gas/config/tc-ppc.c +++ b/gas/config/tc-ppc.c @@ -107,6 +107,7 @@ static void ppc_es (int); static void ppc_csect (int); static void ppc_dwsect (int); static void ppc_change_csect (symbolS *, offsetT); +static void ppc_file (int); static void ppc_function (int); static void ppc_extern (int); static void ppc_lglobl (int); @@ -227,6 +228,7 @@ const pseudo_typeS md_pseudo_table[] = { "ei", ppc_biei, 1 }, { "es", ppc_es, 0 }, { "extern", ppc_extern, 0 }, + { "file", ppc_file, 0 }, { "function", ppc_function, 0 }, { "lglobl", ppc_lglobl, 0 }, { "ref", ppc_ref, 0 }, @@ -5073,6 +5075,67 @@ ppc_stabx (int ignore ATTRIBUTE_UNUSED) demand_empty_rest_of_line (); } +/* The .file pseudo-op. On XCOFF, .file can have several parameters + which are being added to the symbol table to provide additional + information. */ + +static void +ppc_file (int ignore ATTRIBUTE_UNUSED) +{ + char *sfname, *s1 = NULL, *s2 = NULL, *s3 = NULL; + int length, auxnb = 1; + + /* Some assemblers tolerate immediately following '"'. */ + if ((sfname = demand_copy_string (&length)) != 0) + { + coff_symbol_type *coffsym; + if (*input_line_pointer == ',') + { + ++input_line_pointer; + s1 = demand_copy_string (&length); + auxnb++; + + if (*input_line_pointer == ',') + { + ++input_line_pointer; + s2 = demand_copy_string (&length); + auxnb++; + + if (*input_line_pointer == ',') + { + ++input_line_pointer; + s3 = demand_copy_string (&length); + auxnb++; + } + } + } + + /* Use coff dot_file creation and adjust auxiliary entries. */ + c_dot_file_symbol (sfname, 0); + S_SET_NUMBER_AUXILIARY (symbol_rootP, auxnb); + coffsym = coffsymbol (symbol_get_bfdsym (symbol_rootP)); + coffsym->native[1].u.auxent.x_file.x_ftype = XFT_FN; + + if (s1) + { + coffsym->native[2].u.auxent.x_file.x_ftype = XFT_CT; + coffsym->native[2].extrap = s1; + } + if (s2) + { + coffsym->native[3].u.auxent.x_file.x_ftype = XFT_CV; + coffsym->native[3].extrap = s2; + } + if (s3) + { + coffsym->native[4].u.auxent.x_file.x_ftype = XFT_CD; + coffsym->native[4].extrap = s3; + } + + demand_empty_rest_of_line (); + } +} + /* The .function pseudo-op. This takes several arguments. The first argument seems to be the external name of the symbol. The second argument seems to be the label for the start of the function. gcc |