summaryrefslogtreecommitdiff
path: root/ld/testsuite
diff options
context:
space:
mode:
authorJose E. Marchesi <jose.marchesi@oracle.com>2019-08-07 11:40:55 +0200
committerJose E. Marchesi <jose.marchesi@oracle.com>2019-08-07 13:57:30 +0200
commitfca8e23c31e6ec37bdcb5cf1d981a39d1e6fb6f6 (patch)
tree479748460853db0e6bd2bc62f6c80049c6b77c2e /ld/testsuite
parentfc8de8e227e5146336d654f2fb4f98010d7cf12d (diff)
downloadbinutils-gdb-fca8e23c31e6ec37bdcb5cf1d981a39d1e6fb6f6.tar.gz
ld: use a specific linker script in BPF targets
This patch makes the elf64bpf emulation to use it's own linker script, based on elf.sc. At the moment, the only change is that the BPF executable doesn't define an entry symbol (BPF programs feature several entry points scattered in several sections.) This is a step towards the goal of generating proper ELF executables that would be loaded by the kernel's libbpf. We are not there yet: BPF "programs" should still be linked with -r. This change removes a warning while linking executables, decreases the number of unsupported tests in the target from 47 to 29, and increases the number of expected passes from 104 to 145. Regtested in x86_64 for all targets. No regressions. ld/ChangeLog: 2019-08-07 Jose E. Marchesi <jose.marchesi@oracle.com> * scripttempl/elf64bpf.sc: Adapted from elf.sc. * emulparams/elf64bpf.sh (SCRIPT_NAME): Use elf64bpf. (EMBEDDED): Define. * testsuite/ld-bpf/call-1.d: Do not expect a warning regarding an undefined entry symbol. * testsuite/ld-bpf/jump-1.d: Likewise. * testsuite/ld-undefined/undefined.exp: Do not pass '-e entry' to ld in BPF targets, and do not expect line number information. * testsuite/ld-srec/srec.exp (run_srec_test): xfail s-record tests in BPF targets.
Diffstat (limited to 'ld/testsuite')
-rw-r--r--ld/testsuite/ld-bpf/call-1.d1
-rw-r--r--ld/testsuite/ld-bpf/jump-1.d1
-rw-r--r--ld/testsuite/ld-srec/srec.exp4
-rw-r--r--ld/testsuite/ld-undefined/undefined.exp14
4 files changed, 15 insertions, 5 deletions
diff --git a/ld/testsuite/ld-bpf/call-1.d b/ld/testsuite/ld-bpf/call-1.d
index f408cd4db9b..d44c14e9246 100644
--- a/ld/testsuite/ld-bpf/call-1.d
+++ b/ld/testsuite/ld-bpf/call-1.d
@@ -3,7 +3,6 @@
#source: bar.s
#objdump: -dr
#ld: -EL
-#warning: .*cannot find entry symbol _start.*
#name: CALL with disp32 reloc
.*: +file format .*bpf.*
diff --git a/ld/testsuite/ld-bpf/jump-1.d b/ld/testsuite/ld-bpf/jump-1.d
index b57bcf1f409..0e3de4edc7b 100644
--- a/ld/testsuite/ld-bpf/jump-1.d
+++ b/ld/testsuite/ld-bpf/jump-1.d
@@ -3,7 +3,6 @@
#source: bar.s
#objdump: -dr
#ld: -EL
-#warning: .*cannot find entry symbol _start.*
#name: jump with disp16 reloc
.*: +file format .*bpf.*
diff --git a/ld/testsuite/ld-srec/srec.exp b/ld/testsuite/ld-srec/srec.exp
index 944e0a71567..17d4bc465d4 100644
--- a/ld/testsuite/ld-srec/srec.exp
+++ b/ld/testsuite/ld-srec/srec.exp
@@ -428,6 +428,9 @@ setup_xfail "tile*-*-*"
# The S-record linker is not supported for C-SKY.
setup_xfail "csky*-*-*"
+# The S-record linker is not supported for eBPF.
+setup_xfail "bpf-*-*"
+
run_srec_test $test1 "tmpdir/sr1.o tmpdir/sr2.o"
# Now try linking a C++ program with global constructors and
@@ -464,6 +467,7 @@ setup_xfail "score-*-*"
setup_xfail "bfin-*-linux-uclibc"
setup_xfail "tile*-*-*"
setup_xfail "csky*-*-*"
+setup_xfail "bpf-*-*"
run_srec_test $test2 "tmpdir/sr3.o"
diff --git a/ld/testsuite/ld-undefined/undefined.exp b/ld/testsuite/ld-undefined/undefined.exp
index 8a8e8655910..958623f3a9c 100644
--- a/ld/testsuite/ld-undefined/undefined.exp
+++ b/ld/testsuite/ld-undefined/undefined.exp
@@ -40,9 +40,14 @@ if { ![check_compiler_available] } {
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"
@@ -142,6 +147,9 @@ if { ![check_compiler_available] } {
setup_xfail xtensa*-*-linux*
setup_xfail hppa*64*-*-*
+ # eBPF doesn't support dwarf yet.
+ setup_xfail bpf-*-*
+
checkund $ml $testline
}