[PATCH 1/4] Add missing tests to .gitignore

2017-02-10 Thread Ulf Hermann
Some test binaries were missing and showed up in "git status". Signed-off-by: Ulf Hermann --- .gitignore | 12 1 file changed, 12 insertions(+) diff --git a/.gitignore b/.gitignore index c583347..0ee3af7 100644 --- a/.gitignore +++ b/.gitignore @@ -93,6 +93,7 @@ M

[PATCH 2/4] Make the backtrace-data test helper more robust

2017-02-10 Thread Ulf Hermann
When unwinding by frame pointer the unwinder might ask for invalid addresses. We don't have to fail the test in this case. In fact any broken dwarf information can lead to requests for invalid addresses, also without frame pointer unwinding. Signed-off-by: Ulf Hermann --- tests/Chan

[PATCH 3/4] Optionally allow unknown symbols in the backtrace tests

2017-02-10 Thread Ulf Hermann
This is useful to test unwinding without debug information. The binaries being examined might still have frame pointers that allow us to bridge the unknown symbols. Signed-off-by: Ulf Hermann --- tests/ChangeLog | 6 ++ tests/backtrace-subr.sh | 14 ++ tests

Re: [PATCH 3/4] Optionally allow unknown symbols in the backtrace tests

2017-02-10 Thread Ulf Hermann
Hi, I have another patch here, that introduces the actual feature; a fallback mode for unwinding by frame pointer if unwinding by cfi fails. Unfortunately your mail server thinks it's spam, presumably because of the inline test binaries. What can I do about that? br, Ulf Hermann

Re: [PATCH 3/4] Optionally allow unknown symbols in the backtrace tests

2017-02-10 Thread Ulf Hermann
rod.outlook.com (10.167.206.147) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.888.16; Fri, 10 Feb 2017 14:20:22 + From: Ulf Hermann Subject: [PATCH 4/4] Add frame pointer unwinding as fallback on x86_64 To: Message-ID: <6007c160-b26f

Re: [PATCH 3/4] Optionally allow unknown symbols in the backtrace tests

2017-02-10 Thread Ulf Hermann
Try sending suspicious content via something like fpaste.org. I don't think it's very suspicious, but I don't intend to start a pointless argument as first thing I do here ;) fpaste.org won't accept it either, but paste.kde.org does. So, here we go: https://paste.kde.or

Re: [PATCH 3/4] Optionally allow unknown symbols in the backtrace tests

2017-02-13 Thread Ulf Hermann
Thanks for pointing out the issues. I will track down the white space problem. I could reconstruct it from that pastebin. But it was a bit of a struggle, some parts didn't apply as is because tabs seemed to be turned into spaces. I tried to repost it to the list. But the first time it was bounc

Re: [PATCH 3/4] Optionally allow unknown symbols in the backtrace tests

2017-02-14 Thread Ulf Hermann
I didn't know about perfparse. I assume that is this code base: http://code.qt.io/cgit/qt-creator/perfparser.git/ Very nice. Yes. I'm also trying to port this to windows. So, I have lots of changes to make the code more portable: https://codereview.qt-project.org/#/c/184401/ and the 50 chang

[PATCH] Move color handling into a separate header

2017-02-14 Thread Ulf Hermann
We only need it in nm.c and objdump.c, but it pulls in argp as dependency. By dropping it from libeu.h, the libraries can be compiled without argp. Signed-off-by: Ulf Hermann --- lib/ChangeLog | 7 +++ lib/Makefile.am | 2 +- lib/color.c | 2 +- lib/color.h | 63

[PATCH] Always use the same method to query the system page size

2017-02-15 Thread Ulf Hermann
| 2 +- 5 files changed, 12 insertions(+), 3 deletions(-) diff --git a/lib/ChangeLog b/lib/ChangeLog index 5ccf4d6..6578ddb 100644 --- a/lib/ChangeLog +++ b/lib/ChangeLog @@ -1,3 +1,7 @@ +2017-02-15 Ulf Hermann + + * crc32_file.c: Use _SC_PAGESIZE rather than _SC_PAGE_SIZE. + 2017-02-14

[PATCH v2] Always use the same method to query the system page size

2017-02-15 Thread Ulf Hermann
This makes it easier to write a replacement for it on systems where sysconf(3) doesn't exist. Signed-off-by: Ulf Hermann --- lib/ChangeLog | 4 lib/crc32_file.c | 2 +- libdwfl/ChangeLog | 5 + libdwfl/linux-kernel-modules.c | 2 +- li

[PATCH] Check for existence of mempcpy

2017-02-16 Thread Ulf Hermann
If it doesn't exist, provide a definition based on memcpy. Signed-off-by: Ulf Hermann --- ChangeLog | 4 configure.ac | 3 +++ lib/ChangeLog | 5 + lib/system.h | 5 + lib/xstrndup.c

Re: frame unwinding patches

2017-02-16 Thread Ulf Hermann
> I had to hand apply a few things because of whitespace adjustments. > Hopefully I did it right and this is how Ulf intended the patches. > If not, my apologies, and please let me know what changes you did > intend. Thank you. The patches are correct. cheers, Ulf

[PATCH] Move print_version into printversion.{h|c}

2017-02-16 Thread Ulf Hermann
Rename version.c so that the implementation is called after the header and the header doesn't clash with the toplevel version.h. print_version depends on argp and is only used in the tools. Signed-off-by: Ulf Hermann --- lib/ChangeLog | 13 + lib/Makefile.am| 4 ++--

Re: [PATCH] Check for existence of mempcpy

2017-02-17 Thread Ulf Hermann
On 02/17/2017 10:46 AM, Mark Wielaard wrote: > On Thu, 2017-02-16 at 10:10 +0100, Ulf Hermann wrote: >> If it doesn't exist, provide a definition based on memcpy. > > Applied, but slightly reluctantly. I have no way to test this. And it > will evaluate the last argument (n

Re: [PATCH] Check for existence of mempcpy

2017-02-17 Thread Ulf Hermann
> If at all possible I would like elfutils to not turn into some > abstraction layer for broken non-GNU/Linux systems. I don't mind small > (mostly) obvious correct defines/checks or tweaks to help out people > using such broken systems. But if we need a lot more of these things I > think we shoul

Re: [PATCH] Move print_version into printversion.{h|c}

2017-02-17 Thread Ulf Hermann
> But like said before argp is needed for the tools and the libdw > interface. If your glibc replacement doesn't provide argp the build > should pick up libargp and get the definitions and implementation from > there. libdw only needs it for argument parsing, which we can disable if argp isn't a

[PATCH] Unify linking of libasm, libelf, libdw, backends

2017-02-17 Thread Ulf Hermann
f the functions are used. Signed-off-by: Ulf Hermann --- backends/Makefile.am | 7 --- libasm/Makefile.am | 14 -- libdw/Makefile.am| 15 +-- libelf/Makefile.am | 14 +- 4 files changed, 30 insertions(+), 20 deletions(-) diff --git a/backends/Makefile

[PATCH v2] Unify linking of libasm, libelf, libdw, backends

2017-02-17 Thread Ulf Hermann
f the functions are used. Signed-off-by: Ulf Hermann --- backends/ChangeLog | 6 ++ backends/Makefile.am | 7 --- libasm/ChangeLog | 11 +++ libasm/Makefile.am | 14 -- libdw/ChangeLog | 9 + libdw/Makefile.am| 15 +-- libelf/Chan

[PATCH] Make the replacement mempcpy a function

2017-02-17 Thread Ulf Hermann
This way we don't have to evaluate the 'n' argument twice. We now need to link libeu.a into some tests, though. The system.h include was accidentally dropped from elfcompress.c and findtextrel.c, but is actually necessary when mempcpy is only available from libeu. Signed-off-

[PATCH 1/2] Allow building the libraries without argp

2017-02-20 Thread Ulf Hermann
If argp is unavailable we cannot build tests, tools and argp-std.c in libdwfl. We can still build the libraries, though. Test for this and provide a dwfl_standard_argp() that just returns NULL and only gets compiled if argp is missing. Signed-off-by: Ulf Hermann --- ChangeLog| 12

[PATCH 2/2] Output information about buildable components

2017-02-20 Thread Ulf Hermann
configuration. Signed-off-by: Ulf Hermann --- ChangeLog| 5 + configure.ac | 16 +++- 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index e93d05f..e97e02b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,10 @@ 2017-02-20 Ulf Hermann

[PATCH] Check for existence of asprintf and vasprintf

2017-02-22 Thread Ulf Hermann
Add replacements to libeu.a if they don't exist. Include system.h and link against libeu.a where they are used. Signed-off-by: Ulf Hermann --- ChangeLog | 4 configure.ac | 10 ++ lib/ChangeLog | 10 ++ lib/Makefile.am

[PATCH] Check for existence of GNU-style basename()

2017-02-22 Thread Ulf Hermann
If it doesn't exist, add an implementation to libeu.a. Include system.h and link against libeu.a where it is used. Signed-off-by: Ulf Hermann --- ChangeLog | 4 configure.ac | 5 + lib/ChangeLog | 7 +++

[PATCH] Define fputs_unlocked to fputs if it is not available

2017-02-22 Thread Ulf Hermann
Using fputs_unlocked over fputs is a nice optimization, but ultimately the result is the same. So, if we don't have fputs_unlocked we can just use fputs instead. Signed-off-by: Ulf Hermann --- ChangeLog | 4 configure.ac | 4 lib/ChangeLog | 5 + lib/system.h | 4 ++

[PATCH] Check for existence of GNU-style strerror_r

2017-02-22 Thread Ulf Hermann
If we don't have it, we don't translate system error codes to strings in dwfl_error.c. Signed-off-by: Ulf Hermann --- ChangeLog| 4 configure.ac | 2 ++ libdwfl/ChangeLog| 5 + libdwfl/dwfl_error.c | 4 4 files changed, 15 insertions(+) di

[PATCH] Check for program_invocation_short_name

2017-02-22 Thread Ulf Hermann
If it doesn't exist use "" as generic replacement. Signed-off-by: Ulf Hermann --- ChangeLog | 4 configure.ac | 5 + lib/ChangeLog | 5 + lib/system.h | 4 src/ChangeLog | 4 src/elfcmp.c | 1 + 6 files changed, 23 insertions(+) diff --git a/Change

Re: [PATCH] Check for existence of asprintf and vasprintf

2017-02-22 Thread Ulf Hermann
> these portability replacements are starting to get out of hand > -mike To what extent should elfutils be portable to non-GNU systems? My goal here is to port it to windows while minimizing the amount of external dependencies I have to add. The functions I have replaced so far are so trivial tha

[PATCH v2] Check for existence of GNU-style strerror_r

2017-02-22 Thread Ulf Hermann
If we don't have it, we don't translate system error codes to strings in dwfl_error.c. Signed-off-by: Ulf Hermann --- ChangeLog| 4 configure.ac | 2 ++ libdwfl/ChangeLog| 5 + libdwfl/dwfl_error.c | 4 4 files changed, 15 insertions(+) di

Re: [PATCH] Check for existence of asprintf and vasprintf

2017-02-22 Thread Ulf Hermann
> imo, elfutils shouldn't be growing these fallback implementations itself. > if you want to do this stuff, use gnulib instead. > > then there is no ifdef hell in the source files, and you don't have to > worry about testing whether the ifdef's are correct because gnulib did > it all for you. OK,

Re: [PATCH] Check for existence of asprintf and vasprintf

2017-02-22 Thread Ulf Hermann
> sorry, but i don't know what you're talking about. you don't read the > gnulib code/modules directly, you just run gnulib-tool and tell it which > modules to import. it does all the rest for you. > > you want asprintf ? then add it to the list. > modules=( > asprintf > glob >

Re: [PATCH] Check for existence of asprintf and vasprintf

2017-02-23 Thread Ulf Hermann
> basename() is in the dirname module That's the POSIX variant. We're using the GNU variant everywhere and the GNU variant is a whopping two lines of code: char *base = strrchr(path, '/'); return base ? base + 1 : (char *)path; > you're correct that GNU strerror_r is not handled by gnulib. > th

Re: [PATCH] Check for existence of asprintf and vasprintf

2017-02-23 Thread Ulf Hermann
First, I'm not sure if we want to import the respective gnulib modules directly into the elfutils code base or if you want me to do this in my fork. In the latter case the issue is settled as there is no value for me in jumping through hoops if the code is not going to be upstreamed anyway. So,

Re: [PATCH] Check for existence of asprintf and vasprintf

2017-02-23 Thread Ulf Hermann
Please compare the following code with asprintf.c/vasprintf.c/vasnprintf.c from gnulib. asprintf depends on vasprintf which in turn depends on vasnprintf there. vasnprintf is non-standard and not even available on glibc, while vsnprintf as used by my implementation is standardized by POSIX and w

Re: [PATCH] Check for existence of asprintf and vasprintf

2017-02-24 Thread Ulf Hermann
and the GNU variant is a whopping two lines of code: char *base = strrchr(path, '/'); return base ? base + 1 : (char *)path; and we get straight to an example of why your solutions don't scale. your replacement is wrong. and ironically, it's wrong on Windows, which is the whole point of your

Re: frame unwinding patches

2017-04-03 Thread Ulf Hermann
Ping? Any progress on merging this functionality upstream? It can make quite a difference in unwinding. The patches have also been in perfparser releases for over a year now. I would like to see them upstream. best, Ulf

Re: frame unwinding patches

2017-04-04 Thread Ulf Hermann
- In the example above, the address points into libnvidia-glcore.so and as such not compiled by my colleague but rather provided by NVidia as a binary blob. When you only got a binary blob and have to make do with it, you cannot tell people to "just fix the compiler invocation". This is their pr

Re: dwfl_attach_state alternative taking Ebl?

2017-04-05 Thread Ulf Hermann
> So you map from simple architecture name like "x86" or "powerpc". But > what mechanism do you have to whether that is 32 or 64 bit, and big or > little endian? The code can be extended to provide that information. We know it in advance, but didn't need it so far. Ulf

Re: frame unwinding patches

2017-04-11 Thread Ulf Hermann
> I do agree with Jan that frame pointer unwinding is notoriously > untrustworthy. Even with some sanity checks it is hard to know whether > you are doing a correct unwind. gdb gets away with it through pretty > advanced frame sniffers, which take a lot of low-level compiler > generation knowledge

Re: dwfl_attach_state alternative taking Ebl?

2017-04-11 Thread Ulf Hermann
/* [...] Architecture of DWFL modules is specified by ELF, ELF must remain valid during DWFL lifetime. Use NULL ELF to detect architecture from DWFL, the function will then detect it from arbitrary Dwfl_Module of DWFL. [...] */ So would that be an alternative for you? How do you create

Re: frame unwinding patches

2017-04-20 Thread Ulf Hermann
> That might just mean that the testcase is slightly unrealistic. > Getting a reliable backtrace through signal handlers when not having > full CFI is probably not something we can expect to work. That doesn't > mean having a frame pointer based fallback is a bad thing. We probably > should find a

[PATCH v2] Add frame pointer unwinding for aarch64

2017-04-20 Thread Ulf Hermann
rames without debug information. Change-Id: I3b2285542e368906883579b505e2f45313fede31 Signed-off-by: Ulf Hermann --- backends/ChangeLog | 6 +++ backends/Makefile.am | 2 +- backends/aarch64_init.c| 1 + backends/aarch64_unw

[PATCH] Include sys/types.h before fts.h

2017-04-20 Thread Ulf Hermann
The bad fts not only needs to be included before config.h, but also requires various special types without including sys/types.h. Signed-off-by: Ulf Hermann --- libdwfl/ChangeLog | 4 libdwfl/linux-kernel-modules.c | 4 2 files changed, 8 insertions(+) diff --git a

[PATCH] Clean up linux-specific system includes

2017-04-20 Thread Ulf Hermann
We only include them where we actually need them and only on linux. Change-Id: Ic3065ffab67ba1177f63204fb91a92c5f4336dbb Signed-off-by: Ulf Hermann --- backends/ChangeLog | 8 backends/aarch64_initreg.c | 4 ++-- backends/arm_initreg.c | 4 +++- backends/ppc_initreg.c

[PATCH] Don't use comparison_fn_t

2017-04-20 Thread Ulf Hermann
Not all search.h declare it, and it is not very helpful anyway. Signed-off-by: Ulf Hermann --- libcpu/ChangeLog| 4 libcpu/i386_parse.y | 4 ++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/libcpu/ChangeLog b/libcpu/ChangeLog index 79110c2..ec22dd2 100644 --- a

[PATCH] Avoid YESSTR and NOSTR

2017-04-20 Thread Ulf Hermann
Those are deprecated and apparently some implementations of nl_langinfo return empty strings for them. The tests even tested for those empty strings even though the intention of the code was clearly to output "yes" or "no" there. Signed-off-by: Ulf Hermann

[PATCH] Make __attribute__ conditional in all installed headers

2017-04-20 Thread Ulf Hermann
-by: Ulf Hermann --- libdw/ChangeLog | 5 + libdw/libdw.h | 23 +-- libdwfl/ChangeLog | 4 libdwfl/libdwfl.h | 2 +- libebl/ChangeLog | 4 libebl/libebl.h | 6 +++--- libelf/ChangeLog | 5 + libelf/libelf.h | 38

[PATCH] Use F_GETFD rather than F_GETFL to check validity of file descriptor

2017-04-20 Thread Ulf Hermann
F_GETFD is both cheaper and easier to port, and otherwise has the same effect here. Signed-off-by: Ulf Hermann --- libelf/ChangeLog | 4 libelf/elf_begin.c | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/libelf/ChangeLog b/libelf/ChangeLog index 23cd942..e32590a

[PATCH] Protect against integer overflow on shnum

2017-04-20 Thread Ulf Hermann
If shnum is 0, the many "shnum - 1" would result in an overflow. Check it for 0, and only subtract once, rather than on every usage. Signed-off-by: Ulf Hermann --- libdwfl/ChangeLog | 5 + libdwfl/dwfl_module_getdwarf.c | 18 ++ src

[PATCH] Don't look for kernel version if not running on linux

2017-04-20 Thread Ulf Hermann
We don't want to use it, even if it exists. Signed-off-by: Ulf Hermann --- libdwfl/ChangeLog | 5 + libdwfl/linux-kernel-modules.c | 4 2 files changed, 9 insertions(+) diff --git a/libdwfl/ChangeLog b/libdwfl/ChangeLog index de73d79..80346d5 100644 --- a/li

[PATCH] Avoid double-including config.h

2017-04-20 Thread Ulf Hermann
price of adding some redundancy, but there is no clean way to avoid this. Signed-off-by: Ulf Hermann --- lib/ChangeLog | 5 +++ lib/crc32.c | 4 ++ lib/system.h| 4 -- libdwfl/Chan

[PATCH] Include strings.h to make ffs available

2017-04-20 Thread Ulf Hermann
We cannot rely on it to be available from any of the other headers. Signed-off-by: Ulf Hermann --- src/ChangeLog | 4 src/readelf.c | 1 + 2 files changed, 5 insertions(+) diff --git a/src/ChangeLog b/src/ChangeLog index 1521d80..cbb77fc 100644 --- a/src/ChangeLog +++ b/src/ChangeLog

[PATCH] Avoid signed/unsigned comparison

2017-04-20 Thread Ulf Hermann
: Ulf Hermann --- libdwfl/ChangeLog | 4 libdwfl/elf-from-memory.c | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/libdwfl/ChangeLog b/libdwfl/ChangeLog index cddafe2..c9bd4f0 100644 --- a/libdwfl/ChangeLog +++ b/libdwfl/ChangeLog @@ -1,5 +1,9 @@ 2017-04-20 Ulf

[PATCH v2] Include sys/types.h before fts.h

2017-04-20 Thread Ulf Hermann
The bad fts not only needs to be included before config.h, but also requires various special types without including sys/types.h. Change-Id: I31ac8d2aadcf7ffb3efb63583b2745991bfd6f90 Signed-off-by: Ulf Hermann --- libdwfl/ChangeLog | 4 libdwfl/linux-kernel-modules.c | 6

[PATCH] Make elf section sorting more deterministic

2017-04-20 Thread Ulf Hermann
At least one test (dwfl-addr-sect) depends on the order of elf sections with equal addresses. This is not guaranteed by the code. Compare also by end address and name to tell entries apart. Signed-off-by: Ulf Hermann --- libdwfl/ChangeLog | 5 + libdwfl/derelocate.c| 17

[PATCH] On elf_update, remember when we mmap()

2017-04-20 Thread Ulf Hermann
Otherwise we skip the munmap() later. This leaks resources. Signed-off-by: Ulf Hermann --- libelf/ChangeLog| 4 libelf/elf_update.c | 2 ++ 2 files changed, 6 insertions(+) diff --git a/libelf/ChangeLog b/libelf/ChangeLog index fa768f8..225c7c8 100644 --- a/libelf/ChangeLog +++ b

[PATCH] Add EXEEXT to gendis

2017-04-20 Thread Ulf Hermann
Otherwise the build will fail on systems that actually need file extension for executables. Signed-off-by: Ulf Hermann --- libcpu/ChangeLog | 4 libcpu/Makefile.am | 6 +++--- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/libcpu/ChangeLog b/libcpu/ChangeLog index e59e876

[PATCH] Include endian.h when handling BYTE_ORDER

2017-04-20 Thread Ulf Hermann
BYTE_ORDER and friends are customarily defined in endian.h. Signed-off-by: Ulf Hermann --- libdw/ChangeLog | 4 libdw/dwarf_begin_elf.c | 1 + 2 files changed, 5 insertions(+) diff --git a/libdw/ChangeLog b/libdw/ChangeLog index c9ae664..8802853 100644 --- a/libdw/ChangeLog +++ b

porting to windows

2017-04-20 Thread Ulf Hermann
I have a total of 85 patches to port elfutils to windows. I will post them all here, once I get around to write all the ChangeLog entries, but I'm fairly sure you won't like all of them. You can see them all (and also comment if you like) on the qt code review system. See https://codereview.qt

[PATCH] Add missing entries to .gitignore

2017-04-21 Thread Ulf Hermann
Signed-off-by: Ulf Hermann --- .gitignore | 2 ++ ChangeLog | 4 2 files changed, 6 insertions(+) diff --git a/.gitignore b/.gitignore index 0ee3af7..43a8d6e 100644 --- a/.gitignore +++ b/.gitignore @@ -123,6 +123,7 @@ Makefile.in /tests/elfstrmerge /tests/elfstrtab /tests/emptyfile

Re: porting to windows

2017-04-21 Thread Ulf Hermann
Hi, I just tried to post the patch that adds all the gnulib modules. I suspect the mailing list doesn't like it because it's 4.8MB of diff. I've merged all the single "add xyz gnulib module" patches into one because you cannot sensibly reorder or skip any of them anyway. gnulib likes to keep se

Re: [PATCH v2] Add frame pointer unwinding for aarch64

2017-04-25 Thread Ulf Hermann
On 04/24/2017 04:53 PM, Mark Wielaard wrote: > I got these separately. I assume they are as in the email you sent on > Mon, 10 Apr 2017 14:48:06 +0200 (which didn't hit the list because it > had the binaries attached...) Yes. Those are the right binaries. > This description doesn't seem to match

Re: [PATCH 1/5] Revert "Optionally allow unknown symbols in the backtrace tests"

2017-04-25 Thread Ulf Hermann
On 04/25/2017 02:49 PM, Mark Wielaard wrote: > This reverts commit f9971cb422df39adea7e8c7e22689b879e39c626. > > Allowing no symbol resolving at all makes it too hard to see > whether the test actually tests anything. > [...] Looks good to me. Ulf

Re: [PATCH 2/5] tests: Add core backtracegen chec and regenerate ppc32 backtrace test files.

2017-04-25 Thread Ulf Hermann
On 04/25/2017 02:49 PM, Mark Wielaard wrote: > Add a check to check_core to make sure the backtracegen function is > found in the backtrace. This function is in the middle of the backtrace > in the main executable and if not found it means the backtrace was > incomplete or the frame was skipped (wh

Re: [PATCH 3/5] Add frame pointer unwinding as fallback on x86_64

2017-04-25 Thread Ulf Hermann
On 04/25/2017 02:49 PM, Mark Wielaard wrote: > From: Ulf Hermann > > If we don't find any debug information for a given frame, we usually > cannot unwind any further. However, the binary in question might have > been compiled with frame pointers, in which case we can look

Re: [PATCH 4/5] Add i386 frame pointer unwinder.

2017-04-25 Thread Ulf Hermann
On 04/25/2017 02:49 PM, Mark Wielaard wrote: > Add a simple i386_unwind.c frame pointer unwinder as fallback if DWARF/CFI > unwinding fails. Looks good to me. The logic could be relaxed a bit so that failure to e.g. write the new value for sp would not be fatal. Then we might be able to unwind e

Re: [PATCH 5/5] Add frame pointer unwinding for aarch64

2017-04-25 Thread Ulf Hermann
On 04/25/2017 02:49 PM, Mark Wielaard wrote: > From: Ulf Hermann > > If we don't find any debug information for a given frame, we usually > cannot unwind any further. However, the binary in question might have > been compiled with frame pointers, in which case we can look

Re: [PATCH 5/5] Add frame pointer unwinding for aarch64

2017-04-25 Thread Ulf Hermann
> My question is about this "initial frame". In our testcase we don't have > this case since the backtrace starts in a function that has some CFI. > But I assume you have some tests that rely on this behavior. Actually the test I provided does exercise this code. The initial __libc_do_syscall() f

Re: frame unwinding patches

2017-04-26 Thread Ulf Hermann
> I dropped the arm32 frame pointer unwinder for now (maybe we need a less > demanding testcase for that or, more awesome, add code to translate the > exidx section for that). Another problem is that QV4-generated code on a new frame pushes LR first and then FP. Code generated by gcc with "-arm -

Re: [PATCH 5/5] Add frame pointer unwinding for aarch64

2017-04-26 Thread Ulf Hermann
On 04/26/2017 04:33 PM, Mark Wielaard wrote: > On Tue, 2017-04-25 at 15:38 +0200, Ulf Hermann wrote: >>> My question is about this "initial frame". In our testcase we don't have >>> this case since the backtrace starts in a function that has some CFI. >>&g

Re: [PATCH 5/5] Add frame pointer unwinding for aarch64

2017-04-27 Thread Ulf Hermann
Maybe something like the attached patch? Well that's actually the original patch (as opposed to V2) with relaxed test conditions. You can write that a bit nicer by setting the new PC directly after retrieving LR and returning early if it doesn't work. See "[PATCH 2/3] Add frame pointer unwind

Re: [PATCH 5/5] Add frame pointer unwinding for aarch64

2017-04-27 Thread Ulf Hermann
Does every fp-only frame gets duplicated after a DWARF CFI frame? I'll look if I can better understand why that is. The last thing I've tested on an actual aarch64 setup is what I'm removing in this change: https://codereview.qt-project.org/#/c/191650/5/3rdparty/elfutils/backends/aarch64_unwi

[PATCH] Fix nesting of braces

2017-04-27 Thread Ulf Hermann
The way it was before it didn't actually test if elf_update failed, but rather did something random. !!() is a boolean and boolean true can be represented as anything non-0, including negative numbers. Signed-off-by: Ulf Hermann --- libasm/ChangeLog | 4 libasm/asm_end.c | 2 +- 2

[PATCH] Drop handrolled or #ifdef'ed libc replacements

2017-04-27 Thread Ulf Hermann
mempcpy, memrchr, rawmemchr, and argp are provided by gnulib now. We don't need to define them locally and we don't need to search for an external libargp. Signed-off-by: Ulf Hermann --- ChangeLog | 4 configure.ac

[PATCH] Check for -z,defs, -z,relro, -fPIC, -fPIE before using them

2017-04-27 Thread Ulf Hermann
On windows those aren't needed because the link results are no ELF files and all code is position independent anyway. gcc then complains about them, which is in turn caught by -Werror. Signed-off-by: Ulf Hermann --- ChangeLog| 5 + backends/ChangeLog | 4 bac

[PATCH v2] Check for -z,defs, -z,relro, -fPIC, -fPIE before using them

2017-04-27 Thread Ulf Hermann
On windows those aren't needed because the link results are no ELF files and all code is position independent anyway. gcc then complains about them, which is in turn caught by -Werror. Signed-off-by: Ulf Hermann --- ChangeLog| 5 + backends/ChangeLog | 4 bac

[PATCH] Check if gcc complains about __attribute__ (visibility(..))

2017-04-27 Thread Ulf Hermann
If so, define attribute_hidden to be empty. Also, use attribute_hidden in all places where we hide symbols. Change-Id: I37353459710dbbd1c6c6c46110514fc18515c814 Signed-off-by: Ulf Hermann --- ChangeLog | 5 + configure.ac| 16 lib/ChangeLog | 5

Re: [PATCH] Don't look for kernel version if not running on linux

2017-04-28 Thread Ulf Hermann
On 04/27/2017 08:02 PM, Mark Wielaard wrote: > On Thu, Apr 20, 2017 at 04:08:48PM +0200, Ulf Hermann wrote: >> We don't want to use it, even if it exists. > > I am not sure this is really the right place to patch. > The value is retrieved through uname () which is P

Re: [PATCH] On elf_update, remember when we mmap()

2017-04-28 Thread Ulf Hermann
On 04/28/2017 12:23 AM, Mark Wielaard wrote: > On Thu, Apr 20, 2017 at 04:57:41PM +0200, Ulf Hermann wrote: >> Otherwise we skip the munmap() later. This leaks resources. > > Oops. Good find. Applied to master. > > When configured --with-valgrind the tests are run under

Re: [PATCH] Make elf section sorting more deterministic

2017-04-28 Thread Ulf Hermann
On 04/27/2017 09:41 PM, Mark Wielaard wrote: > On Thu, Apr 20, 2017 at 04:54:26PM +0200, Ulf Hermann wrote: >> At least one test (dwfl-addr-sect) depends on the order of elf sections >> with equal addresses. This is not guaranteed by the code. Compare also >> by end add

[PATCH] Check if we need -lintl for linking gettext

2017-04-28 Thread Ulf Hermann
We might not have gettext available from libc and we cannot get it from gnulib either. Signed-off-by: Ulf Hermann --- ChangeLog| 5 + backends/ChangeLog | 4 backends/Makefile.am | 2 +- configure.ac | 25 + libasm/ChangeLog | 4

[PATCH] Disable symbol versioning if .symver doesn't work

2017-04-28 Thread Ulf Hermann
Signed-off-by: Ulf Hermann --- ChangeLog| 5 + configure.ac | 12 2 files changed, 17 insertions(+) diff --git a/ChangeLog b/ChangeLog index 01f88f3..fb7317c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2017-04-28 Ulf Hermann + + * configure.ac: Test

[PATCH] Check if rpath is supported before setting it

2017-04-28 Thread Ulf Hermann
Some systems don't have rpath. In that case the backends need to be made available by some external mechanism. Warn about it. Signed-off-by: Ulf Hermann --- ChangeLog | 5 + configure.ac | 12 libdw/ChangeLog | 5 + libdw/Makefile.am | 9 +++-- 4

[PATCH] Generalize library names

2017-04-28 Thread Ulf Hermann
On windows library names end with ".dll" and the prefix "lib" us usually omitted. Take this into account and also drop the $(EXEEXT) workaround. We don't need to use noinst_PROGRAMS as there is also noinst_DATA. Change-Id: I7e4ba2432811d5ad85051ea0c9d5674eabf79b3c S

[PATCH] Check native binary format

2017-04-28 Thread Ulf Hermann
If our native binary format is not ELF, there is no point in doing the textrel check and we have to exclude some tests that compile source code with the native compiler and then check something on the resulting binary with elfutils. Signed-off-by: Ulf Hermann --- ChangeLog

Re: [PATCH] Don't look for kernel version if not running on linux

2017-05-02 Thread Ulf Hermann
You can get uname() on Windows through gnulib, but at the cost at linking to additional windows DLLs. It calls gethostname and for that we need to link against ws2_32.dll. That's an unreasonable dependency for getting something we cannot use anyway. I suggest we just set errno to ENOTSUP then. I

Re: [PATCH] Avoid double-including config.h

2017-05-02 Thread Ulf Hermann
Maybe we can cleanup that last one once we integrate gnulib (which I believe has a good/64-off_t fts.h already). gnulib is among the bad ones. Or, at least we detect it as bad. Ulf

Re: [PATCH] Make elf section sorting more deterministic

2017-05-03 Thread Ulf Hermann
[...] How about the attached? Looks good to me. Ulf

[PATCH] Generate .lib files on PE platforms

2017-05-03 Thread Ulf Hermann
le.am | 27 --- 8 files changed, 106 insertions(+), 9 deletions(-) diff --git a/config/ChangeLog b/config/ChangeLog index 0f240ea..34414a3 100644 --- a/config/ChangeLog +++ b/config/ChangeLog @@ -1,3 +1,8 @@ +2017-05-03 Ulf Hermann + + * eu.am: If we're b

[PATCH] Check if gcc supports -rdynamic and don't use it if not

2017-05-03 Thread Ulf Hermann
On some platforms the symbols are automatically exported and -rdynamic will produce a warning. Signed-off-by: Ulf Hermann --- ChangeLog | 4 configure.ac | 11 +++ tests/ChangeLog | 5 + tests/Makefile.am | 2 +- 4 files changed, 21 insertions(+), 1 deletion

Re: pending patches

2017-05-03 Thread Ulf Hermann
> - Check for -z,defs, -z,relro, -fPIC, -fPIE before using them > There are actually two versions, I haven't looked yet how they differ. > - Check if gcc complains about __attribute__ (visibility(..)) > - Disable symbol versioning if .symver doesn't work > - Check if rpath is supported before set

[PATCH] Make sure packed structs follow the gcc memory layout

2017-05-03 Thread Ulf Hermann
On windows gcc by default generates code that follows the MSVC layout. We don't want that as it adds extra padding. Signed-off-by: Ulf Hermann --- ChangeLog | 5 + backends/ChangeLog | 4 backends/linux-core-note.c | 2 +- configure.ac

Re: pending patches

2017-05-03 Thread Ulf Hermann
> - Check for -z,defs, -z,relro, -fPIC, -fPIE before using them > There are actually two versions, I haven't looked yet how they differ. There was a typo in tests/Makefile.am which I fixed in the second version. This change actually doesn't disable symbol versioning or rpath. It just condition

[PATCH v2] Detect if symbol versioning is supported (was "Disable symbol versioning if .symver doesn't work")

2017-05-03 Thread Ulf Hermann
If not, throw an error unless symbol versioning was explicitly disabled. Signed-off-by: Ulf Hermann --- ChangeLog| 4 configure.ac | 15 +++ 2 files changed, 19 insertions(+) diff --git a/ChangeLog b/ChangeLog index 01f88f3..22c46c6 100644 --- a/ChangeLog +++ b/ChangeLog

[PATCH v2] Check if rpath is supported before setting it

2017-05-03 Thread Ulf Hermann
Some systems don't have rpath. In that case the backends need to be made available by some external mechanism. Provide a configure switch to explicitly turn off the setting of rpaths. Throw an error if that is not set and rpath is not supported. Signed-off-by: Ulf Hermann --- Chan

[PATCH] Drop __BEGIN_DECLS and __END_DECLS from elf.h

2017-05-03 Thread Ulf Hermann
We don't use those anywhere else and they are not guaranteed to be defined. Also, put the 'extern "C"' after the included headers. Signed-off-by: Ulf Hermann --- libelf/ChangeLog | 4 libelf/elf.h | 10 +++--- 2 files changed, 11 insertions(+), 3 deletion

[PATCH] Add a "selfcontained" mode to provide missing headers on windows

2017-05-03 Thread Ulf Hermann
features.h declarations are provided like mingw defines them. Signed-off-by: Ulf Hermann --- ChangeLog | 4 configure.ac | 6 ++ lib/ChangeLog | 6 ++ lib/Makefile.am| 11 ++- lib/features.h.in | 43 +++ libelf

[PATCH] If f(un)lockfile is unavailable define it away

2017-05-03 Thread Ulf Hermann
Sometimes _POSIX_THREAD_SAFE_FUNCTIONS is still set in this case, which in turn leads to build problems in getopt.c (which would define the functions to nop anyway if it knew they aren't present). Signed-off-by: Ulf Hermann --- lib/ChangeLog | 5 + lib/eu-config.h | 7 +++ 2

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

2017-05-03 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(). Signed-off-by: Ulf Hermann --- Chan

[PATCH] Add mman.h/.c for win32

2017-05-04 Thread Ulf Hermann
We cannot get mmap() and friends from gnulib and they don't exist on windows. The functionality we need can be implemnted using native win32 functions, though. Signed-off-by: Ulf Hermann --- configure.ac| 7 +++ libgnu/Makefile.am | 17 +- libgnu/mman_win32.c

  1   2   >