aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--bfd/ChangeLog8
-rw-r--r--bfd/coff-rs6000.c5
-rw-r--r--bfd/coffgen.c8
-rw-r--r--bfd/libxcoff.h2
-rw-r--r--gas/ChangeLog26
-rw-r--r--gas/config/obj-coff.c15
-rw-r--r--gas/config/obj-coff.h18
-rw-r--r--gas/config/tc-ppc.c54
-rw-r--r--gas/testsuite/gas/ppc/aix.exp5
-rw-r--r--gas/testsuite/gas/ppc/xcoff-dwsect-2-32.d18
-rw-r--r--gas/testsuite/gas/ppc/xcoff-dwsect-2-64.d18
-rw-r--r--gas/testsuite/gas/ppc/xcoff-dwsect-2.s12
-rw-r--r--gas/testsuite/gas/ppc/xcoff-function-1-32.d20
-rw-r--r--gas/testsuite/gas/ppc/xcoff-function-1-64.d20
-rw-r--r--gas/testsuite/gas/ppc/xcoff-function-1.s16
-rw-r--r--include/ChangeLog6
-rw-r--r--include/coff/internal.h1
-rw-r--r--include/coff/xcoff.h3
18 files changed, 248 insertions, 7 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index dd517a9..e0a1e23 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,3 +1,11 @@
+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
diff --git a/bfd/coff-rs6000.c b/bfd/coff-rs6000.c
index 0745421..45ba9b3 100644
--- a/bfd/coff-rs6000.c
+++ b/bfd/coff-rs6000.c
@@ -4265,7 +4265,10 @@ const struct xcoff_dwsect_name xcoff_dwsect_names[] = {
{ 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. */
diff --git a/bfd/coffgen.c b/bfd/coffgen.c
index 4e14243..b13e773 100644
--- a/bfd/coffgen.c
+++ b/bfd/coffgen.c
@@ -1527,6 +1527,8 @@ coff_pointerize_aux (bfd *abfd,
return;
if (n_sclass == C_FILE)
return;
+ if (n_sclass == C_DWARF)
+ return;
BFD_ASSERT (! auxent->is_sym);
/* Otherwise patch up. */
@@ -2123,6 +2125,12 @@ coff_print_symbol (bfd *abfd,
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 ? */
diff --git a/bfd/libxcoff.h b/bfd/libxcoff.h
index cca9c21..2eeb503 100644
--- a/bfd/libxcoff.h
+++ b/bfd/libxcoff.h
@@ -252,7 +252,7 @@ struct xcoff_dwsect_name {
/* 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
diff --git a/gas/ChangeLog b/gas/ChangeLog
index b04a764..b5c358d 100644
--- a/gas/ChangeLog
+++ b/gas/ChangeLog
@@ -1,3 +1,29 @@
+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.
diff --git a/gas/config/obj-coff.c b/gas/config/obj-coff.c
index f3cc327..f2703ff 100644
--- a/gas/config/obj-coff.c
+++ b/gas/config/obj-coff.c
@@ -1379,6 +1379,7 @@ coff_frob_symbol (symbolS *symp, int *punt)
/* 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
@@ -1483,8 +1484,18 @@ coff_adjust_section_syms (bfd *abfd ATTRIBUTE_UNUSED,
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
@@ -1754,7 +1765,11 @@ coff_frob_section (segT sec)
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
diff --git a/gas/config/obj-coff.h b/gas/config/obj-coff.h
index 917b659..73c001e 100644
--- a/gas/config/obj-coff.h
+++ b/gas/config/obj-coff.h
@@ -180,6 +180,13 @@
#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. */
@@ -294,8 +301,19 @@ extern const pseudo_typeS coff_pseudo_table[];
#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)
diff --git a/gas/config/tc-ppc.c b/gas/config/tc-ppc.c
index 7715fc5..fce2b15 100644
--- a/gas/config/tc-ppc.c
+++ b/gas/config/tc-ppc.c
@@ -5144,7 +5144,9 @@ ppc_function (int ignore ATTRIBUTE_UNUSED)
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,
@@ -5864,6 +5866,7 @@ ppc_frob_symbol (symbolS *sym)
/* 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
@@ -5903,8 +5906,9 @@ ppc_frob_symbol (symbolS *sym)
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)
{
@@ -5912,6 +5916,16 @@ ppc_frob_symbol (symbolS *sym)
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)
@@ -6126,13 +6140,43 @@ ppc_frob_symbol (symbolS *sym)
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;
diff --git a/gas/testsuite/gas/ppc/aix.exp b/gas/testsuite/gas/ppc/aix.exp
index 8e7ac67..efe27e4 100644
--- a/gas/testsuite/gas/ppc/aix.exp
+++ b/gas/testsuite/gas/ppc/aix.exp
@@ -73,4 +73,9 @@ if { [istarget "powerpc*-*-aix*"] || [istarget "rs6000-*-aix*"] } then {
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"
}
diff --git a/gas/testsuite/gas/ppc/xcoff-dwsect-2-32.d b/gas/testsuite/gas/ppc/xcoff-dwsect-2-32.d
new file mode 100644
index 0000000..cebc6d3
--- /dev/null
+++ b/gas/testsuite/gas/ppc/xcoff-dwsect-2-32.d
@@ -0,0 +1,18 @@
+#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
+.*
diff --git a/gas/testsuite/gas/ppc/xcoff-dwsect-2-64.d b/gas/testsuite/gas/ppc/xcoff-dwsect-2-64.d
new file mode 100644
index 0000000..445e707
--- /dev/null
+++ b/gas/testsuite/gas/ppc/xcoff-dwsect-2-64.d
@@ -0,0 +1,18 @@
+#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
+.*
diff --git a/gas/testsuite/gas/ppc/xcoff-dwsect-2.s b/gas/testsuite/gas/ppc/xcoff-dwsect-2.s
new file mode 100644
index 0000000..52a624f
--- /dev/null
+++ b/gas/testsuite/gas/ppc/xcoff-dwsect-2.s
@@ -0,0 +1,12 @@
+
+ .csect .text[PR]
+
+ .dwsect 0x10000,Ldwinfo_0
+ .short 2
+ .dwsect 0x90000
+Ldebug_loc:
+ .short 3
+ .dwsect 0x50000
+ .short 1
+ .short 4
+
diff --git a/gas/testsuite/gas/ppc/xcoff-function-1-32.d b/gas/testsuite/gas/ppc/xcoff-function-1-32.d
new file mode 100644
index 0000000..805a248
--- /dev/null
+++ b/gas/testsuite/gas/ppc/xcoff-function-1-32.d
@@ -0,0 +1,20 @@
+#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 .*
+
+
diff --git a/gas/testsuite/gas/ppc/xcoff-function-1-64.d b/gas/testsuite/gas/ppc/xcoff-function-1-64.d
new file mode 100644
index 0000000..431c61c
--- /dev/null
+++ b/gas/testsuite/gas/ppc/xcoff-function-1-64.d
@@ -0,0 +1,20 @@
+#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 .*
+
+
diff --git a/gas/testsuite/gas/ppc/xcoff-function-1.s b/gas/testsuite/gas/ppc/xcoff-function-1.s
new file mode 100644
index 0000000..8a63fe7
--- /dev/null
+++ b/gas/testsuite/gas/ppc/xcoff-function-1.s
@@ -0,0 +1,16 @@
+ .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:
diff --git a/include/ChangeLog b/include/ChangeLog
index 621045e..e22f3e8 100644
--- a/include/ChangeLog
+++ b/include/ChangeLog
@@ -1,3 +1,9 @@
+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
diff --git a/include/coff/internal.h b/include/coff/internal.h
index e79bf56..8d757ac 100644
--- a/include/coff/internal.h
+++ b/include/coff/internal.h
@@ -348,6 +348,7 @@ struct internal_aouthdr
#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. */
diff --git a/include/coff/xcoff.h b/include/coff/xcoff.h
index 3170542..2b61545 100644
--- a/include/coff/xcoff.h
+++ b/include/coff/xcoff.h
@@ -65,6 +65,9 @@
#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