Tidy objdump_symstuff and objdump_dynsymstuff
Alan Modra
amodra@gmail.com
Mon Aug 3 07:37:25 GMT 2020
At one stage when running an -flto build, I hit a tcl error
complaining about a non-existent list_b. This patch fixes that
problem.
* testsuite/ld-elfvers/vers.exp (objdump_symstuff): Remove unused
variable. Init list_a and list_b to empty.
(objdump_dynsymstuff): Likewise, and remove undefined list_a
handling.
* testsuite/ld-elfweak/elfweak.exp (objdump_symstuff): Similarly.
(objdump_dynsymstuff): Similarly.
diff --git a/ld/testsuite/ld-elfvers/vers.exp b/ld/testsuite/ld-elfvers/vers.exp
index 299cdaaae2..0216b13b6e 100644
--- a/ld/testsuite/ld-elfvers/vers.exp
+++ b/ld/testsuite/ld-elfvers/vers.exp
@@ -261,7 +261,8 @@ proc objdump_symstuff { objdump object expectfile } {
verbose "# Diff'ing: $expectfile $tmpdir/objdump.out" 2
set eof -1
- set differences 0
+ set list_a {}
+ set list_b {}
while { [gets $file_a line] != $eof } {
if [regexp "^#.*$" $line] then {
@@ -286,7 +287,6 @@ proc objdump_symstuff { objdump object expectfile } {
set line_a [lindex $list_a $i]
set line_b [lindex $list_b $i]
-
verbose "\t$expectfile: $i: $line_a" 3
verbose "\t/tmp/objdump.out: $i: $line_b" 3
if [regexp $line_a $line_b] then {
@@ -303,17 +303,12 @@ proc objdump_symstuff { objdump object expectfile } {
verbose -log "Line count"
return 0
}
+ return 1
- if $differences<1 then {
- return 1
- }
-
- return 0
} else {
verbose -log "$exec_output"
return 0
}
-
}
#
@@ -357,7 +352,8 @@ proc objdump_dynsymstuff { objdump object expectfile } {
verbose "# Diff'ing: $expectfile $tmpdir/objdump.out" 2
set eof -1
- set differences 0
+ set list_a {}
+ set list_b {}
while { [gets $file_a line] != $eof } {
if [regexp "^#.*$" $line] then {
@@ -378,15 +374,6 @@ proc objdump_dynsymstuff { objdump object expectfile } {
}
close $file_b
- # Support empty files.
- if { ![info exists list_a] } then {
- if { ![info exists list_b] } then {
- return 1
- }
- verbose -log "\t$tmpdir/objdump.out: $list_b"
- return 0
- }
-
for { set i 0 } { $i < [llength $list_b] } { incr i } {
set line_b [lindex $list_b $i]
@@ -423,17 +410,12 @@ proc objdump_dynsymstuff { objdump object expectfile } {
verbose -log "Line count"
return 0
}
+ return 1
- if $differences<1 then {
- return 1
- }
-
- return 0
} else {
verbose -log "$exec_output"
return 0
}
-
}
#
diff --git a/ld/testsuite/ld-elfweak/elfweak.exp b/ld/testsuite/ld-elfweak/elfweak.exp
index 85da211e80..3481878014 100644
--- a/ld/testsuite/ld-elfweak/elfweak.exp
+++ b/ld/testsuite/ld-elfweak/elfweak.exp
@@ -103,7 +103,8 @@ proc objdump_symstuff { objdump object expectfile } {
verbose "# Diff'ing: $expectfile $tmpdir/objdump.out" 2
set eof -1
- set differences 0
+ set list_a {}
+ set list_b {}
while { [gets $file_a line] != $eof } {
if [regexp "^#.*$" $line] then {
@@ -128,7 +129,6 @@ proc objdump_symstuff { objdump object expectfile } {
set line_a [lindex $list_a $i]
set line_b [lindex $list_b $i]
-
verbose "\t$expectfile: $i: $line_a" 3
verbose "\t/tmp/objdump.out: $i: $line_b" 3
if [regexp $line_a $line_b] then {
@@ -145,17 +145,12 @@ proc objdump_symstuff { objdump object expectfile } {
verbose -log "Line count"
return 0
}
+ return 1
- if $differences<1 then {
- return 1
- }
-
- return 0
} else {
verbose -log "$exec_output"
return 0
}
-
}
#
@@ -199,7 +194,8 @@ proc objdump_dynsymstuff { objdump object expectfile } {
verbose "# Diff'ing: $expectfile $tmpdir/objdump.out" 2
set eof -1
- set differences 0
+ set list_a {}
+ set list_b {}
while { [gets $file_a line] != $eof } {
if [regexp "^#.*$" $line] then {
@@ -256,17 +252,12 @@ proc objdump_dynsymstuff { objdump object expectfile } {
verbose -log "Line count"
return 0
}
+ return 1
- if $differences<1 then {
- return 1
- }
-
- return 0
} else {
verbose -log "$exec_output"
return 0
}
-
}
proc build_lib {test libname objs dynsymexp} {
--
Alan Modra
Australia Development Lab, IBM
More information about the Binutils
mailing list