]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
ld: adjust ld-scripts/map-address.*
authorJan Beulich <jbeulich@suse.com>
Thu, 4 Mar 2021 15:56:40 +0000 (16:56 +0100)
committerJan Beulich <jbeulich@suse.com>
Thu, 4 Mar 2021 15:56:40 +0000 (16:56 +0100)
Without setting an image base address and without naming at least .text,
this test produces entirely bogus PE output. To be honest, even the ELF
output looks odd: .text gets placed at 0x10204, and both foo and bar get
associated with .text despite living below its start address.

Since neither image base nor .text placement are the subject of this
test, specify .text placement explicitly and in the PE case force the
image base to zero.

ld/ChangeLog
ld/testsuite/ld-scripts/map-address.exp
ld/testsuite/ld-scripts/map-address.t

index 95bb3f6c1a8aab29cc45cc861b46c572b79ad1ba..c451af0840ee7af5f521271708041598bd9728cf 100644 (file)
@@ -1,3 +1,9 @@
+2021-03-04  Jan Beulich  <jbeulich@suse.com>
+
+       * testsuite/ld-scripts/map-address.exp: Set image base to zero
+       for PE/COFF.
+       * testsuite/ld-scripts/map-address.t: Place .text.
+
 2021-03-04  Jan Beulich  <jbeulich@suse.com>
 
        * ldexp.c (ldexp_is_final_sym_absolute): New.
index 9e6f2dc3df3b8d2e1aaa15cfa255b6e1bd8954c1..0f9ac1cf4e646fe2659d8b7f6b547f7cfdb9d83c 100644 (file)
@@ -26,9 +26,15 @@ if {![ld_assemble $as $srcdir/$subdir/sizeof.s tmpdir/map-address.o]} {
     return
 }
 
+if { [is_pecoff_format] } then {
+    set IMAGE_BASE "--image-base 0"
+} else {
+    set IMAGE_BASE ""
+}
+
 if {![ld_link $ld tmpdir/map-address \
         "$LDFLAGS -T $srcdir/$subdir/map-address.t \
-         tmpdir/map-address.o \
+         $IMAGE_BASE tmpdir/map-address.o \
          -Map tmpdir/map-address.map"]} {
     fail $testname
     return
@@ -51,7 +57,7 @@ set testname "map to directory"
 
 if {![ld_link $ld tmpdir/map-address \
         "$LDFLAGS -T $srcdir/$subdir/map-address.t \
-         tmpdir/map-address.o \
+         $IMAGE_BASE tmpdir/map-address.o \
          -Map tmpdir --output fred"]} {
     fail $testname
     return
@@ -74,7 +80,7 @@ set testname "map to % directory"
 
 if {![ld_link $ld tmpdir/map-address \
         "$LDFLAGS -T $srcdir/$subdir/map-address.t \
-         tmpdir/map-address.o \
+         $IMAGE_BASE tmpdir/map-address.o \
          -Map=tmpdir/% --output fred"]} {
     fail $testname
     return
@@ -97,7 +103,7 @@ set testname "map to %.foo directory"
 
 if {![ld_link $ld tmpdir/map-address \
         "$LDFLAGS -T $srcdir/$subdir/map-address.t \
-         tmpdir/map-address.o \
+         $IMAGE_BASE tmpdir/map-address.o \
          -Map=tmpdir/%.foo --output fred"]} {
     fail $testname
     return
index e077ed1cb4c97993b258d5d2c2f88dffbc3eb8d1..94e14bde36df2e38ac3a42172e6940cc92a4d438 100644 (file)
@@ -8,4 +8,7 @@ SECTIONS
   bar = .;
   . = ALIGN (4);
   frob = .;
+
+  . = 0x10000;
+  .text : { *(.text) }
 }