+2020-06-10 Alan Modra <amodra@gmail.com>
+
+ * testsuite/ld-elf/linux-x86.exp: Build tests when non-native.
+ (check_pr25749b): Add optional args. Set expected pass file
+ from args. Run -1b and -2a tests with passall.out.
+ * testsuite/ld-elf/passall.out: New file.
+ * testsuite/ld-elf/pr25749-1.c: Adjust to pass with older glibc.
+ * testsuite/ld-elf/pr25749-2.c: Likewise.
+ * testsuite/lib/ld-lib.exp (run_ld_link_exec_tests): Use
+ regexp_diff to compare expected output from running binary.
+
2020-06-10 H.J. Lu <hongjiu.lu@intel.com>
PR ld/26094
]
# Test very simple native Linux/x86 programs with linux-x86.S.
-if { ![isnative] || ![check_compiler_available] } {
- return
-}
-
run_ld_link_exec_tests [list \
[list \
"Run PR ld/23428 test" \
}
}
-proc check_pr25749b {testname srcfilea srcfileb cflags ldflags dsoldflags} {
+proc check_pr25749b {testname srcfilea srcfileb cflags ldflags dsoldflags args} {
global objcopy
global srcdir
global subdir
"lib${testname}.so" \
] \
]
+
+ set pass "pass.out"
+ if { [llength $args] > 0 } {
+ set pass [lindex $args 0]
+ }
+
run_ld_link_exec_tests [list \
[list \
"Run ${testname}b ($ldflags $cflags)" \
"" \
[list $srcfilea]\
"${testname}b" \
- "pass.out" \
+ "$pass" \
"$cflags -I../bfd" \
] \
]
check_pr25749b "pr25749-1a" "pr25749-1.c" "pr25749-1a.c" "$NOPIE_CFLAGS" "$NOPIE_LDFLAGS" ""
check_pr25749b "pr25749-1a" "pr25749-1.c" "pr25749-1a.c" "-fPIE" "-pie" ""
check_pr25749b "pr25749-1a" "pr25749-1.c" "pr25749-1a.c" "-fPIE" "-pie" "-Wl,-Bsymbolic"
-check_pr25749b "pr25749-1b" "pr25749-1.c" "pr25749-1b.c" "$NOPIE_CFLAGS" "$NOPIE_LDFLAGS" ""
-check_pr25749b "pr25749-1b" "pr25749-1.c" "pr25749-1b.c" "-fPIE" "-pie" ""
+check_pr25749b "pr25749-1b" "pr25749-1.c" "pr25749-1b.c" "$NOPIE_CFLAGS" "$NOPIE_LDFLAGS" "" "passall.out"
+check_pr25749b "pr25749-1b" "pr25749-1.c" "pr25749-1b.c" "-fPIE" "-pie" "" "passall.out"
check_pr25749b "pr25749-1b" "pr25749-1.c" "pr25749-1b.c" "-fPIE" "-pie" "-Wl,-Bsymbolic"
check_pr25749b "pr25749-1d" "pr25749-1.c" "pr25749-1d.c" "$NOPIE_CFLAGS" "$NOPIE_LDFLAGS" "-Wl,-defsym=_begin=0"
check_pr25749b "pr25749-1d" "pr25749-1.c" "pr25749-1d.c" "-fPIE" "-pie" "-Wl,-defsym=_begin=0"
check_pr25749b "pr25749-1d" "pr25749-1.c" "pr25749-1d.c" "-fPIE" "-pie" "-Wl,-Bsymbolic -Wl,-defsym=_begin=0"
-check_pr25749b "pr25749-2a" "pr25749-2.c" "pr25749-2a.s" "$NOPIE_CFLAGS" "$NOPIE_LDFLAGS" ""
-check_pr25749b "pr25749-2a" "pr25749-2.c" "pr25749-2a.s" "-fPIE" "-pie" ""
+check_pr25749b "pr25749-2a" "pr25749-2.c" "pr25749-2a.s" "$NOPIE_CFLAGS" "$NOPIE_LDFLAGS" "" "passall.out"
+check_pr25749b "pr25749-2a" "pr25749-2.c" "pr25749-2a.s" "-fPIE" "-pie" "" "passall.out"
check_pr25749b "pr25749-2b" "pr25749-2.c" "pr25749-2b.s" "$NOPIE_CFLAGS" "$NOPIE_LDFLAGS" ""
check_pr25749b "pr25749-2b" "pr25749-2.c" "pr25749-2b.s" "-fPIE" "-pie" ""
verbose "$exec_output" 1
set failed 1
} else {
- send_log "diff $binfile.out $srcdir/$subdir/$expfile\n"
- verbose "diff $binfile.out $srcdir/$subdir/$expfile"
- catch "exec diff $binfile.out $srcdir/$subdir/$expfile" exec_output
- set exec_output [prune_warnings $exec_output]
-
- if ![string match "" $exec_output] then {
- send_log "$exec_output\n"
- verbose "$exec_output" 1
+ send_log [file_contents $binfile.out]
+ verbose [file_contents $binfile.out] 2
+ if [regexp_diff "$binfile.out" "$srcdir/$subdir/$expfile"] {
set failed 1
}
}