[COMMITTED] libelf: Sync elf.h from glibc.

2018-06-21 Thread Mark Wielaard
Add NT_PPC_PKEY, R_BPF_64_64 and R_BPF_64_32. Remove R_BPF_MAP_FD.

Signed-off-by: Mark Wielaard 
---
 backends/ChangeLog | 4 
 backends/bpf_reloc.def | 1 -
 libelf/ChangeLog   | 4 
 libelf/elf.h   | 5 -
 4 files changed, 12 insertions(+), 2 deletions(-)

diff --git a/backends/ChangeLog b/backends/ChangeLog
index b34918fa..e97e33d6 100644
--- a/backends/ChangeLog
+++ b/backends/ChangeLog
@@ -1,3 +1,7 @@
+2018-06-21  Mark Wielaard  
+
+   * bpf_reloc.def: Remove MAP_FD.
+
 2018-06-13  Andreas Schwab  
 
* Makefile.am (riscv_SRCS): Add riscv_cfi.c and riscv_regs.c.
diff --git a/backends/bpf_reloc.def b/backends/bpf_reloc.def
index a410da97..09ac3a6c 100644
--- a/backends/bpf_reloc.def
+++ b/backends/bpf_reloc.def
@@ -28,4 +28,3 @@
 /* NAME,   REL|EXEC|DYN*/
 
 RELOC_TYPE (NONE,  EXEC|DYN)
-RELOC_TYPE (MAP_FD,REL|EXEC|DYN)
diff --git a/libelf/ChangeLog b/libelf/ChangeLog
index ea2b9df8..ec97caaf 100644
--- a/libelf/ChangeLog
+++ b/libelf/ChangeLog
@@ -1,3 +1,7 @@
+2018-06-21  Mark Wielaard  
+
+   * elf.h: Update from glibc.
+
 2018-04-19  Andreas Schwab  
 
* elf.h: Update from glibc.
diff --git a/libelf/elf.h b/libelf/elf.h
index f7748983..75043bcb 100644
--- a/libelf/elf.h
+++ b/libelf/elf.h
@@ -780,6 +780,8 @@ typedef struct
   Register */
 #define NT_PPC_TM_CDSCR0x10f   /* TM checkpointed Data Stream 
Control
   Register */
+#define NT_PPC_PKEY0x110   /* Memory Protection Keys
+  registers.  */
 #define NT_386_TLS 0x200   /* i386 TLS slots (struct user_desc) */
 #define NT_386_IOPERM  0x201   /* x86 io permission bitmap (1=deny) */
 #define NT_X86_XSTATE  0x202   /* x86 extended state using xsave */
@@ -3848,7 +3850,8 @@ enum
 /* BPF specific declarations.  */
 
 #define R_BPF_NONE 0   /* No reloc */
-#define R_BPF_MAP_FD   1   /* Map fd to pointer */
+#define R_BPF_64_641
+#define R_BPF_64_3210
 
 /* Imagination Meta specific relocations. */
 
-- 
2.17.0



Re: [PATCH v2] backends,bpf: add proper relocation support

2018-06-21 Thread Mark Wielaard
On Wed, Jun 20, 2018 at 07:18:22AM -0700, Yonghong Song wrote:
> On 6/20/18 4:41 AM, Mark Wielaard wrote:
> > The patch looks perfect. And the new testcase is good. I used the
> > testfile to quickly test eu-readelf --debug-dump also got the
> > relocations right, and it did of course.
> > 
> > Just waiting for the glibc elf.h update/sync and then I'll push this to
> > master.
> 
> This looks perfect. Thanks!

Pushed both. Thanks for the patch and testcase.

BTW. The following now also just works in case you have tools that
cannot handle the BPF relocations, but can handle separate .debug
files:

eu-strip --reloc-debug-sections -f testfile-bpf-reloc.o.debug \
testfile-bpf-reloc.o

That puts the debuginfo with all (simple) relocations resolved
into the .debug file.

  --reloc-debug-sections Resolve all trivial relocations between debug
 sections if the removed sections are placed in
 a debug file (only relevant for ET_REL files,
 operation is not reversable, needs -f)

This is used by some distros for the kernel .ko modules (which are
also ET_REL files) to safe space. But also might be applicable to
these BPF elf files in case they are packaged.

Cheers,

Mark


Re: [PATCH v2] backends,bpf: add proper relocation support

2018-06-21 Thread Mark Wielaard
On Thu, Jun 21, 2018 at 01:24:41PM -0700, Yonghong Song wrote:
> Don't know you release schedule, but could you cut a release
> soon so this can be picked up by dist/pahole?

I'll push a new 0.173 release next week.

We recently added DWARF5 support, but running all the new data
parsers under the afl-fuzzer found some issues (hangs and crashes
on bad data). I already backported most fixes to the Fedora package.
But it would be better to have it all in a real release. Just letting
the fuzzer run for a couple more days to make sure we caught everything.

As long as the buildbot https://builder.wildebeest.org/buildbot/
keeps green on all arches, we should be good to go for a new release.

Cheers,

Mark