aboutsummaryrefslogtreecommitdiff
path: root/ld/testsuite/ld-scripts
diff options
context:
space:
mode:
authorNick Clifton <nickc@redhat.com>2020-11-06 14:36:45 +0000
committerNick Clifton <nickc@redhat.com>2020-11-06 14:36:45 +0000
commit2c72361c810f4b6223949363f635376e4311ac7a (patch)
tree12e8ff66e98cb6867f5c3d687ea84f53d0d83b15 /ld/testsuite/ld-scripts
parent9c905051aaa48bd07f243c1ed502fc88dbf1f3bb (diff)
downloadgdb-2c72361c810f4b6223949363f635376e4311ac7a.zip
gdb-2c72361c810f4b6223949363f635376e4311ac7a.tar.gz
gdb-2c72361c810f4b6223949363f635376e4311ac7a.tar.bz2
Extend ld's -Map=<dir> functionality by allowing '%' to be replaced with the output file path.
* lexsup.c (parse_args): Add more checks of the mapfile. If it is a directory use the basename of the output file as the file component. If the % character is present, replace it with the full output filepath. * testsuite/ld-scripts/map-address.exp: Add test of % functionality. * ld.texi: Document the new behaviour.
Diffstat (limited to 'ld/testsuite/ld-scripts')
-rw-r--r--ld/testsuite/ld-scripts/map-address.exp47
1 files changed, 47 insertions, 0 deletions
diff --git a/ld/testsuite/ld-scripts/map-address.exp b/ld/testsuite/ld-scripts/map-address.exp
index 1f9457a..e8d3683 100644
--- a/ld/testsuite/ld-scripts/map-address.exp
+++ b/ld/testsuite/ld-scripts/map-address.exp
@@ -46,6 +46,7 @@ if {[regexp_diff \
pass $testname
}
+
set testname "map to directory"
if {![ld_link $ld tmpdir/map-address \
@@ -67,3 +68,49 @@ if {[regexp_diff \
} else {
pass $testname
}
+
+
+set testname "map to % directory"
+
+if {![ld_link $ld tmpdir/map-address \
+ "$LDFLAGS -T $srcdir/$subdir/map-address.t \
+ tmpdir/map-address.o \
+ -Map=tmpdir/% --output fred"]} {
+ fail $testname
+ return
+}
+
+if [is_remote host] then {
+ remote_upload host "tmpdir/fred.map"
+}
+
+if {[regexp_diff \
+ "tmpdir/fred.map" \
+ "$srcdir/$subdir/map-address.d"]} {
+ fail $testname
+} else {
+ pass $testname
+}
+
+
+set testname "map to %.foo directory"
+
+if {![ld_link $ld tmpdir/map-address \
+ "$LDFLAGS -T $srcdir/$subdir/map-address.t \
+ tmpdir/map-address.o \
+ -Map=tmpdir/%.foo --output fred"]} {
+ fail $testname
+ return
+}
+
+if [is_remote host] then {
+ remote_upload host "tmpdir/fred.foo"
+}
+
+if {[regexp_diff \
+ "tmpdir/fred.foo" \
+ "$srcdir/$subdir/map-address.d"]} {
+ fail $testname
+} else {
+ pass $testname
+}