+2021-05-07 Clément Chigot <clement.chigot@atos.net>
+
+ * coff-rs6000.c (xcoff_dwsect_names): Add new DWARF
+ sections.
+ * coffgen.c (coff_pointerize_aux): Handle C_DWARF.
+ (coff_print_symbol): Likewise.
+ * libxcoff.h (XCOFF_DWSECT_NBR_NAMES): Update.
+
2021-05-07 Jan Beulich <jbeulich@suse.com>
* elf64-x86-64.c (x86_64_elf_howto_table): Set src_mask fields
{ SSUBTYP_DWARNGE, ".dwarnge", true },
{ SSUBTYP_DWABREV, ".dwabrev", false },
{ SSUBTYP_DWSTR, ".dwstr", true },
- { SSUBTYP_DWRNGES, ".dwrnges", true }
+ { SSUBTYP_DWRNGES, ".dwrnges", true },
+ { SSUBTYP_DWLOC, ".dwloc", true },
+ { SSUBTYP_DWFRAME, ".dwframe", true },
+ { SSUBTYP_DWMAC, ".dwmac", true }
};
/* For generic entry points. */
return;
if (n_sclass == C_FILE)
return;
+ if (n_sclass == C_DWARF)
+ return;
BFD_ASSERT (! auxent->is_sym);
/* Otherwise patch up. */
fprintf (file, "File ");
break;
+ case C_DWARF:
+ fprintf (file, "AUX scnlen 0x%lx nreloc %ld",
+ (unsigned long) auxp->u.auxent.x_sect.x_scnlen,
+ auxp->u.auxent.x_sect.x_nreloc);
+ break;
+
case C_STAT:
if (combined->u.syment.n_type == T_NULL)
/* Probably a section symbol ? */
/* Number of entries in the array. The number is known and public so that user
can 'extend' this array by index. */
-#define XCOFF_DWSECT_NBR_NAMES 8
+#define XCOFF_DWSECT_NBR_NAMES 11
/* The dwarf sections array. */
extern const struct xcoff_dwsect_name
+2021-05-07 Clément Chigot <clement.chigot@atos.net>
+
+ * config/obj-coff.c (coff_frob_symbol): Don't skip C_DWARF.
+ (coff_adjust_section_syms): Use corrext auxent for C_DWARF.
+ (coff_frob_section): Likewise.
+ * config/obj-coff.h (SA_GET_SECT_SCNLEN,
+ SA_GET_SECT_NRELOC, SA_SET_SECT_SCNLEN,
+ SA_SET_SECT_NRELOC) New defines.
+ (SET_SECTION_RELOCS): Adjust for C_DWARF.
+ * config/tc-ppc.c (ppc_frob_symbol): Don't skip C_DWARF.
+ (ppc_adjust_symtab): Reorder C_DWARF symbols.
+ * testsuite/gas/ppc/aix.exp: New tests.
+ * testsuite/gas/ppc/xcoff-dwsect-2-32.d: New test.
+ * testsuite/gas/ppc/xcoff-dwsect-2-64.d: New test.
+ * testsuite/gas/ppc/xcoff-dwsect-2.s: New test.
+
+ * config/tc-ppc.c (ppc_function): Update comment for
+ fifth argument.
+ (ppc_frob_symbol): Remove ppc_last_function check.
+ Make sure coff_last_function is reset.
+ Correctly set fsize when not provided in .function.
+ * testsuite/gas/ppc/aix.exp: New tests.
+ * testsuite/gas/ppc/xcoff-function-1-32.d: New test.
+ * testsuite/gas/ppc/xcoff-function-1-64.d: New test.
+ * testsuite/gas/ppc/xcoff-function-1.s: New test.
+
2021-05-07 Jan Beulich <jbeulich@suse.com>
* testsuite/gas/i386/rela.s, testsuite/gas/i386/rela.d: New.
/* This is pretty horrible, but we have to set *punt correctly in
order to call SA_SET_SYM_ENDNDX correctly. */
if (! symbol_used_in_reloc_p (symp)
+ && S_GET_STORAGE_CLASS (symp) != C_DWARF
&& ((symbol_get_bfdsym (symp)->flags & BSF_SECTION_SYM) != 0
|| (! (S_IS_EXTERNAL (symp) || S_IS_WEAK (symp))
&& ! symbol_get_tc (symp)->output
secsym = section_symbol (sec);
/* This is an estimate; we'll plug in the real value using
SET_SECTION_RELOCS later */
+#ifdef OBJ_XCOFF
+ if (S_GET_STORAGE_CLASS (secsym) == C_DWARF)
+ SA_SET_SECT_NRELOC (secsym, nrelocs);
+ else
+ {
+ SA_SET_SCN_NRELOC (secsym, nrelocs);
+ SA_SET_SCN_NLINNO (secsym, nlnno);
+ }
+#else
SA_SET_SCN_NRELOC (secsym, nrelocs);
SA_SET_SCN_NLINNO (secsym, nlnno);
+#endif
}
void
S_SET_STORAGE_CLASS (secsym, sclass);
S_SET_NUMBER_AUXILIARY (secsym, 1);
SF_SET_STATICS (secsym);
+#ifdef OBJ_XCOFF
+ SA_SET_SECT_SCNLEN (secsym, size);
+#else
SA_SET_SCN_SCNLEN (secsym, size);
+#endif
}
/* FIXME: These should be in a "stabs.h" file, or maybe as.h. */
#ifndef STAB_SECTION_NAME
#define SA_SET_SCN_NRELOC(s,v) (SYM_AUXENT (s)->x_scn.x_nreloc = (v))
#define SA_SET_SCN_NLINNO(s,v) (SYM_AUXENT (s)->x_scn.x_nlinno = (v))
+#ifdef OBJ_XCOFF
+#define SA_GET_SECT_SCNLEN(s) (SYM_AUXENT (s)->x_sect.x_scnlen)
+#define SA_GET_SECT_NRELOC(s) (SYM_AUXENT (s)->x_sect.x_nreloc)
+#define SA_SET_SECT_SCNLEN(s,v) (SYM_AUXENT (s)->x_sect.x_scnlen = (v))
+#define SA_SET_SECT_NRELOC(s,v) (SYM_AUXENT (s)->x_sect.x_nreloc = (v))
+#endif
+
/* Internal use only definitions. SF_ stands for symbol flags.
These values can be assigned to sy_symbol.ost_flags field of a symbolS. */
#define INIT_STAB_SECTION(seg) obj_coff_init_stab_section (seg)
/* Store the number of relocations in the section aux entry. */
+#ifdef OBJ_XCOFF
+#define SET_SECTION_RELOCS(sec, relocs, n) \
+ do { \
+ symbolS * sectSym = section_symbol (sec); \
+ if (S_GET_STORAGE_CLASS (sectSym) == C_DWARF) \
+ SA_SET_SECT_NRELOC (sectSym, n); \
+ else \
+ SA_SET_SCN_NRELOC (sectSym, n); \
+ } while (0)
+#else
#define SET_SECTION_RELOCS(sec, relocs, n) \
SA_SET_SCN_NRELOC (section_symbol (sec), n)
+#endif
#define obj_app_file(name, app) c_dot_file_symbol (name, app)
expression (& exp);
if (*input_line_pointer == ',')
{
- /* The fifth argument is the function size. */
+ /* The fifth argument is the function size.
+ If it's omitted, the size will be the containing csect.
+ This will be donce during ppc_frob_symtab. */
++input_line_pointer;
symbol_get_tc (ext_sym)->u.size
= symbol_new ("L0\001", absolute_section,
/* Discard symbols that should not be included in the output symbol
table. */
if (! symbol_used_in_reloc_p (sym)
+ && S_GET_STORAGE_CLASS (sym) != C_DWARF
&& ((symbol_get_bfdsym (sym)->flags & BSF_SECTION_SYM) != 0
|| (! (S_IS_EXTERNAL (sym) || S_IS_WEAK (sym))
&& ! symbol_get_tc (sym)->output
if (SF_GET_FUNCTION (sym))
{
- if (ppc_last_function != (symbolS *) NULL)
- as_bad (_("two .function pseudo-ops with no intervening .ef"));
+ /* Make sure coff_last_function is reset. Otherwise, we won't create
+ the auxent for the next function. */
+ coff_last_function = 0;
ppc_last_function = sym;
if (symbol_get_tc (sym)->u.size != (symbolS *) NULL)
{
SA_SET_SYM_FSIZE (sym,
(long) S_GET_VALUE (symbol_get_tc (sym)->u.size));
}
+ else
+ {
+ /* Size of containing csect. */
+ symbolS* within = symbol_get_tc (sym)->within;
+ union internal_auxent *csectaux;
+ csectaux = &coffsymbol (symbol_get_bfdsym (within))
+ ->native[S_GET_NUMBER_AUXILIARY(within)].u.auxent;
+
+ SA_SET_SYM_FSIZE (sym, csectaux->x_csect.x_scnlen.l);
+ }
}
else if (S_GET_STORAGE_CLASS (sym) == C_FCN
&& strcmp (S_GET_NAME (sym), ".ef") == 0)
return 0;
}
-/* Adjust the symbol table. This creates csect symbols for all
- absolute symbols. */
+/* Adjust the symbol table. */
void
ppc_adjust_symtab (void)
{
symbolS *sym;
+ symbolS *anchorSym;
+
+ /* Make sure C_DWARF symbols come right after C_FILE.
+ As the C_FILE might not be defined yet and as C_DWARF
+ might already be ordered, we insert them before the
+ first symbol which isn't a C_FILE or a C_DWARF. */
+ for (anchorSym = symbol_rootP; anchorSym != NULL;
+ anchorSym = symbol_next (anchorSym))
+ {
+ if (S_GET_STORAGE_CLASS (anchorSym) != C_FILE
+ && S_GET_STORAGE_CLASS (anchorSym) != C_DWARF)
+ break;
+ }
+
+ sym = anchorSym;
+ while (sym != NULL)
+ {
+ if (S_GET_STORAGE_CLASS (sym) != C_DWARF)
+ {
+ sym = symbol_next (sym);
+ continue;
+ }
+
+ symbolS* tsym = sym;
+ sym = symbol_next (sym);
+
+ symbol_remove (tsym, &symbol_rootP, &symbol_lastP);
+ symbol_insert (tsym, anchorSym, &symbol_rootP, &symbol_lastP);
+ }
+
+ /* Create csect symbols for all absolute symbols. */
if (! ppc_saw_abs)
return;
run_dump_test "xcoff-dwsect-1-32"
run_dump_test "xcoff-dwsect-1-64"
+ run_dump_test "xcoff-dwsect-2-32"
+ run_dump_test "xcoff-dwsect-2-64"
+
+ run_dump_test "xcoff-function-1-32"
+ run_dump_test "xcoff-function-1-64"
}
--- /dev/null
+#as: -a32
+#source: xcoff-dwsect-2.s
+#objdump: -t
+#name: XCOFF dwsect test 2 (32-bit)
+
+.*
+
+SYMBOL TABLE:
+.*\(scl 103\).*
+File .*
+.*\(scl 112\).* .dwinfo
+AUX .*
+.*\(scl 112\).* .dwloc
+AUX .*
+.*\(scl 112\).* .dwarnge
+AUX .*
+.*\(scl 107\).* .text
+.*
--- /dev/null
+#as: -a64
+#source: xcoff-dwsect-2.s
+#objdump: -t
+#name: XCOFF dwsect test 2 (64-bit)
+
+.*
+
+SYMBOL TABLE:
+.*\(scl 103\).*
+File .*
+.*\(scl 112\).* .dwinfo
+AUX .*
+.*\(scl 112\).* .dwloc
+AUX .*
+.*\(scl 112\).* .dwarnge
+AUX .*
+.*\(scl 107\).* .text
+.*
--- /dev/null
+
+ .csect .text[PR]
+
+ .dwsect 0x10000,Ldwinfo_0
+ .short 2
+ .dwsect 0x90000
+Ldebug_loc:
+ .short 3
+ .dwsect 0x50000
+ .short 1
+ .short 4
+
--- /dev/null
+#as: -a32
+#source: xcoff-function-1.s
+#objdump: -t
+#name: XCOFF function test 1 (32-bit)
+
+.*
+
+SYMBOL TABLE:
+.*
+.*
+\[ 2\].* .text
+AUX val 8 .*
+\[ 4\].* .foo
+AUX .* ttlsiz 0x8 .*
+AUX .* typ 2 .* clss 0 .*
+\[ 7\].* .bar
+AUX .* ttlsiz 0x4 .*
+AUX .* typ 2 .* clss 0 .*
+
+
--- /dev/null
+#as: -a64
+#source: xcoff-function-1.s
+#objdump: -t
+#name: XCOFF function test 1 (64-bit)
+
+.*
+
+SYMBOL TABLE:
+.*
+.*
+\[ 2\].* .text
+AUX val 8 .*
+\[ 4\].* .foo
+AUX .* ttlsiz 0x8 .*
+AUX .* typ 2 .* clss 0 .*
+\[ 7\].* .bar
+AUX .* ttlsiz 0x4 .*
+AUX .* typ 2 .* clss 0 .*
+
+
--- /dev/null
+ .csect .text[PR]
+
+ # .function without 5th argument means
+ # that the size is the size of the csect.
+ .globl .foo
+.foo:
+ .function .foo,.foo,2,0
+ blr
+
+ # .function without 5th argument means
+ # that the size is the size given.
+ .globl .bar
+.bar:
+ .function .bar,.bar,2,0, E..bar-.bar
+ blr
+E..bar:
+2021-05-07 Clément Chigot <clement.chigot@atos.net>
+
+ * coff/internal.h (C_DWARF): New define.
+ * coff/xcoff.h (SSUBTYP_DWLOC, SSUBTYP_DWFRAME,
+ SSUBTYP_DWMAC): New defines.
+
2021-05-06 Stafford Horne <shorne@gmail.com>
PR 21464
#define C_BINCL 108 /* Marks beginning of include file */
#define C_EINCL 109 /* Marks ending of include file */
#define C_AIX_WEAKEXT 111 /* AIX definition of C_WEAKEXT. */
+#define C_DWARF 112 /* DWARF symbol */
#define C_NULL_VALUE 0x00de1e00 /* Value for a C_NULL deleted entry. */
#define SSUBTYP_DWABREV 0x60000
#define SSUBTYP_DWSTR 0x70000
#define SSUBTYP_DWRNGES 0x80000
+#define SSUBTYP_DWLOC 0x90000
+#define SSUBTYP_DWFRAME 0xA0000
+#define SSUBTYP_DWMAC 0xB0000
/* XCOFF uses a special .loader section with type STYP_LOADER. */
#define STYP_LOADER 0x1000