aboutsummaryrefslogtreecommitdiff
path: root/ld
diff options
context:
space:
mode:
Diffstat (limited to 'ld')
-rw-r--r--ld/ChangeLog34
-rw-r--r--ld/emultempl/elf32.em57
-rw-r--r--ld/ldlang.c233
-rw-r--r--ld/testsuite/ld-elf/pr21562a.d12
-rw-r--r--ld/testsuite/ld-elf/pr21562b.d12
-rw-r--r--ld/testsuite/ld-elf/pr21562c.d12
-rw-r--r--ld/testsuite/ld-elf/pr21562d.d12
-rw-r--r--ld/testsuite/ld-elf/pr21562e.d8
-rw-r--r--ld/testsuite/ld-elf/pr21562f.d8
-rw-r--r--ld/testsuite/ld-elf/pr21562g.d8
-rw-r--r--ld/testsuite/ld-elf/pr21562h.d8
-rw-r--r--ld/testsuite/ld-elf/pr21562i.d12
-rw-r--r--ld/testsuite/ld-elf/pr21562j.d12
-rw-r--r--ld/testsuite/ld-elf/pr21562k.d12
-rw-r--r--ld/testsuite/ld-elf/pr21562l.d12
-rw-r--r--ld/testsuite/ld-elf/pr21562m.d12
-rw-r--r--ld/testsuite/ld-elf/pr21562n.d12
-rw-r--r--ld/testsuite/ld-elf/sizeofa.d11
-rw-r--r--ld/testsuite/ld-elf/sizeofb.d10
-rw-r--r--ld/testsuite/ld-elf/startofa.d13
-rw-r--r--ld/testsuite/ld-elf/startofb.d10
21 files changed, 296 insertions, 224 deletions
diff --git a/ld/ChangeLog b/ld/ChangeLog
index 751699d..583a936 100644
--- a/ld/ChangeLog
+++ b/ld/ChangeLog
@@ -1,3 +1,37 @@
+2017-06-16 Alan Modra <amodra@gmail.com>
+
+ PR ld/20022
+ PR ld/21557
+ PR ld/21562
+ PR ld/21571
+ * emultempl/elf32.em (gld${EMULATION_NAME}_after_open): Don't set
+ __start/__stop syms here.
+ * ldlang.c (lang_set_startof): Delete.
+ (start_stop_syms, start_stop_count, start_stop_alloc): New vars.
+ (lang_define_start_stop, lang_init_start_stop, foreach_start_stop,
+ undef_start_stop, lang_undef_start_stop, lang_init_startof_sizeof,
+ set_start_stop, lang_finalize_start_stop): New functions.
+ (lang_process): Call _start_stop functions.
+ * testsuite/ld-elf/pr21562a.d: Use xfail rather than notarget.
+ Correct typos and list of xfail targets.
+ * testsuite/ld-elf/pr21562b.d: Likewise.
+ * testsuite/ld-elf/pr21562c.d: Likewise.
+ * testsuite/ld-elf/pr21562d.d: Likewise.
+ * testsuite/ld-elf/pr21562e.d: Likewise.
+ * testsuite/ld-elf/pr21562f.d: Likewise.
+ * testsuite/ld-elf/pr21562g.d: Likewise.
+ * testsuite/ld-elf/pr21562h.d: Likewise.
+ * testsuite/ld-elf/pr21562i.d: Likewise.
+ * testsuite/ld-elf/pr21562j.d: Likewise.
+ * testsuite/ld-elf/pr21562k.d: Likewise.
+ * testsuite/ld-elf/pr21562l.d: Likewise.
+ * testsuite/ld-elf/pr21562m.d: Likewise.
+ * testsuite/ld-elf/pr21562n.d: Likewise.
+ * testsuite/ld-elf/sizeofa.d: Likewise. Adjust to pass for generic ELF.
+ * testsuite/ld-elf/sizeofb.d: Likewise.
+ * testsuite/ld-elf/startofa.d: Likewise.
+ * testsuite/ld-elf/startofb.d: Likewise.
+
2017-06-16 Jiong Wang <jiong.wang@arm.com>
* testsuite/ld-aarch64/aarch64-elf.exp: Update test name
diff --git a/ld/emultempl/elf32.em b/ld/emultempl/elf32.em
index 9468f7d..325d847 100644
--- a/ld/emultempl/elf32.em
+++ b/ld/emultempl/elf32.em
@@ -1218,7 +1218,6 @@ gld${EMULATION_NAME}_after_open (void)
struct elf_link_hash_table *htab;
asection *s;
bfd *abfd;
- char leading_char;
after_open_default ();
@@ -1277,62 +1276,6 @@ gld${EMULATION_NAME}_after_open (void)
return;
}
- leading_char = bfd_get_symbol_leading_char (link_info.output_bfd);
-
- /* Check for input sections whose names match references to
- __start_SECNAME or __stop_SECNAME symbols. Mark the matched
- symbols as hidden and set start_stop for garbage collection. */
- for (abfd = link_info.input_bfds; abfd; abfd = abfd->link.next)
- for (s = abfd->sections; s; s = s->next)
- {
- const char *name = bfd_get_section_name (abfd, s);
- const char *ps;
-
- for (ps = name; *ps != '\0'; ps++)
- if (!ISALNUM ((unsigned char) *ps) && *ps != '_')
- break;
- if (*ps == '\0')
- {
- struct elf_link_hash_entry *h;
- char *symbol = (char *) xmalloc (ps - name
- + sizeof "__start_" + 1);
-
- symbol[0] = leading_char;
- sprintf (symbol + (leading_char != 0), "__start_%s", name);
- h = elf_link_hash_lookup (elf_hash_table (&link_info),
- symbol, FALSE, FALSE, TRUE);
- if (h != NULL
- && (h->root.type == bfd_link_hash_undefined
- || h->root.type == bfd_link_hash_undefweak)
- && h->u2.start_stop_section == NULL)
- {
- h->start_stop = 1;
- h->u2.start_stop_section = s;
- _bfd_elf_link_hash_hide_symbol (&link_info, h, TRUE);
- if (ELF_ST_VISIBILITY (h->other) != STV_INTERNAL)
- h->other = ((h->other & ~ELF_ST_VISIBILITY (-1))
- | STV_HIDDEN);
- }
-
- symbol[0] = leading_char;
- sprintf (symbol + (leading_char != 0), "__stop_%s", name);
- h = elf_link_hash_lookup (elf_hash_table (&link_info),
- symbol, FALSE, FALSE, TRUE);
- if (h != NULL
- && (h->root.type == bfd_link_hash_undefined
- || h->root.type == bfd_link_hash_undefweak)
- && h->u2.start_stop_section == NULL)
- {
- h->start_stop = 1;
- h->u2.start_stop_section = s;
- _bfd_elf_link_hash_hide_symbol (&link_info, h, TRUE);
- if (ELF_ST_VISIBILITY (h->other) != STV_INTERNAL)
- h->other = ((h->other & ~ELF_ST_VISIBILITY (-1))
- | STV_HIDDEN);
- }
- }
- }
-
if (!link_info.traditional_format)
{
bfd *elfbfd = NULL;
diff --git a/ld/ldlang.c b/ld/ldlang.c
index eb4ba9e..726bc8e 100644
--- a/ld/ldlang.c
+++ b/ld/ldlang.c
@@ -5878,98 +5878,174 @@ section_for_dot (void)
return bfd_abs_section_ptr;
}
-/* Fix any .startof., .sizeof., __start or __stop symbols. When the
- assemblers see the operator .startof. (section_name), it produces
- an undefined symbol .startof.section_name. Similarly, when it sees
- .sizeof. (section_name), it produces an undefined symbol
- .sizeof.section_name. Also for ELF linker, __start_XXX or __stop_XXX
- symbols should be resolved to the start and end of section XXX. For
- all the output sections, we look for such symbols, and set them to
- the correct value. */
+/* Array of __start/__stop/.startof./.sizeof/ symbols. */
+
+static struct bfd_link_hash_entry **start_stop_syms;
+static size_t start_stop_count = 0;
+static size_t start_stop_alloc = 0;
+
+/* Give start/stop SYMBOL for SEC a preliminary definition, and add it
+ to start_stop_syms. */
+
+static void
+lang_define_start_stop (const char *symbol, asection *sec)
+{
+ struct bfd_link_hash_entry *h;
+
+ h = bfd_define_start_stop (link_info.output_bfd, &link_info, symbol, sec);
+ if (h != NULL)
+ {
+ if (start_stop_count == start_stop_alloc)
+ {
+ start_stop_alloc = 2 * start_stop_alloc + 10;
+ start_stop_syms
+ = xrealloc (start_stop_syms,
+ start_stop_alloc * sizeof (*start_stop_syms));
+ }
+ start_stop_syms[start_stop_count++] = h;
+ }
+}
+
+/* Check for input sections whose names match references to
+ __start_SECNAME or __stop_SECNAME symbols. Give the symbols
+ preliminary definitions. */
static void
-lang_set_startof (void)
+lang_init_start_stop (void)
{
+ bfd *abfd;
asection *s;
- char leading_char;
- bfd_boolean is_elf;
- bfd_boolean is_relocatable;
+ char leading_char = bfd_get_symbol_leading_char (link_info.output_bfd);
+
+ for (abfd = link_info.input_bfds; abfd != NULL; abfd = abfd->link.next)
+ for (s = abfd->sections; s != NULL; s = s->next)
+ {
+ const char *ps;
+ const char *secname = s->name;
+
+ for (ps = secname; *ps != '\0'; ps++)
+ if (!ISALNUM ((unsigned char) *ps) && *ps != '_')
+ break;
+ if (*ps == '\0')
+ {
+ char *symbol = (char *) xmalloc (10 + strlen (secname));
- if (!config.build_constructors)
+ symbol[0] = leading_char;
+ sprintf (symbol + (leading_char != 0), "__start_%s", secname);
+ lang_define_start_stop (symbol, s);
+
+ symbol[1] = leading_char;
+ memcpy (symbol + 1 + (leading_char != 0), "__stop", 6);
+ lang_define_start_stop (symbol + 1, s);
+
+ free (symbol);
+ }
+ }
+}
+
+/* Iterate over start_stop_syms. */
+
+static void
+foreach_start_stop (void (*func) (struct bfd_link_hash_entry *))
+{
+ size_t i;
+
+ for (i = 0; i < start_stop_count; ++i)
+ func (start_stop_syms[i]);
+}
+
+/* __start and __stop symbols are only supposed to be defined by the
+ linker for orphan sections, but we now extend that to sections that
+ map to an output section of the same name. The symbols were
+ defined early for --gc-sections, before we mapped input to output
+ sections, so undo those that don't satisfy this rule. */
+
+static void
+undef_start_stop (struct bfd_link_hash_entry *h)
+{
+ if (h->ldscript_def)
return;
- is_elf = (bfd_get_flavour (link_info.output_bfd)
- == bfd_target_elf_flavour);
- is_relocatable = bfd_link_relocatable (&link_info);
+ if (h->u.def.section->output_section == NULL
+ || h->u.def.section->output_section->owner != link_info.output_bfd
+ || strcmp (h->u.def.section->name,
+ h->u.def.section->output_section->name) != 0)
+ {
+ h->type = bfd_link_hash_undefined;
+ h->u.undef.abfd = NULL;
+ }
+}
+
+static void
+lang_undef_start_stop (void)
+{
+ foreach_start_stop (undef_start_stop);
+}
+
+/* Check for output sections whose names match references to
+ .startof.SECNAME or .sizeof.SECNAME symbols. Give the symbols
+ preliminary definitions. */
- leading_char = bfd_get_symbol_leading_char (link_info.output_bfd);
+static void
+lang_init_startof_sizeof (void)
+{
+ asection *s;
for (s = link_info.output_bfd->sections; s != NULL; s = s->next)
{
- const char *secname;
- char *buf;
- struct bfd_link_hash_entry *h;
+ const char *secname = s->name;
+ char *symbol = (char *) xmalloc (10 + strlen (secname));
- secname = bfd_get_section_name (link_info.output_bfd, s);
- buf = (char *) xmalloc (10 + strlen (secname));
+ sprintf (symbol, ".startof.%s", secname);
+ lang_define_start_stop (symbol, s);
- if (!is_relocatable)
- {
- sprintf (buf, ".startof.%s", secname);
- h = bfd_link_hash_lookup (link_info.hash, buf, FALSE, FALSE,
- TRUE);
- if (h != NULL && h->type == bfd_link_hash_undefined)
- {
- h->type = bfd_link_hash_defined;
- h->u.def.value = 0;
- h->u.def.section = s;
- }
+ memcpy (symbol + 1, ".size", 5);
+ lang_define_start_stop (symbol + 1, s);
+ free (symbol);
+ }
+}
- sprintf (buf, ".sizeof.%s", secname);
- h = bfd_link_hash_lookup (link_info.hash, buf, FALSE, FALSE,
- TRUE);
- if (h != NULL && h->type == bfd_link_hash_undefined)
- {
- h->type = bfd_link_hash_defined;
- h->u.def.value = TO_ADDR (s->size);
- h->u.def.section = bfd_abs_section_ptr;
- }
- }
+/* Set .startof., .sizeof., __start and __stop symbols final values. */
- buf[0] = leading_char;
- sprintf (buf + (buf[0] != 0), "__start_%s", secname);
- h = bfd_link_hash_lookup (link_info.hash, buf, FALSE, FALSE,
- TRUE);
- if (h != NULL
- && (h->type == bfd_link_hash_undefined
- || h->type == bfd_link_hash_undefweak))
+static void
+set_start_stop (struct bfd_link_hash_entry *h)
+{
+ if (h->ldscript_def
+ || h->type != bfd_link_hash_defined)
+ return;
+
+ if (h->root.string[0] == '.')
+ {
+ /* .startof. or .sizeof. symbol.
+ .startof. already has final value. */
+ if (h->root.string[2] == 'i')
{
- h->type = bfd_link_hash_defined;
- h->u.def.value = 0;
- h->u.def.section = s;
- if (is_elf)
- ((struct elf_link_hash_entry *) h)->def_regular = 1;
+ /* .sizeof. */
+ h->u.def.value = TO_ADDR (h->u.def.section->size);
+ h->u.def.section = bfd_abs_section_ptr;
}
+ }
+ else
+ {
+ /* __start or __stop symbol. */
+ int has_lead = bfd_get_symbol_leading_char (link_info.output_bfd) != 0;
- buf[0] = leading_char;
- sprintf (buf + (buf[0] != 0), "__stop_%s", secname);
- h = bfd_link_hash_lookup (link_info.hash, buf, FALSE, FALSE,
- TRUE);
- if (h != NULL
- && (h->type == bfd_link_hash_undefined
- || h->type == bfd_link_hash_undefweak))
+ h->u.def.section = h->u.def.section->output_section;
+ if (h->root.string[4 + has_lead] == 'o')
{
- h->type = bfd_link_hash_defined;
- h->u.def.value = TO_ADDR (s->size);
- h->u.def.section = s;
- if (is_elf)
- ((struct elf_link_hash_entry *) h)->def_regular = 1;
+ /* __stop_ */
+ h->u.def.value = TO_ADDR (h->u.def.section->size);
}
- free (buf);
}
}
static void
+lang_finalize_start_stop (void)
+{
+ foreach_start_stop (set_start_stop);
+}
+
+static void
lang_end (void)
{
struct bfd_link_hash_entry *h;
@@ -7035,6 +7111,12 @@ lang_process (void)
files. */
ldctor_build_sets ();
+ /* Give initial values for __start and __stop symbols, so that ELF
+ gc_sections will keep sections referenced by these symbols. Must
+ be done before lang_do_assignments below. */
+ if (config.build_constructors)
+ lang_init_start_stop ();
+
/* PR 13683: We must rerun the assignments prior to running garbage
collection in order to make sure that all symbol aliases are resolved. */
lang_do_assignments (lang_mark_phase_enum);
@@ -7089,6 +7171,17 @@ lang_process (void)
/* Copy forward lma regions for output sections in same lma region. */
lang_propagate_lma_regions ();
+ /* Defining __start/__stop symbols early for --gc-sections to work
+ around a glibc build problem can result in these symbols being
+ defined when they should not be. Fix them now. */
+ if (config.build_constructors)
+ lang_undef_start_stop ();
+
+ /* Define .startof./.sizeof. symbols with preliminary values before
+ dynamic symbols are created. */
+ if (!bfd_link_relocatable (&link_info))
+ lang_init_startof_sizeof ();
+
/* Do anything special before sizing sections. This is where ELF
and other back-ends size dynamic sections. */
ldemul_before_allocation ();
@@ -7108,8 +7201,8 @@ lang_process (void)
everything is. This is where relaxation is done. */
ldemul_after_allocation ();
- /* Fix any .startof. or .sizeof. symbols. */
- lang_set_startof ();
+ /* Fix any __start, __stop, .startof. or .sizeof. symbols. */
+ lang_finalize_start_stop ();
/* Do all the assignments, now that we know the final resting places
of all the symbols. */
diff --git a/ld/testsuite/ld-elf/pr21562a.d b/ld/testsuite/ld-elf/pr21562a.d
index 3b0dc65..1f57569 100644
--- a/ld/testsuite/ld-elf/pr21562a.d
+++ b/ld/testsuite/ld-elf/pr21562a.d
@@ -1,12 +1,12 @@
#ld: -shared -z defs --gc-sections
#readelf: -s -S --wide
#target: *-*-linux* *-*-gnu*
-#notarget: d30v-*-* dlx-*-* i960-*-* pj*-*-*
-#notarget: hppa64-*-* i370-*-* i860-*-* ia64-*-* mep-*-* mn10200-*-*
-#notarget: bfin-*-* cr16-*-* cr16c-*-* cris*-*-* crx-*-* epiphany-*-*
-#notarget: h8300-*-* ip2k-*-* m10200-*-* m10300-*-* m32c-*-* metag-*-*
-#notarget: metag-*-* rl78-*-* rx-*-* sh*-*-* v850*-*-*
-# Targets with a leading char will faill this test.
+#xfail: d30v-*-* dlx-*-* i960-*-* pj*-*-*
+#xfail: hppa64-*-* i370-*-* i860-*-* ia64-*-* mep-*-* mn10200-*-*
+#xfail: bfin-*-* cr16-*-* cr16c-*-* crx-*-* epiphany-*-*
+#xfail: h8300-*-* ip2k-*-* mn10200-*-* mn10300-*-* m32c-*-* metag-*-*
+#xfail: rl78-*-* rx-*-* v850*-*-*
+# Targets with a leading char will fail this test.
# generic linker targets don't support --gc-sections, nor do a bunch of others
#...
diff --git a/ld/testsuite/ld-elf/pr21562b.d b/ld/testsuite/ld-elf/pr21562b.d
index af82bb8..dd28b66 100644
--- a/ld/testsuite/ld-elf/pr21562b.d
+++ b/ld/testsuite/ld-elf/pr21562b.d
@@ -1,12 +1,12 @@
#ld: -shared -z defs --gc-sections
#readelf: -s -S --wide
#target: *-*-linux* *-*-gnu*
-#notarget: d30v-*-* dlx-*-* i960-*-* pj*-*-*
-#notarget: hppa64-*-* i370-*-* i860-*-* ia64-*-* mep-*-* mn10200-*-*
-#notarget: bfin-*-* cr16-*-* cr16c-*-* cris*-*-* crx-*-* epiphany-*-*
-#notarget: h8300-*-* ip2k-*-* m10200-*-* m10300-*-* m32c-*-* metag-*-*
-#notarget: metag-*-* rl78-*-* rx-*-* sh*-*-* v850*-*-*
-# Targets with a leading char will faill this test.
+#xfail: d30v-*-* dlx-*-* i960-*-* pj*-*-*
+#xfail: hppa64-*-* i370-*-* i860-*-* ia64-*-* mep-*-* mn10200-*-*
+#xfail: bfin-*-* cr16-*-* cr16c-*-* crx-*-* epiphany-*-*
+#xfail: h8300-*-* ip2k-*-* mn10200-*-* mn10300-*-* m32c-*-* metag-*-*
+#xfail: rl78-*-* rx-*-* v850*-*-*
+# Targets with a leading char will fail this test.
# generic linker targets don't support --gc-sections, nor do a bunch of others
#...
diff --git a/ld/testsuite/ld-elf/pr21562c.d b/ld/testsuite/ld-elf/pr21562c.d
index 0fcc25a..69eb6aa 100644
--- a/ld/testsuite/ld-elf/pr21562c.d
+++ b/ld/testsuite/ld-elf/pr21562c.d
@@ -2,12 +2,12 @@
#ld: -shared -z defs --gc-sections -T pr21562a.t
#readelf: -s -S --wide
#target: *-*-linux* *-*-gnu*
-#notarget: d30v-*-* dlx-*-* i960-*-* pj*-*-*
-#notarget: hppa64-*-* i370-*-* i860-*-* ia64-*-* mep-*-* mn10200-*-*
-#notarget: bfin-*-* cr16-*-* cr16c-*-* cris*-*-* crx-*-* epiphany-*-*
-#notarget: h8300-*-* ip2k-*-* m10200-*-* m10300-*-* m32c-*-* metag-*-*
-#notarget: metag-*-* rl78-*-* rx-*-* sh*-*-* v850*-*-*
-# Targets with a leading char will faill this test.
+#xfail: d30v-*-* dlx-*-* i960-*-* pj*-*-*
+#xfail: hppa64-*-* i370-*-* i860-*-* ia64-*-* mep-*-* mn10200-*-*
+#xfail: bfin-*-* cr16-*-* cr16c-*-* crx-*-* epiphany-*-*
+#xfail: h8300-*-* ip2k-*-* mn10200-*-* mn10300-*-* m32c-*-* metag-*-*
+#xfail: rl78-*-* rx-*-* v850*-*-*
+# Targets with a leading char will fail this test.
# generic linker targets don't support --gc-sections, nor do a bunch of others
#...
diff --git a/ld/testsuite/ld-elf/pr21562d.d b/ld/testsuite/ld-elf/pr21562d.d
index b966b80..7e13821 100644
--- a/ld/testsuite/ld-elf/pr21562d.d
+++ b/ld/testsuite/ld-elf/pr21562d.d
@@ -2,12 +2,12 @@
#ld: -shared -z defs --gc-sections -T pr21562a.t
#readelf: -s -S --wide
#target: *-*-linux* *-*-gnu*
-#notarget: d30v-*-* dlx-*-* i960-*-* pj*-*-*
-#notarget: hppa64-*-* i370-*-* i860-*-* ia64-*-* mep-*-* mn10200-*-*
-#notarget: bfin-*-* cr16-*-* cr16c-*-* cris*-*-* crx-*-* epiphany-*-*
-#notarget: h8300-*-* ip2k-*-* m10200-*-* m10300-*-* m32c-*-* metag-*-*
-#notarget: metag-*-* rl78-*-* rx-*-* sh*-*-* v850*-*-*
-# Targets with a leading char will faill this test.
+#xfail: d30v-*-* dlx-*-* i960-*-* pj*-*-*
+#xfail: hppa64-*-* i370-*-* i860-*-* ia64-*-* mep-*-* mn10200-*-*
+#xfail: bfin-*-* cr16-*-* cr16c-*-* crx-*-* epiphany-*-*
+#xfail: h8300-*-* ip2k-*-* mn10200-*-* mn10300-*-* m32c-*-* metag-*-*
+#xfail: rl78-*-* rx-*-* v850*-*-*
+# Targets with a leading char will fail this test.
# generic linker targets don't support --gc-sections, nor do a bunch of others
#...
diff --git a/ld/testsuite/ld-elf/pr21562e.d b/ld/testsuite/ld-elf/pr21562e.d
index 6f73c7b..0172a06 100644
--- a/ld/testsuite/ld-elf/pr21562e.d
+++ b/ld/testsuite/ld-elf/pr21562e.d
@@ -2,10 +2,10 @@
#ld: -shared -z defs
#readelf: -s -S --wide
#target: *-*-linux* *-*-gnu*
-#notarget: bfin-*-* cr16-*-* cr16c-*-* cris*-*-* crx-*-* epiphany-*-*
-#notarget: h8300-*-* ip2k-*-* m10200-*-* m10300-*-* m32c-*-* metag-*-*
-#notarget: metag-*-* rl78-*-* rx-*-* sh*-*-* v850*-*-*
-# Targets with a leading char will faill this test.
+#xfail: bfin-*-* cr16-*-* cr16c-*-* crx-*-* epiphany-*-*
+#xfail: h8300-*-* ip2k-*-* mn10200-*-* mn10300-*-* m32c-*-* metag-*-*
+#xfail: rl78-*-* rx-*-* v850*-*-*
+# Targets with a leading char will fail this test.
#...
\[[ 0-9]+\] scnfoo[ \t]+PROGBITS[ \t]+[0-9a-f]+ +[0-9a-f]+ +0*10[ \t]+.*
diff --git a/ld/testsuite/ld-elf/pr21562f.d b/ld/testsuite/ld-elf/pr21562f.d
index 244f917..a0f1a24 100644
--- a/ld/testsuite/ld-elf/pr21562f.d
+++ b/ld/testsuite/ld-elf/pr21562f.d
@@ -2,10 +2,10 @@
#ld: -shared -z defs
#readelf: -s -S --wide
#target: *-*-linux* *-*-gnu*
-#notarget: bfin-*-* cr16-*-* cr16c-*-* cris*-*-* crx-*-* epiphany-*-*
-#notarget: h8300-*-* ip2k-*-* m10200-*-* m10300-*-* m32c-*-* metag-*-*
-#notarget: metag-*-* rl78-*-* rx-*-* sh*-*-* v850*-*-*
-# Targets with a leading char will faill this test.
+#xfail: bfin-*-* cr16-*-* cr16c-*-* crx-*-* epiphany-*-*
+#xfail: h8300-*-* ip2k-*-* mn10200-*-* mn10300-*-* m32c-*-* metag-*-*
+#xfail: rl78-*-* rx-*-* v850*-*-*
+# Targets with a leading char will fail this test.
#...
\[[ 0-9]+\] scnfoo[ \t]+PROGBITS[ \t]+[0-9a-f]+ +[0-9a-f]+ +0*10[ \t]+.*
diff --git a/ld/testsuite/ld-elf/pr21562g.d b/ld/testsuite/ld-elf/pr21562g.d
index 411e1e3..289ab75 100644
--- a/ld/testsuite/ld-elf/pr21562g.d
+++ b/ld/testsuite/ld-elf/pr21562g.d
@@ -2,10 +2,10 @@
#ld: -shared -z defs -T pr21562a.t
#readelf: -s -S --wide
#target: *-*-linux* *-*-gnu*
-#notarget: bfin-*-* cr16-*-* cr16c-*-* cris*-*-* crx-*-* epiphany-*-*
-#notarget: h8300-*-* ip2k-*-* m10200-*-* m10300-*-* m32c-*-* metag-*-*
-#notarget: metag-*-* rl78-*-* rx-*-* sh*-*-* v850*-*-*
-# Targets with a leading char will faill this test.
+#xfail: bfin-*-* cr16-*-* cr16c-*-* crx-*-* epiphany-*-*
+#xfail: h8300-*-* ip2k-*-* mn10200-*-* mn10300-*-* m32c-*-* metag-*-*
+#xfail: rl78-*-* rx-*-* v850*-*-*
+# Targets with a leading char will fail this test.
#...
\[[ 0-9]+\] scnfoo[ \t]+PROGBITS[ \t]+[0-9a-f]+ +[0-9a-f]+ +0*10[ \t]+.*
diff --git a/ld/testsuite/ld-elf/pr21562h.d b/ld/testsuite/ld-elf/pr21562h.d
index dc4b72a..c94e636 100644
--- a/ld/testsuite/ld-elf/pr21562h.d
+++ b/ld/testsuite/ld-elf/pr21562h.d
@@ -2,10 +2,10 @@
#ld: -shared -z defs -T pr21562a.t
#readelf: -s -S --wide
#target: *-*-linux* *-*-gnu*
-#notarget: bfin-*-* cr16-*-* cr16c-*-* cris*-*-* crx-*-* epiphany-*-*
-#notarget: h8300-*-* ip2k-*-* m10200-*-* m10300-*-* m32c-*-* metag-*-*
-#notarget: metag-*-* rl78-*-* rx-*-* sh*-*-* v850*-*-*
-# Targets with a leading char will faill this test.
+#xfail: bfin-*-* cr16-*-* cr16c-*-* crx-*-* epiphany-*-*
+#xfail: h8300-*-* ip2k-*-* mn10200-*-* mn10300-*-* m32c-*-* metag-*-*
+#xfail: rl78-*-* rx-*-* v850*-*-*
+# Targets with a leading char will fail this test.
#...
\[[ 0-9]+\] scnfoo[ \t]+PROGBITS[ \t]+[0-9a-f]+ +[0-9a-f]+ +0*10[ \t]+.*
diff --git a/ld/testsuite/ld-elf/pr21562i.d b/ld/testsuite/ld-elf/pr21562i.d
index 47b9cad..2670f60 100644
--- a/ld/testsuite/ld-elf/pr21562i.d
+++ b/ld/testsuite/ld-elf/pr21562i.d
@@ -2,12 +2,12 @@
#ld: -shared -z defs --gc-sections -T pr21562b.t
#readelf: -s -S --wide
#target: *-*-linux* *-*-gnu*
-#notarget: d30v-*-* dlx-*-* i960-*-* pj*-*-*
-#notarget: hppa64-*-* i370-*-* i860-*-* ia64-*-* mep-*-* mn10200-*-*
-#notarget: bfin-*-* cr16-*-* cr16c-*-* cris*-*-* crx-*-* epiphany-*-*
-#notarget: h8300-*-* ip2k-*-* m10200-*-* m10300-*-* m32c-*-* metag-*-*
-#notarget: metag-*-* rl78-*-* rx-*-* sh*-*-* v850*-*-*
-# Targets with a leading char will faill this test.
+#xfail: d30v-*-* dlx-*-* i960-*-* pj*-*-*
+#xfail: hppa64-*-* i370-*-* i860-*-* ia64-*-* mep-*-* mn10200-*-*
+#xfail: bfin-*-* cr16-*-* cr16c-*-* crx-*-* epiphany-*-*
+#xfail: h8300-*-* ip2k-*-* mn10200-*-* mn10300-*-* m32c-*-* metag-*-*
+#xfail: rl78-*-* rx-*-* v850*-*-*
+# Targets with a leading char will fail this test.
# generic linker targets don't support --gc-sections, nor do a bunch of others
#...
diff --git a/ld/testsuite/ld-elf/pr21562j.d b/ld/testsuite/ld-elf/pr21562j.d
index eba2487..7c5508a 100644
--- a/ld/testsuite/ld-elf/pr21562j.d
+++ b/ld/testsuite/ld-elf/pr21562j.d
@@ -2,12 +2,12 @@
#ld: -shared -z defs --gc-sections -T pr21562b.t
#readelf: -s -S --wide
#target: *-*-linux* *-*-gnu*
-#notarget: d30v-*-* dlx-*-* i960-*-* pj*-*-*
-#notarget: hppa64-*-* i370-*-* i860-*-* ia64-*-* mep-*-* mn10200-*-*
-#notarget: bfin-*-* cr16-*-* cr16c-*-* cris*-*-* crx-*-* epiphany-*-*
-#notarget: h8300-*-* ip2k-*-* m10200-*-* m10300-*-* m32c-*-* metag-*-*
-#notarget: metag-*-* rl78-*-* rx-*-* sh*-*-* v850*-*-*
-# Targets with a leading char will faill this test.
+#xfail: d30v-*-* dlx-*-* i960-*-* pj*-*-*
+#xfail: hppa64-*-* i370-*-* i860-*-* ia64-*-* mep-*-* mn10200-*-*
+#xfail: bfin-*-* cr16-*-* cr16c-*-* crx-*-* epiphany-*-*
+#xfail: h8300-*-* ip2k-*-* mn10200-*-* mn10300-*-* m32c-*-* metag-*-*
+#xfail: rl78-*-* rx-*-* v850*-*-*
+# Targets with a leading char will fail this test.
# generic linker targets don't support --gc-sections, nor do a bunch of others
#...
diff --git a/ld/testsuite/ld-elf/pr21562k.d b/ld/testsuite/ld-elf/pr21562k.d
index 594bc89..7f76d08 100644
--- a/ld/testsuite/ld-elf/pr21562k.d
+++ b/ld/testsuite/ld-elf/pr21562k.d
@@ -2,12 +2,12 @@
#ld: -shared -z defs --gc-sections -T pr21562c.t
#readelf: -s -S --wide
#target: *-*-linux* *-*-gnu*
-#notarget: d30v-*-* dlx-*-* i960-*-* pj*-*-*
-#notarget: hppa64-*-* i370-*-* i860-*-* ia64-*-* mep-*-* mn10200-*-*
-#notarget: bfin-*-* cr16-*-* cr16c-*-* cris*-*-* crx-*-* epiphany-*-*
-#notarget: h8300-*-* ip2k-*-* m10200-*-* m10300-*-* m32c-*-* metag-*-*
-#notarget: metag-*-* rl78-*-* rx-*-* sh*-*-* v850*-*-*
-# Targets with a leading char will faill this test.
+#xfail: d30v-*-* dlx-*-* i960-*-* pj*-*-*
+#xfail: hppa64-*-* i370-*-* i860-*-* ia64-*-* mep-*-* mn10200-*-*
+#xfail: bfin-*-* cr16-*-* cr16c-*-* crx-*-* epiphany-*-*
+#xfail: h8300-*-* ip2k-*-* mn10200-*-* mn10300-*-* m32c-*-* metag-*-*
+#xfail: rl78-*-* rx-*-* v850*-*-*
+# Targets with a leading char will fail this test.
# generic linker targets don't support --gc-sections, nor do a bunch of others
#...
diff --git a/ld/testsuite/ld-elf/pr21562l.d b/ld/testsuite/ld-elf/pr21562l.d
index 1a9c2d6..1ad601c 100644
--- a/ld/testsuite/ld-elf/pr21562l.d
+++ b/ld/testsuite/ld-elf/pr21562l.d
@@ -2,12 +2,12 @@
#ld: -shared -z defs --gc-sections -T pr21562c.t
#readelf: -s -S --wide
#target: *-*-linux* *-*-gnu*
-#notarget: d30v-*-* dlx-*-* i960-*-* pj*-*-*
-#notarget: hppa64-*-* i370-*-* i860-*-* ia64-*-* mep-*-* mn10200-*-*
-#notarget: bfin-*-* cr16-*-* cr16c-*-* cris*-*-* crx-*-* epiphany-*-*
-#notarget: h8300-*-* ip2k-*-* m10200-*-* m10300-*-* m32c-*-* metag-*-*
-#notarget: metag-*-* rl78-*-* rx-*-* sh*-*-* v850*-*-*
-# Targets with a leading char will faill this test.
+#xfail: d30v-*-* dlx-*-* i960-*-* pj*-*-*
+#xfail: hppa64-*-* i370-*-* i860-*-* ia64-*-* mep-*-* mn10200-*-*
+#xfail: bfin-*-* cr16-*-* cr16c-*-* crx-*-* epiphany-*-*
+#xfail: h8300-*-* ip2k-*-* mn10200-*-* mn10300-*-* m32c-*-* metag-*-*
+#xfail: rl78-*-* rx-*-* v850*-*-*
+# Targets with a leading char will fail this test.
# generic linker targets don't support --gc-sections, nor do a bunch of others
#...
diff --git a/ld/testsuite/ld-elf/pr21562m.d b/ld/testsuite/ld-elf/pr21562m.d
index b21698a..2fedacd 100644
--- a/ld/testsuite/ld-elf/pr21562m.d
+++ b/ld/testsuite/ld-elf/pr21562m.d
@@ -2,12 +2,12 @@
#ld: -shared -z defs --gc-sections -T pr21562d.t
#readelf: -s -S --wide
#target: *-*-linux* *-*-gnu*
-#notarget: d30v-*-* dlx-*-* i960-*-* pj*-*-*
-#notarget: hppa64-*-* i370-*-* i860-*-* ia64-*-* mep-*-* mn10200-*-*
-#notarget: bfin-*-* cr16-*-* cr16c-*-* cris*-*-* crx-*-* epiphany-*-*
-#notarget: h8300-*-* ip2k-*-* m10200-*-* m10300-*-* m32c-*-* metag-*-*
-#notarget: metag-*-* rl78-*-* rx-*-* sh*-*-* v850*-*-*
-# Targets with a leading char will faill this test.
+#xfail: d30v-*-* dlx-*-* i960-*-* pj*-*-*
+#xfail: hppa64-*-* i370-*-* i860-*-* ia64-*-* mep-*-* mn10200-*-*
+#xfail: bfin-*-* cr16-*-* cr16c-*-* crx-*-* epiphany-*-*
+#xfail: h8300-*-* ip2k-*-* mn10200-*-* mn10300-*-* m32c-*-* metag-*-*
+#xfail: rl78-*-* rx-*-* v850*-*-*
+# Targets with a leading char will fail this test.
# generic linker targets don't support --gc-sections, nor do a bunch of others
#...
diff --git a/ld/testsuite/ld-elf/pr21562n.d b/ld/testsuite/ld-elf/pr21562n.d
index 561ec6b..f12b23d 100644
--- a/ld/testsuite/ld-elf/pr21562n.d
+++ b/ld/testsuite/ld-elf/pr21562n.d
@@ -2,12 +2,12 @@
#ld: -shared -z defs --gc-sections -T pr21562d.t
#readelf: -s -S --wide
#target: *-*-linux* *-*-gnu*
-#notarget: d30v-*-* dlx-*-* i960-*-* pj*-*-*
-#notarget: hppa64-*-* i370-*-* i860-*-* ia64-*-* mep-*-* mn10200-*-*
-#notarget: bfin-*-* cr16-*-* cr16c-*-* cris*-*-* crx-*-* epiphany-*-*
-#notarget: h8300-*-* ip2k-*-* m10200-*-* m10300-*-* m32c-*-* metag-*-*
-#notarget: metag-*-* rl78-*-* rx-*-* sh*-*-* v850*-*-*
-# Targets with a leading char will faill this test.
+#xfail: d30v-*-* dlx-*-* i960-*-* pj*-*-*
+#xfail: hppa64-*-* i370-*-* i860-*-* ia64-*-* mep-*-* mn10200-*-*
+#xfail: bfin-*-* cr16-*-* cr16c-*-* crx-*-* epiphany-*-*
+#xfail: h8300-*-* ip2k-*-* mn10200-*-* mn10300-*-* m32c-*-* metag-*-*
+#xfail: rl78-*-* rx-*-* v850*-*-*
+# Targets with a leading char will fail this test.
# generic linker targets don't support --gc-sections, nor do a bunch of others
#...
diff --git a/ld/testsuite/ld-elf/sizeofa.d b/ld/testsuite/ld-elf/sizeofa.d
index d4432a0..340456d 100644
--- a/ld/testsuite/ld-elf/sizeofa.d
+++ b/ld/testsuite/ld-elf/sizeofa.d
@@ -1,16 +1,17 @@
#source: sizeof.s
#ld: -Ur
#readelf: -sW
-#notarget: bfin-*-* cr16-*-* cr16c-*-* cris*-*-* crx-*-* epiphany-*-*
-#notarget: h8300-*-* ip2k-*-* m10200-*-* m10300-*-* m32c-*-* metag-*-*
-#notarget: metag-*-* rl78-*-* rx-*-* sh*-*-* v850*-*-*
-# Targets with a leading char will faill this test.
+#xfail: bfin-*-* cr16-*-* cr16c-*-* cris*-*-elf crx-*-* epiphany-*-*
+#xfail: h8300-*-* ip2k-*-* mn10200-*-* mn10300-*-* m32c-*-* metag-*-*
+#xfail: rl78-*-* rx-*-* sh*-*-elf* sh*-*-kaos* sh*-*-nto* sh-*-rtems*
+#xfail: sh*-*-symbianelf* sh*-*-vxworks v850*-*-*
+# Targets with a leading char will fail this test.
Symbol table '\.symtab' contains [0-9]+ entries:
+Num: +Value +Size Type +Bind +Vis +Ndx Name
+0: 0+ +0 +NOTYPE +LOCAL +DEFAULT +UND +
#...
- +[0-9]+: +[a-f0-9]+ +0 +NOTYPE +GLOBAL +DEFAULT +[0-9]+ +__stop_scnfoo
+ +[0-9]+: +[a-f0-9]+ +0 +NOTYPE +(LOC|GLOB)AL +DEFAULT +[0-9]+ +__stop_scnfoo
#...
+[0-9]+: +[a-f0-9]+ +0 +NOTYPE +GLOBAL +DEFAULT +UND +.sizeof.scnfoo
#pass
diff --git a/ld/testsuite/ld-elf/sizeofb.d b/ld/testsuite/ld-elf/sizeofb.d
index cd3920b..e25d88f 100644
--- a/ld/testsuite/ld-elf/sizeofb.d
+++ b/ld/testsuite/ld-elf/sizeofb.d
@@ -2,10 +2,10 @@
#ld: -shared
#readelf: -sW
#target: *-*-linux* *-*-gnu*
-#notarget: bfin-*-* cr16-*-* cr16c-*-* cris*-*-* crx-*-* epiphany-*-*
-#notarget: h8300-*-* ip2k-*-* m10200-*-* m10300-*-* m32c-*-* metag-*-*
-#notarget: metag-*-* rl78-*-* rx-*-* sh*-*-* v850*-*-*
-# Targets with a leading char will faill this test.
+#xfail: bfin-*-* cr16-*-* cr16c-*-* crx-*-* epiphany-*-*
+#xfail: h8300-*-* ip2k-*-* mn10200-*-* mn10300-*-* m32c-*-* metag-*-*
+#xfail: rl78-*-* rx-*-* v850*-*-*
+# Targets with a leading char will fail this test.
Symbol table '\.dynsym' contains [0-9]+ entries:
+Num: +Value +Size Type +Bind +Vis +Ndx Name
@@ -13,5 +13,5 @@ Symbol table '\.dynsym' contains [0-9]+ entries:
#...
+[0-9]+: +[a-f0-9]+ +0 +NOTYPE +LOCAL +DEFAULT +[0-9]+ +__stop_scnfoo
#...
- +[0-9]+: 0+10 + +0 +NOTYPE +GLOBAL +DEFAULT +ABS +.sizeof.scnfoo
+ +[0-9]+: 0+10 + +0 +NOTYPE +LOCAL +DEFAULT +ABS +.sizeof.scnfoo
#pass
diff --git a/ld/testsuite/ld-elf/startofa.d b/ld/testsuite/ld-elf/startofa.d
index cb261df..19ac29d 100644
--- a/ld/testsuite/ld-elf/startofa.d
+++ b/ld/testsuite/ld-elf/startofa.d
@@ -1,16 +1,17 @@
#source: startof.s
#ld: -Ur
#readelf: -sW
-#notarget: bfin-*-* cr16-*-* cr16c-*-* cris*-*-* crx-*-* epiphany-*-*
-#notarget: h8300-*-* ip2k-*-* m10200-*-* m10300-*-* m32c-*-* metag-*-*
-#notarget: metag-*-* rl78-*-* rx-*-* sh*-*-* v850*-*-*
-# Targets with a leading char will faill this test.
+#xfail: bfin-*-* cr16-*-* cr16c-*-* cris*-*-elf crx-*-* epiphany-*-*
+#xfail: h8300-*-* ip2k-*-* mn10200-*-* mn10300-*-* m32c-*-* metag-*-*
+#xfail: rl78-*-* rx-*-* sh*-*-elf* sh*-*-kaos* sh*-*-nto* sh-*-rtems*
+#xfail: sh*-*-symbianelf* sh*-*-vxworks v850*-*-*
+# Targets with a leading char will fail this test.
Symbol table '\.symtab' contains [0-9]+ entries:
+Num: +Value +Size Type +Bind +Vis +Ndx Name
+0: 0+ +0 +NOTYPE +LOCAL +DEFAULT +UND +
#...
- +[0-9]+: +[a-f0-9]+ +0 +NOTYPE +GLOBAL +DEFAULT +UND +.startof.scnfoo
+ +[0-9]+: +[a-f0-9]+ +0 +NOTYPE +(LOCAL +DEFAULT +[0-9]+ +__start_scnfoo|GLOBAL +DEFAULT +UND +.startof.scnfoo)
#...
- +[0-9]+: +[a-f0-9]+ +0 +NOTYPE +GLOBAL +DEFAULT +[0-9]+ +__start_scnfoo
+ +[0-9]+: +[a-f0-9]+ +0 +NOTYPE +GLOBAL +DEFAULT +(UND +.startof.scnfoo|[0-9]+ +__start_scnfoo)
#pass
diff --git a/ld/testsuite/ld-elf/startofb.d b/ld/testsuite/ld-elf/startofb.d
index 0d1da66..2cc1b86 100644
--- a/ld/testsuite/ld-elf/startofb.d
+++ b/ld/testsuite/ld-elf/startofb.d
@@ -2,16 +2,16 @@
#ld: -shared
#readelf: -sW
#target: *-*-linux* *-*-gnu*
-#notarget: bfin-*-* cr16-*-* cr16c-*-* cris*-*-* crx-*-* epiphany-*-*
-#notarget: h8300-*-* ip2k-*-* m10200-*-* m10300-*-* m32c-*-* metag-*-*
-#notarget: metag-*-* rl78-*-* rx-*-* sh*-*-* v850*-*-*
-# Targets with a leading char will faill this test.
+#xfail: bfin-*-* cr16-*-* cr16c-*-* crx-*-* epiphany-*-*
+#xfail: h8300-*-* ip2k-*-* mn10200-*-* mn10300-*-* m32c-*-* metag-*-*
+#xfail: rl78-*-* rx-*-* v850*-*-*
+# Targets with a leading char will fail this test.
Symbol table '\.dynsym' contains [0-9]+ entries:
+Num: +Value +Size Type +Bind +Vis +Ndx Name
+0: 0+ +0 +NOTYPE +LOCAL +DEFAULT +UND +
#...
- +[0-9]+: +[a-f0-9]+ +0 +NOTYPE +GLOBAL +DEFAULT +[0-9]+ +.startof.scnfoo
+ +[0-9]+: +[a-f0-9]+ +0 +NOTYPE +LOCAL +DEFAULT +[0-9]+ +.startof.scnfoo
#...
+[0-9]+: +[a-f0-9]+ +0 +NOTYPE +LOCAL +DEFAULT +[0-9]+ +__start_scnfoo
#pass