diff options
author | Jose E. Marchesi <jose.marchesi@oracle.com> | 2019-05-23 19:05:42 +0200 |
---|---|---|
committer | Jose E. Marchesi <jose.marchesi@oracle.com> | 2019-05-23 19:34:15 +0200 |
commit | 8376927b2cc8b80cd5aa1e48aabafc85c0ad4f3e (patch) | |
tree | ea438d902286e53cdacd4ff6a5bd29ebf9bd5fea /ld/testsuite | |
parent | f8861f5dc2391e0c46dd118370195e7730ec46ca (diff) | |
download | gdb-8376927b2cc8b80cd5aa1e48aabafc85c0ad4f3e.zip gdb-8376927b2cc8b80cd5aa1e48aabafc85c0ad4f3e.tar.gz gdb-8376927b2cc8b80cd5aa1e48aabafc85c0ad4f3e.tar.bz2 |
ld: add support for eBPF
This patch adds support to the linker for the Linux eBPF architecture.
A minimal testsuite is included.
ld/ChangeLog:
2019-05-23 Jose E. Marchesi <jose.marchesi@oracle.com>
* Makefile.am (ALL_64_EMULATION_SOURCES): Add eelf64bpf.c.
* Makefile.in (prefix): Regenerate.
* configure.tgt (targ_extra_ofiles): Add case for bpf-*-* targets.
* emulparams/elf64bpf.sh: New file.
* testsuite/lib/ld-lib.exp (check_gc_sections_available): Add
bpf-*-* to the list of targets not supporting gc-sections.
* testsuite/ld-bpf/bar.s: New file.
* testsuite/ld-bpf/jump-1.d: Likewise.
* testsuite/ld-bpf/foo.s: Likewise.
* testsuite/ld-bpf/call-1.d: Likewise.
* testsuite/ld-bpf/bpf.exp: Likewise.
* testsuite/ld-bpf/baz.s: Likewise.
Diffstat (limited to 'ld/testsuite')
-rw-r--r-- | ld/testsuite/ld-bpf/bar.s | 5 | ||||
-rw-r--r-- | ld/testsuite/ld-bpf/baz.s | 5 | ||||
-rw-r--r-- | ld/testsuite/ld-bpf/bpf.exp | 29 | ||||
-rw-r--r-- | ld/testsuite/ld-bpf/call-1.d | 23 | ||||
-rw-r--r-- | ld/testsuite/ld-bpf/foo.s | 5 | ||||
-rw-r--r-- | ld/testsuite/ld-bpf/jump-1.d | 23 | ||||
-rw-r--r-- | ld/testsuite/lib/ld-lib.exp | 1 |
7 files changed, 91 insertions, 0 deletions
diff --git a/ld/testsuite/ld-bpf/bar.s b/ld/testsuite/ld-bpf/bar.s new file mode 100644 index 0000000..b577d87 --- /dev/null +++ b/ld/testsuite/ld-bpf/bar.s @@ -0,0 +1,5 @@ + .global bar +bar: + mov %r1,%r2 + mov %r3,%r1 + exit diff --git a/ld/testsuite/ld-bpf/baz.s b/ld/testsuite/ld-bpf/baz.s new file mode 100644 index 0000000..2e159a8 --- /dev/null +++ b/ld/testsuite/ld-bpf/baz.s @@ -0,0 +1,5 @@ + mov %r1,1 + mov %r2,2 + mov %r3,3 + ja bar + exit diff --git a/ld/testsuite/ld-bpf/bpf.exp b/ld/testsuite/ld-bpf/bpf.exp new file mode 100644 index 0000000..02b2e03 --- /dev/null +++ b/ld/testsuite/ld-bpf/bpf.exp @@ -0,0 +1,29 @@ +# Copyright (C) 2019 Free Software Foundation, Inc. +# +# This file is part of the GNU Binutils. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, +# MA 02110-1301, USA. +# + +if { ![istarget bpf*-*-*] } { + return +} + +set bpf_test_list [lsort [glob -nocomplain $srcdir/$subdir/*.d]] +foreach bpf_test $bpf_test_list { + verbose [file rootname $bpf_test] + run_dump_test [file rootname $bpf_test] +} diff --git a/ld/testsuite/ld-bpf/call-1.d b/ld/testsuite/ld-bpf/call-1.d new file mode 100644 index 0000000..f408cd4 --- /dev/null +++ b/ld/testsuite/ld-bpf/call-1.d @@ -0,0 +1,23 @@ +#as: --EL +#source: foo.s +#source: bar.s +#objdump: -dr +#ld: -EL +#warning: .*cannot find entry symbol _start.* +#name: CALL with disp32 reloc + +.*: +file format .*bpf.* + +Disassembly of section .text: + +[0-9a-f]+ <.*>: + *[0-9a-f]+: b7 01 00 00 01 00 00 00 mov %r1,1 + *[0-9a-f]+: b7 02 00 00 02 00 00 00 mov %r2,2 + *[0-9a-f]+: b7 03 00 00 03 00 00 00 mov %r3,3 + *[0-9a-f]+: 85 10 00 00 01 00 00 00 call 1 + *[0-9a-f]+: 95 00 00 00 00 00 00 00 exit + +[0-9a-f]+ <bar>: + *[0-9a-f]+: bf 21 00 00 00 00 00 00 mov %r1,%r2 + *[0-9a-f]+: bf 13 00 00 00 00 00 00 mov %r3,%r1 + *[0-9a-f]+: 95 00 00 00 00 00 00 00 exit diff --git a/ld/testsuite/ld-bpf/foo.s b/ld/testsuite/ld-bpf/foo.s new file mode 100644 index 0000000..0958bbf --- /dev/null +++ b/ld/testsuite/ld-bpf/foo.s @@ -0,0 +1,5 @@ + mov %r1,1 + mov %r2,2 + mov %r3,3 + call bar + exit diff --git a/ld/testsuite/ld-bpf/jump-1.d b/ld/testsuite/ld-bpf/jump-1.d new file mode 100644 index 0000000..b57bcf1 --- /dev/null +++ b/ld/testsuite/ld-bpf/jump-1.d @@ -0,0 +1,23 @@ +#as: --EL +#source: baz.s +#source: bar.s +#objdump: -dr +#ld: -EL +#warning: .*cannot find entry symbol _start.* +#name: jump with disp16 reloc + +.*: +file format .*bpf.* + +Disassembly of section .text: + +[0-9a-f]+ <.*>: + *[0-9a-f]+: b7 01 00 00 01 00 00 00 mov %r1,1 + *[0-9a-f]+: b7 02 00 00 02 00 00 00 mov %r2,2 + *[0-9a-f]+: b7 03 00 00 03 00 00 00 mov %r3,3 + *[0-9a-f]+: 05 00 01 00 00 00 00 00 ja 1 + *[0-9a-f]+: 95 00 00 00 00 00 00 00 exit + +[0-9a-f]+ <bar>: + *[0-9a-f]+: bf 21 00 00 00 00 00 00 mov %r1,%r2 + *[0-9a-f]+: bf 13 00 00 00 00 00 00 mov %r3,%r1 + *[0-9a-f]+: 95 00 00 00 00 00 00 00 exit diff --git a/ld/testsuite/lib/ld-lib.exp b/ld/testsuite/lib/ld-lib.exp index 0ff51c9..5ebb7fa 100644 --- a/ld/testsuite/lib/ld-lib.exp +++ b/ld/testsuite/lib/ld-lib.exp @@ -1045,6 +1045,7 @@ proc check_gc_sections_available { } { # Some targets don't support gc-sections despite whatever's # advertised by ld's options. if { [istarget alpha-*-*] + || [istarget bpf-*-*] || [istarget d30v-*-*] || [istarget dlx-*-*] || [istarget hppa*64-*-*] |