[Patch] Make testsuite consider avr as an ELF target

Senthil Kumar Selvaraj senthil_kumar.selvaraj@atmel.com
Wed May 4 10:26:00 GMT 2016


Hi,

  This patch adds avr-*-* to is_elf_target and fixes a few ld testsuite
  failures for avr.

  Specifically, it relaxes the regexes used in pr18735.d and pr14265.d
  to allow other symbols to occur in-between the ones the test looks for
  - some symbols implicitly defined by the assembler/linker were making
  the tests fail.

  I also excluded avr from running 64ksec - the text region overflowed
  by more than 300000 bytes. I also conditionally added pr17973.d to the
  list of plugin tests so that it runs only for targets that support -shared.

  I also had to modify selective.exp to set a non-zero start address for
  .text for avr, as one of the test cases expects a non-zero address for
  a valid symbol, yet 0 happens to be a valid address for avr.

  If this is ok, could someone commit please? I don't have commit
  access.

Regards
Senthil

binutils/ChangeLog

2016-05-04  Senthil Kumar Selvaraj  <senthil_kumar.selvaraj@atmel.com>

	* testsuite/lib/binutils-common.exp (is_elf_format): Add avr-*-*.

ld/ChangeLog

2016-05-04  Senthil Kumar Selvaraj  <senthil_kumar.selvaraj@atmel.com>

	* testsuite/ld-elf/pr18735.d: Allow other symbols.
	* testsuite/ld-elf/sec64k.exp: Skip 64ksec for avr.
	* testsuite/ld-gc/pr14265.d: Allow other symbols.
	* testsuite/ld-plugin/plugin.exp: Add PR ld/17973 to
	plugin_tests only if check_shared_lib_support is true.
	* testsuite/ld-selective/selective.exp: Add --section-start
	flag for avr.
  

diff --git a/binutils/testsuite/lib/binutils-common.exp b/binutils/testsuite/lib/binutils-common.exp
index dbbbc79..cf2c77e 100644
--- a/binutils/testsuite/lib/binutils-common.exp
+++ b/binutils/testsuite/lib/binutils-common.exp
@@ -32,6 +32,7 @@ proc is_elf_format {} {
 	 && ![istarget *-*-elf*]
 	 && ![istarget *-*-eabi*]
 	 && ![istarget *-*-rtems*]
+	 && ![istarget avr-*-*]
 	 && ![istarget hppa*64*-*-hpux*]
 	 && ![istarget ia64-*-hpux*]
 	 && ![istarget *-*-linux*]
diff --git a/ld/testsuite/ld-elf/pr18735.d b/ld/testsuite/ld-elf/pr18735.d
index bc19a82..5f64818 100644
--- a/ld/testsuite/ld-elf/pr18735.d
+++ b/ld/testsuite/ld-elf/pr18735.d
@@ -6,6 +6,8 @@ Symbol table '.symtab' contains .* entries:
 [ 	]*[0-9]+: [0-9a-fA-F]* +1 +OBJECT +GLOBAL +DEFAULT +[0-9]+ +foo@FOO
 #...
 [ 	]*[0-9]+: [0-9a-fA-F]* +1 +OBJECT +GLOBAL +DEFAULT +[0-9]+ +bar@@FOO
+#...
 [ 	]*[0-9]+: [0-9a-fA-F]* +1 +OBJECT +GLOBAL +DEFAULT +[0-9]+ +foo
+#...
 [ 	]*[0-9]+: [0-9a-fA-F]* +1 +OBJECT +GLOBAL +DEFAULT +[0-9]+ +bar
 #pass
diff --git a/ld/testsuite/ld-elf/sec64k.exp b/ld/testsuite/ld-elf/sec64k.exp
index f168cff..b0e49ea 100644
--- a/ld/testsuite/ld-elf/sec64k.exp
+++ b/ld/testsuite/ld-elf/sec64k.exp
@@ -166,17 +166,15 @@ if [catch { set ofd [open "tmpdir/$test2.d" w] } x] {
     return
 }
 
-# too big for d10v and msp
+# too big for avr, d10v and msp
 # lack of fancy orphan section handling causes overlap on fr30 and iq2000
 if { ![istarget "d10v-*-*"]
+     && ![istarget "avr-*-*"]
      && ![istarget "msp*-*-*"]
      && ![istarget "fr30-*-*"] 
      && ![istarget "iq2000-*-*"] } {
     foreach sfile $sfiles { puts $ofd "#source: $sfile" }
-    if { [istarget "avr-*-*"] } then {
-	puts $ofd "#as: -mmcu=avr6"
-	puts $ofd "#ld: -mavr6"
-    } elseif { [istarget spu*-*-*] } {
+    if { [istarget spu*-*-*] } {
 	puts $ofd "#ld: --local-store 0:0"
     } else {
 	puts $ofd "#ld:"
diff --git a/ld/testsuite/ld-gc/pr14265.d b/ld/testsuite/ld-gc/pr14265.d
index f78297b..9e77ef3 100644
--- a/ld/testsuite/ld-gc/pr14265.d
+++ b/ld/testsuite/ld-gc/pr14265.d
@@ -5,7 +5,9 @@
 
 #...
 [0-9a-f]+[ 	][dD][ 	]_*foo1_start
+#...
 [0-9a-f]+[ 	]D[ 	]_*foo1
+#...
 [0-9a-f]+[ 	][dD][ 	]_*foo1_end
 [0-9a-f]+[ 	][dD][ 	]_*foo2_start
 [0-9a-f]+[ 	]D[ 	]_*foo2
diff --git a/ld/testsuite/ld-plugin/plugin.exp b/ld/testsuite/ld-plugin/plugin.exp
index a8b0e4a..5be5661 100644
--- a/ld/testsuite/ld-plugin/plugin.exp
+++ b/ld/testsuite/ld-plugin/plugin.exp
@@ -183,11 +183,15 @@ set plugin_tests [list \
     $testobjfiles $libs" "" "" "" {{ld plugin-28.d}} "main.x" ] \
     [list "plugin warning" "-plugin $plugin2_path -plugin-opt warning \
     $testobjfiles $libs" "" "" "" {{ld plugin-29.d}} "main.x" ] \
-    [list "PR ld/17973" "-plugin $plugin2_path -shared $regassilent \
-			-plugin-opt add:tmpdir/pr17973.o \
-    tmpdir/dummy.o" "" "" "" {{readelf -sW pr17973.d}} "main.x" ] \
 ]
 
+if [check_shared_lib_support] {
+    lappend plugin_tests [list "PR ld/17973" "-plugin $plugin2_path -shared $regassilent \
+                       -plugin-opt add:tmpdir/pr17973.o \
+    tmpdir/dummy.o" "" "" "" {{readelf -sW pr17973.d}} "main.x" ]
+}
+
+
 set plugin_lib_tests [list \
     [list "plugin ignore lib" "-plugin $plugin_path $regclm \
 			$regas $regcln -plugin-opt claim:tmpdir/func.o \
diff --git a/ld/testsuite/ld-selective/selective.exp b/ld/testsuite/ld-selective/selective.exp
index 0531339..367b878 100644
--- a/ld/testsuite/ld-selective/selective.exp
+++ b/ld/testsuite/ld-selective/selective.exp
@@ -64,6 +64,12 @@ if [istarget sh64*-*-elf] {
     set ldflags "-e _start -mshelf32 $ldflags"
 }
 
+if [istarget avr-*-*] {
+    # Make .text start at a non-zero address, as some tests expect
+    # valid symbols to have non-zero values.
+    set ldflags "--section-start=.text=0x2 $ldflags"
+}
+
 # If we don't have g++ for the target, mark all tests as untested.
 if { ![is_remote host] && [which $CXX] == 0 } {
     foreach testitem $seltests {



More information about the Binutils mailing list