Fix linker tests to work with 16-bit targets.
authorStephen Casner <casner@acm.org>
Tue, 21 Apr 2020 14:10:52 +0000 (15:10 +0100)
committerNick Clifton <nickc@redhat.com>
Tue, 21 Apr 2020 14:10:52 +0000 (15:10 +0100)
PR 25829
* testsuite/ld-scripts/script.exp (check_script)
(extract_symbol_test): Make test addresses fit in 16 bits.
* testsuite/ld-scripts/memory.t: Likewise.
* testsuite/ld-scripts/memory_sym.t (TXT_LENGTH): Likewise.
* testsuite/ld-scripts/default-script.t (_START): Likewise.
* testsuite/ld-scripts/default-script1.d: Likewise.
* testsuite/ld-scripts/default-script2.d: Likewise.
* testsuite/ld-scripts/default-script3.d: Likewise.
* testsuite/ld-scripts/default-script4.d: Likewise.
* testsuite/ld-scripts/empty-address-1.t: Likewise.
* testsuite/ld-scripts/empty-address-1.d: Likewise.
* testsuite/ld-scripts/empty-address-2a.d: Likewise.
* testsuite/ld-scripts/empty-address-2b.d: Likewise.
* testsuite/ld-misc/start.s: .long -> .dc.a to allow relocation to
fit target address size.
  * testsuite/ld-scripts/empty-address-1.s: Likewise.
* testsuite/ld-scripts/empty-address-2.s: Likewise.

16 files changed:
ld/ChangeLog
ld/testsuite/ld-misc/start.s
ld/testsuite/ld-scripts/default-script.t
ld/testsuite/ld-scripts/default-script1.d
ld/testsuite/ld-scripts/default-script2.d
ld/testsuite/ld-scripts/default-script3.d
ld/testsuite/ld-scripts/default-script4.d
ld/testsuite/ld-scripts/empty-address-1.d
ld/testsuite/ld-scripts/empty-address-1.s
ld/testsuite/ld-scripts/empty-address-1.t
ld/testsuite/ld-scripts/empty-address-2.s
ld/testsuite/ld-scripts/empty-address-2a.d
ld/testsuite/ld-scripts/empty-address-2b.d
ld/testsuite/ld-scripts/memory.t
ld/testsuite/ld-scripts/memory_sym.t
ld/testsuite/ld-scripts/script.exp

index 1169f93373ee4bb132fac794b6e53ff1f46a383f..0ef2c7bb990e5bed6ceb0953228b5dfe2518ef96 100644 (file)
@@ -1,3 +1,24 @@
+2020-04-21  Stephen Casner  <casner@acm.org>
+
+       PR 25829
+       * testsuite/ld-scripts/script.exp (check_script)
+       (extract_symbol_test): Make test addresses fit in 16 bits.
+       * testsuite/ld-scripts/memory.t: Likewise.
+       * testsuite/ld-scripts/memory_sym.t (TXT_LENGTH): Likewise.
+       * testsuite/ld-scripts/default-script.t (_START): Likewise.
+       * testsuite/ld-scripts/default-script1.d: Likewise.
+       * testsuite/ld-scripts/default-script2.d: Likewise.
+       * testsuite/ld-scripts/default-script3.d: Likewise.
+       * testsuite/ld-scripts/default-script4.d: Likewise.
+       * testsuite/ld-scripts/empty-address-1.t: Likewise.
+       * testsuite/ld-scripts/empty-address-1.d: Likewise.
+       * testsuite/ld-scripts/empty-address-2a.d: Likewise.
+       * testsuite/ld-scripts/empty-address-2b.d: Likewise.
+       * testsuite/ld-misc/start.s: .long -> .dc.a to allow relocation to
+       fit target address size.
+       * testsuite/ld-scripts/empty-address-1.s: Likewise.
+       * testsuite/ld-scripts/empty-address-2.s: Likewise.
+
 2020-04-21  H.J. Lu  <hongjiu.lu@intel.com>
 
        PR ld/25849
index 846236eef4d9b9e9536d1ea4dc737c1d0ba4d7a5..b01c559177473f65281fd7a5734413581a67ca6c 100644 (file)
@@ -7,4 +7,4 @@ _start:
 __start:
        .global main    /* Used by HPPA targets.  */
 main:
-       .long foo
+       .dc.a foo
index fc70187cd40438e43e4b86185ea376a264c492c4..ff0fcda7a934ff10af663a4b5295f0e3df7ec94f 100644 (file)
@@ -1,4 +1,4 @@
-_START = DEFINED(_START) ? _START : 0x9000000;
+_START = DEFINED(_START) ? _START : 0x900;
 SECTIONS
 {
   . = _START;
index 61973f756159e603e83eed5fefe54536c308db84..a749265b9f8d90791410b7716785cd03de36828c 100644 (file)
@@ -1,9 +1,11 @@
 # source: default-script.s
-# ld: -defsym _START=0x8000000 -T default-script.t
+# ld: -defsym _START=0x800 -T default-script.t
 # nm: -n
+# skip: *-*-mingw64 x86_64-*-cygwin
+# Skipped on Mingw64 and Cygwin because the image base defaults to 0x100000000
 
 #...
-0*8000000 . _START
+0*800 . _START
 #...
-0*8000000 T text
+0*800 T text
 #pass
index 68ce2aa9fe2e75703ff4e12f0625a12f861c10f4..137cf09b5292abc3bf921c2e46dd1e7a790d931a 100644 (file)
@@ -1,9 +1,11 @@
 # source: default-script.s
-# ld: -T default-script.t -defsym _START=0x8000000
+# ld: -T default-script.t -defsym _START=0x800
 # nm: -n
+# skip: *-*-mingw64 x86_64-*-cygwin
+# Skipped on Mingw64 and Cygwin because the image base defaults to 0x100000000
 
 #...
-0*8000000 . _START
+0*800 . _START
 #...
-0*9000000 T text
+0*900 T text
 #pass
index b2da49654b2a82217694b97abb1fd86d51957643..00f64ecb618dd9f31c9d13082f20b8266a0c6961 100644 (file)
@@ -1,9 +1,11 @@
 # source: default-script.s
-# ld: -defsym _START=0x8000000 -dT default-script.t
+# ld: -defsym _START=0x800 -dT default-script.t
 # nm: -n
+# skip: *-*-mingw64 x86_64-*-cygwin
+# Skipped on Mingw64 and Cygwin because the image base defaults to 0x100000000
 
 #...
-0*8000000 . _START
+0*800 . _START
 #...
-0*8000000 T text
+0*800 T text
 #pass
index 001008447ab60f0acec9cc558d6b0d4710c49b29..dc4f33b37cb72fbf2676aa2bea11864e08834f80 100644 (file)
@@ -1,9 +1,11 @@
 # source: default-script.s
-# ld: --default-script default-script.t -defsym _START=0x8000000
+# ld: --default-script default-script.t -defsym _START=0x800
 # nm: -n
+# skip: *-*-mingw64 x86_64-*-cygwin
+# Skipped on Mingw64 and Cygwin because the image base defaults to 0x100000000
 
 #...
-0*8000000 . _START
+0*800 . _START
 #...
-0*8000000 T text
+0*800 T text
 #pass
index 5b18217639cf0d13baf64f27cc883037c650a2ae..c758b968f0b6cde150226ee628da20375c9385af 100644 (file)
@@ -2,8 +2,8 @@
 #nm: -n
 #xfail: frv-*-*linux*
 #...
-0+0 T _start
+0+0 [AT] _start
 #...
-0+2000000 [ADT] __data_end
-0+2000000 [ADT] __data_start
+0+200 [ADT] __data_end
+0+200 [ADT] __data_start
 #pass
index c5cc1a596c8adc68b6ce44a8e52c46b2f954a631..7ffe2d53cab8550c93287dfb8afadb5ab19d173e 100644 (file)
@@ -1,5 +1,5 @@
        .text
        .global _start
 _start:
-       .long __data_start
-       .long __data_end
+       .dc.a __data_start
+       .dc.a __data_end
index 57a8bed27711238ddff128a79c9b887fc33f2c13..7c4b8151c7a971af09a25a9aee4c0b1e48eb956c 100644 (file)
@@ -1,7 +1,7 @@
 SECTIONS
 {
   .text 0x0000000: { *(.text) }
-  .data 0x2000000:
+  .data 0x200:
   {
     __data_start = . ;
     *(.data)
index 79f58eacc343332b093854c09bf9ae2ce16fdad7..14d35d81c66db868d151c82a14c5970a79b7c755 100644 (file)
@@ -1,5 +1,5 @@
        .text
        .global _start
 _start:
-       .long __data_end
+       .dc.a __data_end
        .p2align 4
index d27bf0045e0cdb4bdae0349dfddddce53dc4d223..85aa648531d8228479a78ecf8394ac8f9eb9e9b4 100644 (file)
@@ -1,7 +1,7 @@
 #source: empty-address-2.s
-#ld: -Ttext 0x0000000 -Tdata 0x2000000 -T empty-address-2a.t
+#ld: -Ttext 0x0000000 -Tdata 0x200 -T empty-address-2a.t
 #nm: -n
-#xfail: frv-*-*linux*
+#xfail: frv-*-*linux* riscv64-*-*
 #...
 0+0 T _start
 #...
index eb23e7481f57428b510e795471a83269da29a36d..9e6bc3d1de01cec2dfc4146fa9693cfeceacaf32 100644 (file)
@@ -1,7 +1,7 @@
 #source: empty-address-2.s
-#ld: -Ttext 0x0000000 -Tdata 0x2000000 -T empty-address-2b.t
+#ld: -Ttext 0x0000000 -Tdata 0x200 -T empty-address-2b.t
 #nm: -n
-#xfail: frv-*-*linux*
+#xfail: frv-*-*linux* riscv64-*-*
 #...
 0+0 T _start
 #...
index 937394f522f741e56795da11f5c102f5ba6a46f1..5b2feb10596432fe77b83cfea78fcf6a599d7ea8 100644 (file)
@@ -1,7 +1,7 @@
 MEMORY
 {
-  R_TEXTMEM (ARX) : ORIGIN = 0x100, LENGTH = 32K
-  R_DATAMEM (AW)  : org = 0x1000, l = (64 * 1024)
+  R_TEXTMEM (ARX) : ORIGIN = 0x100, LENGTH = 16K
+  R_DATAMEM (AW)  : org = 0x1000, l = (4 * 1024)
 }
 
 REGION_ALIAS ("A_TEXTMEM", R_TEXTMEM);
index 4ccec550120c0042cde7982f0088daedc2052cc9..c9df2ed28adb7dfc701134b0f4d5047ee2fb7996 100644 (file)
@@ -1,5 +1,5 @@
 TXT_ORIGIN = 0x100;
-TXT_LENGTH = 32K;
+TXT_LENGTH = 16K;
 MEMORY
 {
   R_TEXTMEM (ARX) : ORIGIN = TXT_ORIGIN, LENGTH = TXT_LENGTH
index 5a01279ade7aed9b9e7f73d911338531d7636266..eaa4f53b034dfbf5c77f9a3bd4b737e518a03e11 100644 (file)
@@ -67,7 +67,7 @@ proc check_script { } {
     } 
 
     if {[info exists nm_output(tred)] \
-        && $nm_output(tred) != (0x100 + 0x8000)} {
+        && $nm_output(tred) != (0x100 + 0x4000)} {
        send_log "tred == $nm_output(tred)\n"
        verbose "tred == $nm_output(tred)"
        set passes 0
@@ -87,7 +87,7 @@ proc check_script { } {
     } 
 
     if {[info exists nm_output(fred)] \
-        && $nm_output(fred) != (0x1000 + 0x10000)} {
+        && $nm_output(fred) != (0x1000 + 0x1000)} {
        send_log "fred == $nm_output(fred)\n"
        verbose "fred == $nm_output(fred)"
        set passes 0
@@ -215,7 +215,7 @@ if ![ld_link $ld tmpdir/script "$flags -T $srcdir/$subdir/memory.t tmpdir/script
 }
 
 set testname "MEMORY with symbols"
-if ![ld_link $ld tmpdir/script "$flags -defsym DATA_ORIGIN=0x1000 -defsym DATA_LENGTH=0x10000 -T $srcdir/$subdir/memory_sym.t tmpdir/script.o"] {
+if ![ld_link $ld tmpdir/script "$flags -defsym DATA_ORIGIN=0x1000 -defsym DATA_LENGTH=0x1000 -T $srcdir/$subdir/memory_sym.t tmpdir/script.o"] {
     fail $testname
     untested "extract symbols"
 } else {