+2020-08-03  Alan Modra  <amodra@gmail.com>
+
+       * 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.
+
 2020-07-31  H.J. Lu  <hongjiu.lu@intel.com>
 
        * testsuite/ld-elf/indirect.exp: Append -fno-lto to CC.
 
        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 {
            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 {
            verbose -log "Line count"
            return 0
        }
+       return 1
 
-       if $differences<1 then {
-           return 1
-       }
-
-       return 0
     } else {
        verbose -log "$exec_output"
        return 0
     }
-
 }
 
 #
        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 {
        }
        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]
 
            verbose -log "Line count"
            return 0
        }
+       return 1
 
-       if $differences<1 then {
-           return 1
-       }
-
-       return 0
     } else {
        verbose -log "$exec_output"
        return 0
     }
-
 }
 
 #
 
        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 {
            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 {
            verbose -log "Line count"
            return 0
        }
+       return 1
 
-       if $differences<1 then {
-           return 1
-       }
-
-       return 0
     } else {
        verbose -log "$exec_output"
        return 0
     }
-
 }
 
 #
        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 {
            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} {