This is the mail archive of the binutils-cvs@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[binutils-gdb] binutils: add support for eBPF


https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=aca4efc7a4fc42bac5b7b029c52cbb2a2bc2574b

commit aca4efc7a4fc42bac5b7b029c52cbb2a2bc2574b
Author: Jose E. Marchesi <jose.marchesi@oracle.com>
Date:   Thu May 23 19:06:17 2019 +0200

    binutils: add support for eBPF
    
    This patch adds support for ELF64 eBPF to readelf, and fixes a `nm'
    test to run properly in bpf-*-* targets.
    
    binutils/ChangeLog:
    
    2019-05-23  Jose E. Marchesi  <jose.marchesi@oracle.com>
    
    	* readelf.c: Include elf/bpf.h.
    	(guess_is_rela): Hanle EM_BPF.
    	(dump_relocations): Likewise.
    	(is_32bit_abs_reloc): Likewise.
    	* testsuite/binutils-all/nm.exp: Add bpf-*-* to the list of
    	ELF targets.

Diff:
---
 binutils/ChangeLog                     | 9 +++++++++
 binutils/readelf.c                     | 8 ++++++++
 binutils/testsuite/binutils-all/nm.exp | 3 ++-
 3 files changed, 19 insertions(+), 1 deletion(-)

diff --git a/binutils/ChangeLog b/binutils/ChangeLog
index 9905cf6..046d612 100644
--- a/binutils/ChangeLog
+++ b/binutils/ChangeLog
@@ -1,3 +1,12 @@
+2019-05-23  Jose E. Marchesi  <jose.marchesi@oracle.com>
+
+	* readelf.c: Include elf/bpf.h.
+	(guess_is_rela): Hanle EM_BPF.
+	(dump_relocations): Likewise.
+	(is_32bit_abs_reloc): Likewise.
+	* testsuite/binutils-all/nm.exp: Add bpf-*-* to the list of
+	ELF targets.
+
 2019-05-21  Tamar Christina  <tamar.christina@arm.com>
 
 	* dwarf.c (dwarf_regnames_aarch64): Add SVE registers.
diff --git a/binutils/readelf.c b/binutils/readelf.c
index c31a5c1..9d28104 100644
--- a/binutils/readelf.c
+++ b/binutils/readelf.c
@@ -102,6 +102,7 @@
 #include "elf/d10v.h"
 #include "elf/d30v.h"
 #include "elf/dlx.h"
+#include "elf/bpf.h"
 #include "elf/epiphany.h"
 #include "elf/fr30.h"
 #include "elf/frv.h"
@@ -781,6 +782,7 @@ guess_is_rela (unsigned int e_machine)
     case EM_SCORE:
     case EM_XGATE:
     case EM_NFP:
+    case EM_BPF:
       return FALSE;
 
       /* Targets that use RELA relocations.  */
@@ -1482,6 +1484,10 @@ dump_relocations (Filedata *          filedata,
 	  rtype = elf_visium_reloc_type (type);
 	  break;
 
+        case EM_BPF:
+          rtype = elf_bpf_reloc_type (type);
+          break;
+
 	case EM_ADAPTEVA_EPIPHANY:
 	  rtype = elf_epiphany_reloc_type (type);
 	  break;
@@ -12410,6 +12416,8 @@ is_32bit_abs_reloc (Filedata * filedata, unsigned int reloc_type)
     case EM_AARCH64:
       return (reloc_type == 258
 	      || reloc_type == 1); /* R_AARCH64_ABS32 || R_AARCH64_P32_ABS32 */
+    case EM_BPF:
+      return reloc_type == 11; /* R_BPF_DATA_32 */
     case EM_ADAPTEVA_EPIPHANY:
       return reloc_type == 3;
     case EM_ALPHA:
diff --git a/binutils/testsuite/binutils-all/nm.exp b/binutils/testsuite/binutils-all/nm.exp
index 64a969e..5dbdcbf 100644
--- a/binutils/testsuite/binutils-all/nm.exp
+++ b/binutils/testsuite/binutils-all/nm.exp
@@ -160,7 +160,8 @@ if {   [is_elf_format]
     || [istarget *-*-uclinux*]
     || [istarget ia64-*-*vms*]
     || [istarget *-*-vxworks*]
-    || [istarget wasm32-*-*] } {
+    || [istarget wasm32-*-*]
+    || [istarget bpf-*-*]} {
     set nm_1_src "nm-elf-1.s"
 } else {
     set nm_1_src "nm-1.s"


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]