aboutsummaryrefslogtreecommitdiff
path: root/ld/testsuite
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2019-05-03 21:36:46 +0930
committerAlan Modra <amodra@gmail.com>2019-05-04 16:57:33 +0930
commita288c270991de1578ad28ac312120f4167347234 (patch)
treea20874b7ba76dddaed092039d5efb3d6615798f6 /ld/testsuite
parent66452beb773568c7f60dbc6b7c70f671a8c9cf4b (diff)
downloadgdb-a288c270991de1578ad28ac312120f4167347234.zip
gdb-a288c270991de1578ad28ac312120f4167347234.tar.gz
gdb-a288c270991de1578ad28ac312120f4167347234.tar.bz2
PR24511, nm should not mark symbols in .init_array as "t"
This patch restricts the section names matched in coff_section_type, a function that translates section names to symbol type, and arranges to translate section flags to symbol type before looking at names. The latter change resulted in various test failures due to improper section flags being used in tests, and by the plugin support, so fix that too. The new test fails on many ELF targets that lack .init/fini_array in their scripts. I've just xfailed those. pru-elf oddly defines __init_array_begin rather than __init_array_start. I've left that target as a FAIL, and pj-elf too which reports an error for undefined weak symbols. bfd/ PR 24511 * syms.c (coff_section_type): Only allow '.', '$' and numeric following the standard section names. (bfd_decode_symclass): Prioritize section flag tests in decode_section_type before name tests in coff_section_type. * plugin.c (bfd_plugin_canonicalize_symtab): Init fake_section and fake_common_section using BFD_FAKE_SECTION. Use "fake" as their names and choose standard .text section flags for fake_section. ld/ PR 24511 * testsuite/ld-elf/pr14156a.d: Allow for .init/.fini being a data section on hppa64. * testsuite/ld-elf/pr14156b.d: Likewise. * testsuite/ld-scripts/pr18963.t: Map standard sections to set output section flags. * testsuite/ld-scripts/sane1.t: Likewise. * testsuite/ld-elf/init-fini-arrays.s: Reference __init_array_start and __fini_array_start. Define __start et al. * testsuite/ld-elf/pr24511.d: New test.
Diffstat (limited to 'ld/testsuite')
-rw-r--r--ld/testsuite/ld-elf/init-fini-arrays.s17
-rw-r--r--ld/testsuite/ld-elf/pr14156a.d10
-rw-r--r--ld/testsuite/ld-elf/pr14156b.d10
-rw-r--r--ld/testsuite/ld-elf/pr24511.d18
-rw-r--r--ld/testsuite/ld-scripts/pr18963.t3
-rw-r--r--ld/testsuite/ld-scripts/sane1.t1
6 files changed, 47 insertions, 12 deletions
diff --git a/ld/testsuite/ld-elf/init-fini-arrays.s b/ld/testsuite/ld-elf/init-fini-arrays.s
index 6740ed6..b8adc29 100644
--- a/ld/testsuite/ld-elf/init-fini-arrays.s
+++ b/ld/testsuite/ld-elf/init-fini-arrays.s
@@ -1,7 +1,20 @@
.section .init_array.01000,"aw",%init_array
.p2align 2
- .word 0
+ .weak __init_array_start, ___init_array_start
+ .dc.a __init_array_start
+ .dc.a ___init_array_start
.section .fini_array.01000,"aw",%fini_array
.p2align 2
- .word 0
+ .weak __fini_array_start, ___fini_array_start
+ .dc.a __fini_array_start
+ .dc.a ___fini_array_start
+
+ .text
+ .globl main, _main, start, _start, __start
+main:
+_main:
+start:
+_start:
+__start:
+ .dc.a 0
diff --git a/ld/testsuite/ld-elf/pr14156a.d b/ld/testsuite/ld-elf/pr14156a.d
index cf38ee1..535ac3e 100644
--- a/ld/testsuite/ld-elf/pr14156a.d
+++ b/ld/testsuite/ld-elf/pr14156a.d
@@ -7,10 +7,10 @@
#nm: -n
#...
-[0-9a-f]+ T foo
-[0-9a-f]+ t foo1
+[0-9a-f]+ [TD] foo
+[0-9a-f]+ [td] foo1
#...
-[0-9a-f]+ t foo2
-[0-9a-f]+ t foo3
-[0-9a-f]+ t last
+[0-9a-f]+ [td] foo2
+[0-9a-f]+ [td] foo3
+[0-9a-f]+ [td] last
#pass
diff --git a/ld/testsuite/ld-elf/pr14156b.d b/ld/testsuite/ld-elf/pr14156b.d
index f965f74e..27da016 100644
--- a/ld/testsuite/ld-elf/pr14156b.d
+++ b/ld/testsuite/ld-elf/pr14156b.d
@@ -7,10 +7,10 @@
#nm: -n
#...
-[0-9a-f]+ T foo
-[0-9a-f]+ t foo1
+[0-9a-f]+ [TD] foo
+[0-9a-f]+ [td] foo1
#...
-[0-9a-f]+ t foo2
-[0-9a-f]+ t foo3
-[0-9a-f]+ t last
+[0-9a-f]+ [td] foo2
+[0-9a-f]+ [td] foo3
+[0-9a-f]+ [td] last
#pass
diff --git a/ld/testsuite/ld-elf/pr24511.d b/ld/testsuite/ld-elf/pr24511.d
new file mode 100644
index 0000000..f77a43b
--- /dev/null
+++ b/ld/testsuite/ld-elf/pr24511.d
@@ -0,0 +1,18 @@
+#source: init-fini-arrays.s
+#ld:
+#nm: -n
+# Most targets with their own scripts don't support init/fini_array and
+# thus don't define __init/fini_array_start.
+#xfail: avr-*-* cr16-*-* crx-*-* d10v-*-* d30v-*-* dlx-*-* ft32-*-* iq2000-*-*
+#xfail: m68hc1*-*-* mep-*-* microblaze*-*-elf* s12z-*-* v850-*-* visium-*-*
+#xfail: xgate-*-* xstormy*-*-*
+# Some targets with their own scripts haven't kept up with elf.sc and
+# PROVIDE __init_array_start rather than using PROVIDE_HIDDEN. These
+# result in D symbols. rx-elf makes .init/fini_array SHF_EXECINSTR so
+# gets t symbols.
+
+#...
+[0-9a-f]+ [dDt] _?__init_array_start
+#...
+[0-9a-f]+ [dDt] _?__fini_array_start
+#pass
diff --git a/ld/testsuite/ld-scripts/pr18963.t b/ld/testsuite/ld-scripts/pr18963.t
index b0cd742..830ded7 100644
--- a/ld/testsuite/ld-scripts/pr18963.t
+++ b/ld/testsuite/ld-scripts/pr18963.t
@@ -5,16 +5,19 @@ SECTIONS
.text :
{
_start = .;
+ *(.text)
. = 0x10000;
}
B = .;
.data :
{
+ *(.data)
. = 0x10000;
}
C = .;
.bss :
{
+ *(.bss)
. = 0x10000;
}
D = A - C + B;
diff --git a/ld/testsuite/ld-scripts/sane1.t b/ld/testsuite/ld-scripts/sane1.t
index 037a62c..90ee9b6 100644
--- a/ld/testsuite/ld-scripts/sane1.t
+++ b/ld/testsuite/ld-scripts/sane1.t
@@ -20,6 +20,7 @@ SECTIONS
s4 = ABSOLUTE (d1) - 2;
s5 = ABSOLUTE (d2) % 5;
s6 = ABSOLUTE (d2) / 5;
+ *(.data)
}
/DISCARD/ : {*(*)}