# Test that the linker reports undefined symbol errors correctly.
# By Ian Lance Taylor, Cygnus Support
#
-# Copyright (C) 1995-2018 Free Software Foundation, Inc.
+# Copyright (C) 1995-2021 Free Software Foundation, Inc.
#
# This file is part of the GNU Binutils.
#
set testfn "undefined function"
set testline "undefined line"
-if { ![is_remote host] && [which $CC] == 0 } {
+if { ![check_compiler_available] } {
verbose "Could not find C compiler!" 1
untested $testund
untested $testfn
untested $testline
-} elseif { ![ld_compile "$CC -g" $srcdir/$subdir/undefined.c tmpdir/undefined.o] } {
+} elseif { ![ld_compile "$CC -g $NOLTO_CFLAGS" $srcdir/$subdir/undefined.c tmpdir/undefined.o] } {
verbose "Unable to compile test file!" 1
unresolved $testund
unresolved $testfn
set flags [big_or_little_endian]
# Using -e start prevents the SunOS linker from trying to build a
- # shared library.
- send_log "$ld -e start $flags -o tmpdir/undefined tmpdir/undefined.o\n"
- set exec_output [run_host_cmd "$ld" "-e start $flags -o tmpdir/undefined tmpdir/undefined.o"]
+ # shared library. But don't use an entry point in BPF targets.
+ switch -glob $target_triplet {
+ bpf-*-* { set entry "" }
+ * { set entry "-e start" }
+ }
+
+ send_log "$ld $entry $flags -o tmpdir/undefined tmpdir/undefined.o\n"
+ set exec_output [run_host_cmd "$ld" "$entry $flags -o tmpdir/undefined tmpdir/undefined.o"]
send_log "$exec_output\n"
verbose "$exec_output"
setup_xfail mcore-*-elf
setup_xfail mep-*-*
setup_xfail mips-sgi-irix6*
- setup_xfail "sh64-*-*"
# Fails for the MSP430 because it uses SYM_DIFF relocs but it does
# not provide a special_function for handling them. If
# optimization is enabled then this test passes because
setup_xfail xtensa*-*-linux*
setup_xfail hppa*64*-*-*
+ # eBPF doesn't support dwarf yet.
+ setup_xfail bpf-*-*
+
checkund $ml $testline
}