Re: [PATCH] Add replacement endian.h and byteswap.h to libgnu

2017-11-16 Thread Florian Weimer
* Ulf Hermann:

> Some systems don't provide endian.h and byteswap.h. The required
> functions are trivial to define using sys/param.h and gcc builtins,
> though.
>
> Also, include endian.h in dwelf_scn_gnu_compressed_size.c as that uses
> be64toh().

This is still an issue with non-glibc, non-BSD compilation.  The patch
is not ideal, as it depends on a GCC extension, but it's an
improvement for those who use GCC on a platform which does not provide
these functions as part of the C library.


Re: [PATCH] Add replacement endian.h and byteswap.h to libgnu

2017-11-16 Thread Ulf Hermann
>> Some systems don't provide endian.h and byteswap.h. The required
>> functions are trivial to define using sys/param.h and gcc builtins,
>> though.
>>
>> Also, include endian.h in dwelf_scn_gnu_compressed_size.c as that uses
>> be64toh().
> 
> This is still an issue with non-glibc, non-BSD compilation.  The patch
> is not ideal, as it depends on a GCC extension, but it's an
> improvement for those who use GCC on a platform which does not provide
> these functions as part of the C library.

Well, there are a lot of other issues to be fixed if you want to build elfutils 
on anything non-gcc. We could add a further check for those builtins and 
sys/param.h and then add a somewhat less trivial version of endian.h and 
byteswap.h if they are missing. But that would likely involve other compiler 
extensions or OS-specific headers.

br,
Ulf


Re: [PATCH] Add replacement endian.h and byteswap.h to libgnu

2017-11-16 Thread Florian Weimer
* Ulf Hermann:

>>> Some systems don't provide endian.h and byteswap.h. The required
>>> functions are trivial to define using sys/param.h and gcc builtins,
>>> though.
>>>
>>> Also, include endian.h in dwelf_scn_gnu_compressed_size.c as that uses
>>> be64toh().
>> 
>> This is still an issue with non-glibc, non-BSD compilation.  The patch
>> is not ideal, as it depends on a GCC extension, but it's an
>> improvement for those who use GCC on a platform which does not provide
>> these functions as part of the C library.
>
> Well, there are a lot of other issues to be fixed if you want to build
> elfutils on anything non-gcc. We could add a further check for those
> builtins and sys/param.h and then add a somewhat less trivial version
> of endian.h and byteswap.h if they are missing. But that would likely
> involve other compiler extensions or OS-specific headers.

Ah, fair enough.  I mainly wanted to increase awareness of the patch
because it has not been merged yet.


Re: [PATCH] tests: Add varlocs-self and exprlocs-self tests.

2017-11-16 Thread Mark Wielaard
On Wed, 2017-11-15 at 21:01 +0100, Mark Wielaard wrote:
> On Fri, 2017-11-10 at 17:12 +0100, Mark Wielaard wrote:
> > Make sure the testcases (library functions they use) don't crash,
> > triggers self-check/asserts or leaks memory under valgrind. This
> > also helps making sure newer DWARF constructs are handled (when
> > building with -gdwarf-5).
> 
> I pushed this to master now.

I setup a buildbot that checks all commits on various setups.
It found an issue with this patch on ppc64/ppc64le:
https://builder.wildebeest.org/buildbot/#/builders/11/builds/14

It was caused by a silly typo...
I pushed the attached to master as obvious.

Cheers,

MarkFrom 1af6c2b9e49f59ea2f01035738525e798bb4f645 Mon Sep 17 00:00:00 2001
From: Mark Wielaard 
Date: Thu, 16 Nov 2017 13:20:11 +0100
Subject: [PATCH] tests: Fix cfi_debug => cfi_debug_bias typo in varlocs
 assert.

We want to check whether the bias is zero, not whether we have dwarf
debug_frame cfi.

This triggered on a ppc64/ppc64le self-check since it has both
debug_frame and eh_frame cfi (other arches often only have eh_frame).

Signed-off-by: Mark Wielaard 
---
 tests/ChangeLog | 4 
 tests/varlocs.c | 2 +-
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/tests/ChangeLog b/tests/ChangeLog
index 6c8a8e1..0162034 100644
--- a/tests/ChangeLog
+++ b/tests/ChangeLog
@@ -1,3 +1,7 @@
+2017-11-16  Mark Wielaard  
+
+	* varlocs.c (main): Fix cfi_debug => cfi_debug_bias typo in assert.
+
 2017-11-10  Mark Wielaard  
 
 	* run-exprlocs-self.sh: New test.
diff --git a/tests/varlocs.c b/tests/varlocs.c
index 3267198..0e43229 100644
--- a/tests/varlocs.c
+++ b/tests/varlocs.c
@@ -1031,7 +1031,7 @@ main (int argc, char *argv[])
 	  cfi_debug = dwfl_module_dwarf_cfi (mod, &cfi_debug_bias);
 	  cfi_eh = dwfl_module_eh_cfi (mod, &cfi_eh_bias);
 
-	  assert (cfi_debug == 0); // No bias needed, same file.
+	  assert (cfi_debug_bias == 0); // No bias needed, same file.
 
 	  // We are a bit forgiving for object files.  There might be
 	  // relocations we don't handle that are needed in some
-- 
1.8.3.1



Re: [PATCH] Add replacement endian.h and byteswap.h to libgnu

2017-11-16 Thread Mark Wielaard
On Thu, 2017-11-16 at 10:21 +0100, Florian Weimer wrote:
> * Ulf Hermann:
> > Well, there are a lot of other issues to be fixed if you want to build
> > elfutils on anything non-gcc. We could add a further check for those
> > builtins and sys/param.h and then add a somewhat less trivial version
> > of endian.h and byteswap.h if they are missing. But that would likely
> > involve other compiler extensions or OS-specific headers.
> 
> Ah, fair enough.  I mainly wanted to increase awareness of the patch
> because it has not been merged yet.

Yeah, sorry for dropping some of these older patches. I admit they
aren't really on my radar anymore. So please do ping them if you want
to get them integrated. But I believe we never fully finished the
discussion about whether or not to adopt gnulib for things like this.
Which I think is a better idea than having to maintain our own
versions.

Cheers,

Mark


Re: [PATCH] readelf: Print DIE offset in attribute reading error messages.

2017-11-16 Thread Mark Wielaard
On Tue, 2017-10-03 at 16:59 +0200, Mark Wielaard wrote:
> When processing large files it is useful to know the DIE offset if
> printing of attributes fails (especially when redirecting the output).
> With this change the error message looks like:
> 
>   eu-readelf: DIE [2aeb8ef1] cannot get attribute value: invalid DWARF

Got another report about a large debug file where this improved error
message would have been really handy. So I pushed it to master now.

Cheers,

Mark