aboutsummaryrefslogtreecommitdiff
path: root/ld/testsuite/ld-scripts
diff options
context:
space:
mode:
authorH.J. Lu <hjl.tools@gmail.com>2017-10-09 04:17:10 -0700
committerH.J. Lu <hjl.tools@gmail.com>2017-10-09 04:17:24 -0700
commit76f361eb4934dcda0626517c311b34fbc92d09b9 (patch)
treed143cd18021208ec0d2365bf8c3b4134ead314fc /ld/testsuite/ld-scripts
parent5d3b558acd329de9dcbd63d9bb04242b31fad490 (diff)
downloadgdb-76f361eb4934dcda0626517c311b34fbc92d09b9.zip
gdb-76f361eb4934dcda0626517c311b34fbc92d09b9.tar.gz
gdb-76f361eb4934dcda0626517c311b34fbc92d09b9.tar.bz2
ld: Don't allow '~' as the first char in symbol name
Don't allow '~' as the first character in symbol name in linker script. PR ld/22267 * ldlex.l (SYMBOLNAMECHAR1) New. (DEFSYMEXP): Replace FILENAMECHAR1 with SYMBOLNAMECHAR1. (EXPRESSION): Likewise. * testsuite/ld-scripts/expr.exp: Run pr22267. * testsuite/ld-scripts/pr22267.d: New file. * testsuite/ld-scripts/pr22267.s: Likewise. * testsuite/ld-scripts/pr22267.t: Likewise.
Diffstat (limited to 'ld/testsuite/ld-scripts')
-rw-r--r--ld/testsuite/ld-scripts/expr.exp1
-rw-r--r--ld/testsuite/ld-scripts/pr22267.d7
-rw-r--r--ld/testsuite/ld-scripts/pr22267.s10
-rw-r--r--ld/testsuite/ld-scripts/pr22267.t4
4 files changed, 22 insertions, 0 deletions
diff --git a/ld/testsuite/ld-scripts/expr.exp b/ld/testsuite/ld-scripts/expr.exp
index 9db5366..62d45dc 100644
--- a/ld/testsuite/ld-scripts/expr.exp
+++ b/ld/testsuite/ld-scripts/expr.exp
@@ -25,6 +25,7 @@ run_dump_test sane1
run_dump_test assign-loc
run_dump_test pr14962
run_dump_test pr14962-2
+run_dump_test pr22267
set old_ldflags $LDFLAGS
if { [istarget spu*-*-*] } {
diff --git a/ld/testsuite/ld-scripts/pr22267.d b/ld/testsuite/ld-scripts/pr22267.d
new file mode 100644
index 0000000..f66d4be
--- /dev/null
+++ b/ld/testsuite/ld-scripts/pr22267.d
@@ -0,0 +1,7 @@
+#ld: -T pr22267.t
+#nm: -n
+
+# Some targets may zero-extend 32-bit address to 64 bits.
+#...
+0*f+00 A foo
+#pass
diff --git a/ld/testsuite/ld-scripts/pr22267.s b/ld/testsuite/ld-scripts/pr22267.s
new file mode 100644
index 0000000..c0a5cda
--- /dev/null
+++ b/ld/testsuite/ld-scripts/pr22267.s
@@ -0,0 +1,10 @@
+ .globl main
+ .globl start
+ .globl _start
+ .globl __start
+ .text
+main:
+start:
+_start:
+__start:
+ .dc.a foo
diff --git a/ld/testsuite/ld-scripts/pr22267.t b/ld/testsuite/ld-scripts/pr22267.t
new file mode 100644
index 0000000..a075405
--- /dev/null
+++ b/ld/testsuite/ld-scripts/pr22267.t
@@ -0,0 +1,4 @@
+SECTIONS
+{
+ foo = ~0xFF;
+}