summaryrefslogtreecommitdiff
path: root/ld/testsuite/ld-scripts
diff options
context:
space:
mode:
Diffstat (limited to 'ld/testsuite/ld-scripts')
-rw-r--r--ld/testsuite/ld-scripts/map-address.exp27
-rw-r--r--ld/testsuite/ld-scripts/map-locals.d5
-rw-r--r--ld/testsuite/ld-scripts/sizeof.s1
3 files changed, 33 insertions, 0 deletions
diff --git a/ld/testsuite/ld-scripts/map-address.exp b/ld/testsuite/ld-scripts/map-address.exp
index 0eeca10fdd8..fbea9064265 100644
--- a/ld/testsuite/ld-scripts/map-address.exp
+++ b/ld/testsuite/ld-scripts/map-address.exp
@@ -120,3 +120,30 @@ if {[regexp_diff \
} else {
pass $testname
}
+
+if { [is_elf_format] } {
+ set testname "map with locals"
+
+ if {![ld_link $ld tmpdir/map-address \
+ "$LDFLAGS -T $srcdir/$subdir/map-address.t \
+ $IMAGE_BASE tmpdir/map-address.o \
+ -Map=tmpdir/map-locals.map --print-map-locals"]} {
+ fail $testname
+ return
+ }
+
+ if [is_remote host] then {
+ remote_upload host "tmpdir/map-locals.map"
+ }
+
+ # Some ELF targets do not preserve their local symbols.
+ setup_xfail "d30v-*-*" "dlx-*-*" "pj-*-*" "s12z-*-*" "xgate-*-*"
+
+ if {[regexp_diff \
+ "tmpdir/map-locals.map" \
+ "$srcdir/$subdir/map-locals.d"]} {
+ fail $testname
+ } else {
+ pass $testname
+ }
+}
diff --git a/ld/testsuite/ld-scripts/map-locals.d b/ld/testsuite/ld-scripts/map-locals.d
new file mode 100644
index 00000000000..f3137f13814
--- /dev/null
+++ b/ld/testsuite/ld-scripts/map-locals.d
@@ -0,0 +1,5 @@
+#...
+Linker script and memory map
+#...
+.*\(local\)[ ]+local_sym
+#pass
diff --git a/ld/testsuite/ld-scripts/sizeof.s b/ld/testsuite/ld-scripts/sizeof.s
index e221ca3c0b3..7cd1677bc85 100644
--- a/ld/testsuite/ld-scripts/sizeof.s
+++ b/ld/testsuite/ld-scripts/sizeof.s
@@ -1 +1,2 @@
+local_sym:
.space 16