[PATCH] libdwelf: Add dwelf_elf_e_machine_string and use it in readelf.

2019-06-28 Thread Mark Wielaard
To print eh human readable description of the ELF e_machine header field
we used the ebl name. But this is not set for most EM constants. Introduce
a new function dwelf_elf_e_machine_string that does work for all known
EM values. Use that in eu-readelf to print a string representation of the
e_machine value.

Since this was the only usage of ebl->name, remove that from struct ebl.

Also add a testcase that makes sure dwelf_elf_e_machine_string works for
all EM values in the libelf/elf.h header so we will immediately notice
when a new value appears.

Signed-off-by: Mark Wielaard 
---
 backends/ChangeLog  |  18 ++
 backends/aarch64_init.c |   1 -
 backends/alpha_init.c   |   1 -
 backends/arm_init.c |   1 -
 backends/bpf_init.c |   1 -
 backends/i386_init.c|   1 -
 backends/ia64_init.c|   1 -
 backends/m68k_init.c|   1 -
 backends/ppc64_init.c   |   1 -
 backends/ppc_init.c |   1 -
 backends/riscv_init.c   |   1 -
 backends/s390_init.c|   1 -
 backends/sh_init.c  |   1 -
 backends/sparc_init.c   |   6 -
 backends/tilegx_init.c  |   1 -
 backends/x86_64_init.c  |   1 -
 libdw/ChangeLog |   5 +
 libdw/libdw.map |   7 +-
 libdwelf/ChangeLog  |   6 +
 libdwelf/Makefile.am|   3 +-
 libdwelf/dwelf_elf_e_machine_string.c   | 406 
 libdwelf/libdwelf.h |   4 +
 libebl/ChangeLog|   6 +
 libebl/eblopenbackend.c |   3 -
 libebl/libeblP.h|   3 -
 src/ChangeLog   |   5 +
 src/readelf.c   |   7 +-
 tests/ChangeLog |   9 +
 tests/Makefile.am   |  11 +-
 tests/dwelf_elf_e_machine_string.c  |  64 +
 tests/run-dwelf_elf_e_machine_string.sh |  31 +++
 31 files changed, 576 insertions(+), 32 deletions(-)
 create mode 100644 libdwelf/dwelf_elf_e_machine_string.c
 create mode 100644 tests/dwelf_elf_e_machine_string.c
 create mode 100755 tests/run-dwelf_elf_e_machine_string.sh

diff --git a/backends/ChangeLog b/backends/ChangeLog
index 6c2b47a..af1a40e 100644
--- a/backends/ChangeLog
+++ b/backends/ChangeLog
@@ -1,3 +1,21 @@
+2019-06-28  Mark Wielaard  
+
+   * aarch64_init.c (aarch64_init.c): Remove eh->name;
+   * alpha_init.c (alpha_init.c): Remove eh->name;
+   * arm_init.c (arm_init.c): Remove eh->name;
+   * bpf_init.c (bpf_init.c): Remove eh->name;
+   * i386_init.c (i386_init.c): Remove eh->name;
+   * ia64_init.c (ia64_init.c): Remove eh->name;
+   * m68k_init.c (m68k_init.c): Remove eh->name;
+   * ppc64_init.c (ppc64_init.c): Remove eh->name;
+   * ppc_init.c (ppc_init.c): Remove eh->name;
+   * riscv_init.c (riscv_init.c): Remove eh->name;
+   * s390_init.c (s390_init.c): Remove eh->name;
+   * sh_init.c (sh_init.c): Remove eh->name;
+   * sparc_init.c (sparc_init.c): Remove eh->name;
+   * tilegx_init.c (tilegx_init.c): Remove eh->name;
+   * x86_64_init.c (x86_64_init.c): Remove eh->name;
+
 2019-04-14  Mark Wielaard  
 
* riscv_cfi.c: Fix BACKEND define.
diff --git a/backends/aarch64_init.c b/backends/aarch64_init.c
index fad923f..95268ae 100644
--- a/backends/aarch64_init.c
+++ b/backends/aarch64_init.c
@@ -49,7 +49,6 @@ aarch64_init (Elf *elf __attribute__ ((unused)),
 return NULL;
 
   /* We handle it.  */
-  eh->name = "AARCH64";
   aarch64_init_reloc (eh);
   HOOK (eh, register_info);
   HOOK (eh, core_note);
diff --git a/backends/alpha_init.c b/backends/alpha_init.c
index 25c5b32..f66f40c 100644
--- a/backends/alpha_init.c
+++ b/backends/alpha_init.c
@@ -50,7 +50,6 @@ alpha_init (Elf *elf __attribute__ ((unused)),
 return NULL;
 
   /* We handle it.  */
-  eh->name = "Alpha";
   alpha_init_reloc (eh);
   HOOK (eh, dynamic_tag_name);
   HOOK (eh, dynamic_tag_check);
diff --git a/backends/arm_init.c b/backends/arm_init.c
index f2b1b11..af023f0 100644
--- a/backends/arm_init.c
+++ b/backends/arm_init.c
@@ -50,7 +50,6 @@ arm_init (Elf *elf __attribute__ ((unused)),
 return NULL;
 
   /* We handle it.  */
-  eh->name = "ARM";
   arm_init_reloc (eh);
   HOOK (eh, segment_type_name);
   HOOK (eh, section_type_name);
diff --git a/backends/bpf_init.c b/backends/bpf_init.c
index a046e06..d407d37 100644
--- a/backends/bpf_init.c
+++ b/backends/bpf_init.c
@@ -49,7 +49,6 @@ bpf_init (Elf *elf __attribute__ ((unused)),
 return NULL;
 
   /* We handle it.  */
-  eh->name = "BPF";
   bpf_init_reloc (eh);
   HOOK (eh, register_info);
   HOOK (eh, disasm);
diff --git a/backends/i386_init.c b/backends/i386_init.c
index fc1587a..67428b5 100644
--- a/backends/i386_

Re: [PATCH] libelf: Fix some 32bit offset/size issues that break updating 4G+ files.

2019-06-28 Thread Mark Wielaard
Hi,

I pushed this to master with the changes suggested by Dmitry.

Thanks,

Mark


Buildbot failure in Wildebeest Builder on whole buildset

2019-06-28 Thread buildbot
The Buildbot has detected a failed build on builder whole buildset while 
building elfutils.
Full details are available at:
https://builder.wildebeest.org/buildbot/#builders/1/builds/376

Buildbot URL: https://builder.wildebeest.org/buildbot/

Worker for this Build: centos-x86_64

Build Reason: 
Blamelist: Mark Wielaard 

BUILD FAILED: failed test (failure)

Sincerely,
 -The Buildbot



Re: Buildbot failure in Wildebeest Builder on whole buildset

2019-06-28 Thread Mark Wielaard
On Fri, Jun 28, 2019 at 11:02:02PM +, build...@builder.wildebeest.org wrote:
> The Buildbot has detected a failed build on builder whole buildset while 
> building elfutils.
> Full details are available at:
> https://builder.wildebeest.org/buildbot/#builders/1/builds/376
> 
> Buildbot URL: https://builder.wildebeest.org/buildbot/
> 
> Worker for this Build: centos-x86_64

The test-suite.log says:

FAIL: run-large-elf-file.sh
===

long_bit: 64
space_available: 38
mem_available: 7
1024+0 records in
1024+0 records out
1073741824 bytes (1.1 GB) copied, 3.72662 s, 288 MB/s
addsections 2 testfile38 2147483648
add_sections 'testfile38': 2 (sec_size: 2147483648)
setshstrndx: 10
strip -o testfile38.strip -f testfile38.debug testfile38
elflint --gnu testfile38.strip
No errors
elflint --gnu -d testfile38.debug
No errors
unstrip testfile38.strip testfile38.debug
elfcmp  testfile38.strip
addsections 2 testfile27 2147483648
add_sections 'testfile27': 2 (sec_size: 2147483648)
setshstrndx: 30
strip -o testfile27.strip -f testfile27.debug testfile27
/srv/buildbot/worker/elfutils-centos-x86_64/build/elfutils-0.176/_build/src/strip:
 while writing 'testfile27.debug.SjHGU1': out of memory

And the config.log has:

=
elfutils: 0.176 (eu_version: 176)
=

Prefix : /srv/buildbot/worker/elfutils-centos-x8
6_64/build/elfutils-0.176/_inst
Program prefix ("eu-" recommended) : eu-
Source code location   : ..
Maintainer mode: 
libebl modules subdirectory: elfutils
build arch : x86_64-unknown-linux-gnu

  RECOMMENDED FEATURES (should all be yes)
gzip support   : yes
bzip2 support  : yes
lzma/xz support: yes
libstdc++ demangle support : yes
File textrel check : yes
Symbol versioning  : yes

  NOT RECOMMENDED FEATURES (should all be no)
Experimental thread safety : no
install elf.h  : no

  OTHER FEATURES
Deterministic archives by default  : false
Native language support: yes

  EXTRA TEST FEATURES (used with make check)
have bunzip2 installed (required)  : yes
debug branch prediction: no
gprof support  : no
gcov support   : no
run all tests under valgrind   : yes
gcc undefined behaviour sanitizer  : no
use rpath in tests : no
test biarch: yes

So, this is running the test under valgrind.
In which case we might need even more free memory available.

The test did succeed earlier on the worker, not under valgrind.