platform/upstream/elfutils.git
6 years agolibdw: DWARF5 Add new DW_LANG codes and default lower array bound.
Mark Wielaard [Wed, 26 Jul 2017 15:44:29 +0000 (17:44 +0200)]
libdw: DWARF5 Add new DW_LANG codes and default lower array bound.

Add DW_LANG_OpenCL, DW_LANG_Modula3, DW_LANG_C_plus_plus_03,
DW_LANG_OCaml, DW_LANG_Rust, DW_LANG_Swift, DW_LANG_Julia,
DW_LANG_Dylan, DW_LANG_RenderScript and DW_LANG_BLISS to dwarf.h.

Update default language array lower bounds in dwarf_aggregate_size.c.

Signed-off-by: Mark Wielaard <mark@klomp.org>
6 years agolibdw: Add new DWARF5 character encodings.
Mark Wielaard [Wed, 26 Jul 2017 15:38:22 +0000 (17:38 +0200)]
libdw: Add new DWARF5 character encodings.

Add DW_ATE_UCS and DW_ATE_ASCII for Fortran 2003 string kinds ASCII
(ISO/IEC 646:1991) and ISO_10646 (UCS-4 in ISO/IEC 10646:2000).

Signed-off-by: Mark Wielaard <mark@klomp.org>
6 years agolibdw: Add new DWARF5 tag constants.
Mark Wielaard [Wed, 26 Jul 2017 15:06:07 +0000 (17:06 +0200)]
libdw: Add new DWARF5 tag constants.

Add DW_TAG_coarray_type, DW_TAG_generic_subrange, DW_TAG_dynamic_type,
DW_TAG_call_site, DW_TAG_call_site_parameter, DW_TAG_skeleton_unit,
DW_TAG_immutable_type.

Just the constants, no further interpretion yet.

Signed-off-by: Mark Wielaard <mark@klomp.org>
6 years agolibdw: Add DWARF5 attributes.
Mark Wielaard [Tue, 25 Jul 2017 13:29:10 +0000 (15:29 +0200)]
libdw: Add DWARF5 attributes.

Add new DWARF5 attribute constant names to the attributes enum.
Also add reserved comments between non-consecutive (reserved) numbers.

Remove DW_AT_subscr_data, DW_AT_element_list and DW_AT_member from the
enum list and turn them into compatibility defines because they are
not part of DWARF2+. That way code that directly references them still
compiles but they won't show up in known-dwarf.h.

Signed-off-by: Mark Wielaard <mark@klomp.org>
6 years agolibdwfl: Move nested functions in parse_opt to file scope.
Yunlian Jiang [Wed, 26 Jul 2017 23:25:43 +0000 (16:25 -0700)]
libdwfl: Move nested functions in parse_opt to file scope.

* Move nested function 'failure' to file scope to compile with clang.
* Move nested function 'fail' to file scope to compile with clang.

Signed-off-by: Yunlian Jiang <yunlian@google.com>
6 years agolibdw: Add dwarf_line_file.
Mark Wielaard [Fri, 21 Jul 2017 19:23:07 +0000 (21:23 +0200)]
libdw: Add dwarf_line_file.

Signed-off-by: Mark Wielaard <mark@klomp.org>
6 years agoppc64: Add HTM SPRs support to readelf
Gustavo Romero [Thu, 20 Jul 2017 21:49:02 +0000 (17:49 -0400)]
ppc64: Add HTM SPRs support to readelf

Since POWER8, PowerPC 64 supports Hardware Transactional Memory, which has
three special purpose registers associated to it: tfhar, tfiar, and texasr.
This commit add HTM SPRs set as known note type so it's possible to use
'readelf --notes' to inspect the HTM SPRs in a coredump file generated in
such a machines.

Signed-off-by: Gustavo Romero <gromero@linux.vnet.ibm.com>
6 years agostrip: Deal with ARM data marker symbols pointing to debug sections.
Mark Wielaard [Thu, 20 Jul 2017 20:34:29 +0000 (22:34 +0200)]
strip: Deal with ARM data marker symbols pointing to debug sections.

ARM data marker symbols "$d" indicate the start of a sequence of data
items in a section. For data only sections no data marker symbol is
necessary, but may be put pointing to the start of the section.
binutils however has a bug which places a data marker symbol somewhere
inside the section (at least for .debug_frame).
https://sourceware.org/bugzilla/show_bug.cgi?id=21809

When strip finds a symbol pointing to a debug section that would be
put into the .debug file then it will copy over the whole symbol table.
This isn't necessary because the symbol is redundant.

Add an ebl hook to recognize data marker symbols with implementations
for arm and aarch64. Use it in strip to strip such symbols from the
symbol table if they point to a debug section.

Signed-off-by: Mark Wielaard <mark@klomp.org>
6 years agobackends: Don't depend on linux/bpf.h to compile bpf disassembler.
Mark Wielaard [Tue, 18 Jul 2017 12:12:36 +0000 (14:12 +0200)]
backends: Don't depend on linux/bpf.h to compile bpf disassembler.

We only need a few constants and one structure definition from linux/bpf.
Just define those in a local lib/bpf.h file. This makes sure the bpf
disassembler is always build and included even when elfutils is build
on older GNU/Linux systems (and even on other platforms).

Signed-off-by: Mark Wielaard <mark@klomp.org>
6 years agoWrite to /dev/null rather than /dev/zero
Ulf Hermann [Thu, 4 May 2017 15:27:47 +0000 (17:27 +0200)]
Write to /dev/null rather than /dev/zero

/dev/zero is meant for reading zeroes. /dev/null is for writing into
nirvana.

Signed-off-by: Ulf Hermann <ulf.hermann@qt.io>
6 years agoUnify linking of libasm, libelf, libdw, backends
Ulf Hermann [Fri, 17 Feb 2017 15:11:28 +0000 (16:11 +0100)]
Unify linking of libasm, libelf, libdw, backends

Link them all with -z,defs,-z,relro,--no-undefined, provide complete
dependencies for the link steps, and add libeu.a to each one. libeu.a
contains useful library functionality that each of them might use. The
linker will strip unneeded symbols, so linking it in won't hurt even if
none of the functions are used.

Signed-off-by: Ulf Hermann <ulf.hermann@qt.io>
7 years agobackends: Swap sys/ptrace.h and asm/ptrace.h include order on s390.
Mark Wielaard [Mon, 17 Jul 2017 15:26:25 +0000 (17:26 +0200)]
backends: Swap sys/ptrace.h and asm/ptrace.h include order on s390.

glibc 2.26 changed the sys/ptrace.h header so that it cannot be included
after asm/ptrace.h. We still need to include the kernel asm/ptrace.h for
the ptrace_area definition. Including it after sys/ptrace.h works against
both old and new glibc.

Signed-off-by: Mark Wielaard <mark@klomp.org>
7 years agostrip: Add --keep-section=SECTION and --remove-section=SECTION.
Mark Wielaard [Fri, 14 Jul 2017 15:09:40 +0000 (17:09 +0200)]
strip: Add --keep-section=SECTION and --remove-section=SECTION.

Adds two new output options:

  --keep-section=SECTION Keep the named section.  SECTION is an extended
                         wildcard pattern.  May be given more than once.

  --remove-section=SECTION   Remove the named section.  SECTION is an
                         extended wildcard pattern.  May be given more than
                         once.  Only non-allocated sections can be removed.

The --remove-section was already partially implemented, but only for the
.comment section. The short option -R is to be compatible with binutils.

The new testcase makes sure that various combinations of kept/removed
sections pull the correct dependencies into the output and/or debug files.

https://bugzilla.redhat.com/show_bug.cgi?id=1465997

Signed-off-by: Mark Wielaard <mark@klomp.org>
7 years agoSupport EM_PPC machine flags
Andreas Schwab [Thu, 15 Jun 2017 12:14:50 +0000 (14:14 +0200)]
Support EM_PPC machine flags

This fixes the elflint self test when the compiler is configured for PIE
default.

Signed-off-by: Andreas Schwab <schwab@linux-m68k.org>
7 years agostrip: Don't generate empty output file when nothing to do.
Mark Wielaard [Wed, 7 Jun 2017 18:32:38 +0000 (20:32 +0200)]
strip: Don't generate empty output file when nothing to do.

If there was nothing to do strip would skip generating a separate
debug file if one was requested, but it would also not finish the
creation of a new output file (with the non-stripped sections).
Also if there was an error any partially created output would be kept.

Make sure that when the -o output file option is given we always generate
a complete output file (except on error). Also make sure that when the -f
debug file option is given it is only generated when it is not empty.

Add testcase run-strip-nothing.sh that tests the various combinations.

https://sourceware.org/bugzilla/show_bug.cgi?id=21522

Signed-off-by: Mark Wielaard <mark@klomp.org>
7 years agostrip: Make sure old .shstrab is removed when eu-strip recreates it.
Mark Wielaard [Wed, 7 Jun 2017 12:05:36 +0000 (14:05 +0200)]
strip: Make sure old .shstrab is removed when eu-strip recreates it.

Although we always recreate the .shstrtab section for the new output
file we never explicitly assumed it could be removed. It might not be
possible to remove it when the section string table is shared with
a symbol table. But if it is removable we should (and recreate it for
the new section list).

Regression introduced in commit elfutils-0.163-33-gdf7dfab.
"Handle merged strtab/shstrtab string tables in strip and unstrip."
Add extra testcase to explicitly check for this case.

https://sourceware.org/bugzilla/show_bug.cgi?id=21525

Signed-off-by: Mark Wielaard <mark@klomp.org>
7 years agoppc64: Add minimal fallback unwinder.
Mark Wielaard [Sun, 21 May 2017 21:33:15 +0000 (23:33 +0200)]
ppc64: Add minimal fallback unwinder.

This adds a minimal fallback unwinder for ppc64[le] in case we cannot find
CFI for a particular address. It simply always sets the program counter to
the link register, picks the previous stack pointer from the backchain,
and the previous link register from the LR save area.

This is enough for some simple situations when we don't have CFI and
seems to work nicely in the case of perf with libdw powerpc support:
https://lkml.org/lkml/2017/5/18/998

Signed-off-by: Mark Wielaard <mark@klomp.org>
7 years agoPrepare for 0.169. elfutils-0.169
Mark Wielaard [Fri, 5 May 2017 07:47:29 +0000 (09:47 +0200)]
Prepare for 0.169.

Set version to 0.169. Update copyright year. Update po/*.po files.
And add user visible changes to new 0.169 NEWS section.

Signed-off-by: Mark Wielaard <mark@klomp.org>
7 years agoMake elf section sorting more deterministic
Ulf Hermann [Thu, 20 Apr 2017 14:54:26 +0000 (16:54 +0200)]
Make elf section sorting more deterministic

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 section index to tell entries apart.

Signed-off-by: Ulf Hermann <ulf.hermann@qt.io>
Signed-off-by: Mark Wielaard <mark@klomp.org>
7 years agoDon't look for kernel version if not running on linux
Ulf Hermann [Thu, 20 Apr 2017 14:08:48 +0000 (16:08 +0200)]
Don't look for kernel version if not running on linux

We don't want to use it, even if it exists.

Signed-off-by: Ulf Hermann <ulf.hermann@qt.io>
Signed-off-by: Mark Wielaard <mark@klomp.org>
7 years agoAdd frame pointer unwinding for aarch64 and relax backtrace testcases.
Ulf Hermann [Thu, 20 Apr 2017 12:41:35 +0000 (14:41 +0200)]
Add frame pointer unwinding for aarch64 and relax backtrace testcases.

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 up the
well known frame pointer locations in the stack snapshot and use them
to bridge the frames without debug information.

Relax the backtrace core testcases a little by allowing a duplicate
sigusr2 frame or a backtrace ending with an invalid register. Both of
which can happen if the frame pointer unwinder guesses slightly wrong.

Signed-off-by: Ulf Hermann <ulf.hermann@qt.io>
Signed-off-by: Mark Wielaard <mark@klomp.org>
7 years agoAdd i386 frame pointer unwinder.
Mark Wielaard [Thu, 6 Apr 2017 22:06:30 +0000 (00:06 +0200)]
Add i386 frame pointer unwinder.

Add a simple i386_unwind.c frame pointer unwinder as fallback if DWARF/CFI
unwinding fails.

Signed-off-by: Mark Wielaard <mark@klomp.org>
7 years agoAdd frame pointer unwinding as fallback on x86_64
Ulf Hermann [Fri, 10 Feb 2017 14:19:40 +0000 (15:19 +0100)]
Add frame pointer unwinding as fallback on x86_64

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 up the
well known frame pointer locations in the stack snapshot and use them
to bridge the frames without debug information.

The "unwind" hook is the right place for this as it is so far only
used on s390 and called only after trying to unwind with debug
information.

Signed-off-by: Ulf Hermann <ulf.hermann@qt.io>
7 years agotests: Add core backtracegen check and regen ppc32 backtrace testfiles.
Mark Wielaard [Tue, 25 Apr 2017 10:41:58 +0000 (12:41 +0200)]
tests: Add core backtracegen check and regen ppc32 backtrace testfiles.

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 (which could happen on a bad frame
pointer only unwind).

This showed that the ppc32 backtrace test files were missing DWARF CFI
for the main executable. Regenerated them to include full CFI.

Signed-off-by: Mark Wielaard <mark@klomp.org>
7 years agoRevert "Optionally allow unknown symbols in the backtrace tests"
Mark Wielaard [Mon, 24 Apr 2017 11:35:47 +0000 (13:35 +0200)]
Revert "Optionally allow unknown symbols in the backtrace tests"

This reverts commit f9971cb422df39adea7e8c7e22689b879e39c626.

Allowing no symbol resolving at all makes it too hard to see
whether the test actually tests anything.

But do keep "address out of range" as allowed error in check_err.
This can be interpreted as DWARF not available (if end of callstack
marker is missing, which it unfortunately often is missing even if CFI
is available.).

Signed-off-by: Mark Wielaard <mark@klomp.org>
7 years agoAvoid double-including config.h
Ulf Hermann [Thu, 20 Apr 2017 14:31:02 +0000 (16:31 +0200)]
Avoid double-including config.h

config.h doesn't have include guards, so including it twice is bad. We
deal with this by checking for PACKAGE_NAME, but only in some places.
Once we start using gnulib, we will need to include config.h before any
gnulib-generated headers. This is problematic if we include it
transitively through our own private headers.

In order to set a clear rule about inclusion of config.h, it is now
included in every .c file as first header, but not in any header. This
will definitely avoid double-inclusion and satisfy the condition that it
has to be included before gnulib headers. It comes at the price of
adding some redundancy, but there is no clean way to avoid this.

Signed-off-by: Ulf Hermann <ulf.hermann@qt.io>
7 years agoUse F_GETFD rather than F_GETFL to check validity of file descriptor
Ulf Hermann [Thu, 20 Apr 2017 13:58:43 +0000 (15:58 +0200)]
Use F_GETFD rather than F_GETFL to check validity of file descriptor

F_GETFD is both cheaper and easier to port, and otherwise has the same
effect here.

Signed-off-by: Ulf Hermann <ulf.hermann@qt.io>
7 years agoMake __attribute__ conditional in all installed headers
Ulf Hermann [Thu, 20 Apr 2017 13:55:47 +0000 (15:55 +0200)]
Make __attribute__ conditional in all installed headers

__attribute__ is a GNU extension. If we want to link against the
libraries using a different compiler, it needs to be disabled. It was
already disabled in libdw.h, and this patch extends this to the other
headers. We move the defines to libelf.h as that is included in all
the others.

Signed-off-by: Ulf Hermann <ulf.hermann@qt.io>
7 years agoFix nesting of braces
Ulf Hermann [Thu, 27 Apr 2017 14:35:23 +0000 (16:35 +0200)]
Fix nesting of braces

The way it was before it didn't actually test if elf_update failed, but
rather did something random. !!(<some number>) is a boolean and boolean
true can be represented as anything non-0, including negative numbers.

Signed-off-by: Ulf Hermann <ulf.hermann@qt.io>
7 years agoOn elf_update, remember when we mmap()
Ulf Hermann [Thu, 20 Apr 2017 14:57:41 +0000 (16:57 +0200)]
On elf_update, remember when we mmap()

Otherwise we skip the munmap() later. This leaks resources.

Signed-off-by: Ulf Hermann <ulf.hermann@qt.io>
7 years agoAvoid signed/unsigned comparison
Ulf Hermann [Thu, 20 Apr 2017 14:40:30 +0000 (16:40 +0200)]
Avoid signed/unsigned comparison

Some compilers implicitly cast the result of uint_fast16_t *
uint_fast16_t to something signed and then complain about the
comparison to (unsigned) size_t.

Casting phnum to size_t is a good idea anyway as 16bit multiplication
can easily overflow and we are not checking for this.

Signed-off-by: Ulf Hermann <ulf.hermann@qt.io>
7 years agoInclude strings.h to make ffs available
Ulf Hermann [Thu, 20 Apr 2017 14:33:28 +0000 (16:33 +0200)]
Include strings.h to make ffs available

We cannot rely on it to be available from any of the other headers.

Signed-off-by: Ulf Hermann <ulf.hermann@qt.io>
7 years agoProtect against integer overflow on shnum
Ulf Hermann [Thu, 20 Apr 2017 14:04:54 +0000 (16:04 +0200)]
Protect against integer overflow on shnum

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 <ulf.hermann@qt.io>
7 years agoAdd EXEEXT to gendis
Ulf Hermann [Thu, 20 Apr 2017 15:02:42 +0000 (17:02 +0200)]
Add EXEEXT to gendis

Otherwise the build will fail on systems that actually need file
extension for executables.

Signed-off-by: Ulf Hermann <ulf.hermann@qt.io>
7 years agoInclude endian.h when handling BYTE_ORDER
Ulf Hermann [Thu, 20 Apr 2017 15:07:37 +0000 (17:07 +0200)]
Include endian.h when handling BYTE_ORDER

BYTE_ORDER and friends are customarily defined in endian.h.

Signed-off-by: Ulf Hermann <ulf.hermann@qt.io>
7 years agoAdd missing entries to .gitignore
Ulf Hermann [Fri, 21 Apr 2017 16:51:08 +0000 (18:51 +0200)]
Add missing entries to .gitignore

Signed-off-by: Ulf Hermann <ulf.hermann@qt.io>
7 years agoAvoid YESSTR and NOSTR
Ulf Hermann [Thu, 20 Apr 2017 13:47:49 +0000 (15:47 +0200)]
Avoid YESSTR and NOSTR

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 <ulf.hermann@qt.io>
7 years agoDon't use comparison_fn_t
Ulf Hermann [Thu, 20 Apr 2017 13:40:46 +0000 (15:40 +0200)]
Don't use comparison_fn_t

Not all search.h declare it, and it is not very helpful anyway.

Signed-off-by: Ulf Hermann <ulf.hermann@qt.io>
7 years agoClean up linux-specific system includes
Ulf Hermann [Thu, 20 Apr 2017 13:37:04 +0000 (15:37 +0200)]
Clean up linux-specific system includes

We only include them where we actually need them and only on linux.

Signed-off-by: Ulf Hermann <ulf.hermann@qt.io>
7 years agoInclude sys/types.h before fts.h
Ulf Hermann [Thu, 20 Apr 2017 14:45:51 +0000 (16:45 +0200)]
Include sys/types.h before fts.h

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 <ulf.hermann@qt.io>
7 years agolibelf: Initialize n to zero in elf_getarsym.
Mark Wielaard [Wed, 19 Apr 2017 15:07:46 +0000 (17:07 +0200)]
libelf: Initialize n to zero in elf_getarsym.

When building with gcc -Os it seems we can inline read_number_entries
but if that function fails then n will not be initialized. GCC seems not
to realize that in that case n won't be used at all. Explicitly initialize
n to zero to prevent a spurious error: 'n' may be used uninitialized in
this function [-Werror=maybe-uninitialized] in that case.

https://sourceware.org/bugzilla/show_bug.cgi?id=21011

Signed-off-by: Mark Wielaard <mark@klomp.org>
7 years agoAdd missing peel_type.c test for commit f339da.
Mark Wielaard [Thu, 6 Apr 2017 22:13:47 +0000 (00:13 +0200)]
Add missing peel_type.c test for commit f339da.

Signed-off-by: Mark Wielaard <mark@klomp.org>
7 years agoelflint: Support checking ELF files with compressed sections.
Mark Wielaard [Wed, 5 Apr 2017 15:09:27 +0000 (17:09 +0200)]
elflint: Support checking ELF files with compressed sections.

Simply unconditionally uncompress any section to make sure indexes between
sections check out. Add some testcases with various compressed sections.

https://sourceware.org/bugzilla/show_bug.cgi?id=21332

Signed-off-by: Mark Wielaard <mark@klomp.org>
7 years agolibdw: Fix dwarf_peel_type infinite loop.
Mark Wielaard [Thu, 30 Mar 2017 10:19:53 +0000 (12:19 +0200)]
libdw: Fix dwarf_peel_type infinite loop.

We were calling dwarf_attr_integrate () in the die in the loop instead of
on the result. Which would cause an infinite loop when die != result.
Add a testcase that explicitly checks this case.

https://sourceware.org/bugzilla/show_bug.cgi?id=21330

Signed-off-by: Mark Wielaard <mark@klomp.org>
7 years agoelflint: Don't check section group without flags word.
Mark Wielaard [Tue, 28 Mar 2017 11:33:03 +0000 (13:33 +0200)]
elflint: Don't check section group without flags word.

https://sourceware.org/bugzilla/show_bug.cgi?id=21320

Signed-off-by: Mark Wielaard <mark@klomp.org>
7 years agoelflint: Sanity check the number of phdrs and shdrs available.
Mark Wielaard [Mon, 27 Mar 2017 23:25:34 +0000 (01:25 +0200)]
elflint: Sanity check the number of phdrs and shdrs available.

Make sure we can at least read the shnum sections or phnum segments.
Limit the number we do check to those we can actually read.

https://sourceware.org/bugzilla/show_bug.cgi?id=21312

Signed-off-by: Mark Wielaard <mark@klomp.org>
7 years agoelflint: Don't trust sh_entsize when checking hash sections.
Mark Wielaard [Mon, 27 Mar 2017 22:38:52 +0000 (00:38 +0200)]
elflint: Don't trust sh_entsize when checking hash sections.

Calculate and use the expected entsize instead of relying on the one
given by the ELF file section header. Return early if there isn't enough
data in the section to check the full hash table.

https://sourceware.org/bugzilla/show_bug.cgi?id=21311

Signed-off-by: Mark Wielaard <mark@klomp.org>
7 years agoelflint: Check symbol table data is big enough before checking.
Mark Wielaard [Mon, 27 Mar 2017 21:59:02 +0000 (23:59 +0200)]
elflint: Check symbol table data is big enough before checking.

Before checking symbol index zero we should make sure the data size
is big enough.

https://sourceware.org/bugzilla/show_bug.cgi?id=21310

Signed-off-by: Mark Wielaard <mark@klomp.org>
7 years agolibelf: Always update last_offset in updatefile and updatemmap.
Mark Wielaard [Mon, 27 Mar 2017 15:01:57 +0000 (17:01 +0200)]
libelf: Always update last_offset in updatefile and updatemmap.

When ELF section data was used, but not updated or marked as dirty and
there also existed non-dirty sections and some padding was needed between
the sections (possibly because of alignment) then elf_update might write
"fill" over some of the existing data. This happened because in that case
the last_position was not updated correctly.

Includes a new testcase fillfile that fails before this patch by showing
fill instead of the expected data in some section data. It succeeds with
this patch.

https://sourceware.org/bugzilla/show_bug.cgi?id=21199

Signed-off-by: Mark Wielaard <mark@klomp.org>
7 years agolibelf: Check compression ratio before trying to allocate output buffer.
Mark Wielaard [Fri, 24 Mar 2017 14:06:04 +0000 (15:06 +0100)]
libelf: Check compression ratio before trying to allocate output buffer.

The maximum compression factor (http://www.zlib.net/zlib_tech.html) is
1032:1. Add a sanity check for that before trying to allocate lots of
memory and trying to decompress lots of bogus data.

https://sourceware.org/bugzilla/show_bug.cgi?id=21301

Signed-off-by: Mark Wielaard <mark@klomp.org>
7 years agoUse the empty string for note names with zero size (without any data).
Mark Wielaard [Fri, 24 Mar 2017 13:10:26 +0000 (14:10 +0100)]
Use the empty string for note names with zero size (without any data).

ELF notes can have a zero sized name. In which case there is no data at
all (so also no zero terminator). Make sure to use the empty string for
such notes if the code does not otherwise explicitly check n_namesz.

https://sourceware.org/bugzilla/show_bug.cgi?id=21300

Signed-off-by: Mark Wielaard <mark@klomp.org>
7 years agoreadelf: Fix off by one sanity check in handle_gnu_hash.
Mark Wielaard [Fri, 24 Mar 2017 11:15:02 +0000 (12:15 +0100)]
readelf: Fix off by one sanity check in handle_gnu_hash.

We sanity check to make sure we don't index outside the chain array
by testing inner > max_nsyms. But inner is a zero-based index, while
max_nsyms is the maximum number. Change the check to inner >= max_nsyms.

https://sourceware.org/bugzilla/show_bug.cgi?id=21299

Signed-off-by: Mark Wielaard <mark@klomp.org>
7 years agolibasm: Fix one GCC7 -Wformat-truncation=2 warning.
Mark Wielaard [Sun, 12 Feb 2017 20:51:34 +0000 (21:51 +0100)]
libasm: Fix one GCC7 -Wformat-truncation=2 warning.

Make sure that if we have really lots of labels the tempsym doesn't get
truncated because it is too small to hold the whole name.

This doesn't enable -Wformat-truncation=2 or fix other "issues" pointed
out by enabling this warning because there are currently some issues
with it. https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79448

Signed-off-by: Mark Wielaard <mark@klomp.org>
7 years agobackends: Add support for EM_PPC64 GNU_ATTRIBUTES.
Mark Wielaard [Wed, 15 Feb 2017 13:30:27 +0000 (14:30 +0100)]
backends: Add support for EM_PPC64 GNU_ATTRIBUTES.

ppc64 and ppc64le ELF files can also contain a power specific
.gnu.attributes section. Add support for those and recognize the new
GNU_Power_ABI_FP Single-precision hard float value.

Signed-off-by: Mark Wielaard <mark@klomp.org>
7 years agoMove print_version into printversion.{h|c}
Ulf Hermann [Thu, 16 Feb 2017 11:32:02 +0000 (12:32 +0100)]
Move print_version into printversion.{h|c}

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 <ulf.hermann@qt.io>
7 years agoCheck for existence of mempcpy
Ulf Hermann [Thu, 16 Feb 2017 09:10:30 +0000 (10:10 +0100)]
Check for existence of mempcpy

If it doesn't exist, provide a definition based on memcpy.

Signed-off-by: Ulf Hermann <ulf.hermann@qt.io>
7 years agoAlways use the same method to query the system page size
Ulf Hermann [Wed, 15 Feb 2017 14:28:38 +0000 (15:28 +0100)]
Always use the same method to query the system page size

This makes it easier to write a replacement for it on systems where
sysconf(3) doesn't exist.

Signed-off-by: Ulf Hermann <ulf.hermann@qt.io>
7 years agoMove color handling into a separate header
Ulf Hermann [Tue, 14 Feb 2017 13:30:47 +0000 (14:30 +0100)]
Move color handling into a separate header

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 <ulf.hermann@qt.io>
7 years agoAdd -D_FORTIFY_SOURCE=2 to CFLAGS if possible.
Mark Wielaard [Thu, 9 Feb 2017 20:09:54 +0000 (21:09 +0100)]
Add -D_FORTIFY_SOURCE=2 to CFLAGS if possible.

Some distros now add -D_FORTIFY_SOURCE=2 by default and we have missed
some issues in the past caught by it. Add it to CFLAGS if possible.
The configure check will make sure that it doesn't conflict with any
other CFLAGS already defined.

Signed-off-by: Mark Wielaard <mark@klomp.org>
7 years agoOptionally allow unknown symbols in the backtrace tests
Ulf Hermann [Fri, 10 Feb 2017 14:19:40 +0000 (15:19 +0100)]
Optionally allow unknown symbols in the backtrace tests

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 <ulf.hermann@qt.io>
7 years agoMake the backtrace-data test helper more robust
Ulf Hermann [Fri, 10 Feb 2017 14:19:01 +0000 (15:19 +0100)]
Make the backtrace-data test helper more robust

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 <ulf.hermann@qt.io>
7 years agoAdd missing tests to .gitignore
Ulf Hermann [Fri, 10 Feb 2017 14:18:10 +0000 (15:18 +0100)]
Add missing tests to .gitignore

Some test binaries were missing and showed up in "git status".

Signed-off-by: Ulf Hermann <ulf.hermann@qt.io>
7 years agoDefine PACKAGE_URL for older autoconf.
Mark Wielaard [Thu, 12 Jan 2017 10:43:30 +0000 (11:43 +0100)]
Define PACKAGE_URL for older autoconf.

autoconf < 2.64 doesn't define PACKAGE_URL through AC_INIT.
Define it ourselves if needed.

Signed-off-by: Mark Wielaard <mark@klomp.org>
7 years agoFix TEMP_FAILURE_RETRY definition when not defined.
Luiz Angelo Daros de Luca [Thu, 29 Dec 2016 23:02:57 +0000 (21:02 -0200)]
Fix TEMP_FAILURE_RETRY definition when not defined.

https://sourceware.org/bugzilla/show_bug.cgi?id=21001

Signed-off-by: Luiz Angelo Daros de Luca <luizluca@gmail.com>
7 years agoUpdate Polish translation
Piotr Drąg [Thu, 29 Dec 2016 16:54:13 +0000 (17:54 +0100)]
Update Polish translation

https://sourceware.org/bugzilla/show_bug.cgi?id=20999

Signed-off-by: Piotr Drąg <piotrdrag@gmail.com>
7 years agoUpdate POTFILES.in
Piotr Drąg [Thu, 29 Dec 2016 16:43:01 +0000 (17:43 +0100)]
Update POTFILES.in

https://sourceware.org/bugzilla/show_bug.cgi?id=20999

Signed-off-by: Piotr Drąg <piotrdrag@gmail.com>
7 years agoUpdate Polish translation
Piotr Drąg [Wed, 28 Dec 2016 18:30:55 +0000 (19:30 +0100)]
Update Polish translation

https://sourceware.org/bugzilla/show_bug.cgi?id=20999

Signed-off-by: Piotr Drąg <piotrdrag@gmail.com>
7 years agoPrepare for elfutils 0.168 release. elfutils-0.168
Mark Wielaard [Tue, 27 Dec 2016 14:23:53 +0000 (15:23 +0100)]
Prepare for elfutils 0.168 release.

Signed-off-by: Mark Wielaard <mark@klomp.org>
7 years agohttp://elfutils.org/ is now hosted at http://sourceware.org/elfutils/
Mark Wielaard [Sat, 24 Dec 2016 21:31:41 +0000 (22:31 +0100)]
elfutils.org/ is now hosted at http://sourceware.org/elfutils/

fedorahosted used to be our home, but we are now hosted at sourceware.

Change the elfutils project home to http://elfutils.org/
Point hosted services (email, release, git, bug tracker and web pages)
to https://sourceware.org/elfutils/

Move design notes from README to NOTES.
Add URLs for home, releases, bugs, git and mailinglist to README.

Make the --version output of all tools the same by using a common
print_version function and update the publicly shown copyright holder
to the elfutils developers.

Signed-off-by: Mark Wielaard <mark@klomp.org>
7 years agolibelf: gelf_newehdr and gelf_newehdr should return void *.
Akihiko Odaki [Tue, 11 Oct 2016 14:12:11 +0000 (23:12 +0900)]
libelf: gelf_newehdr and gelf_newehdr should return void *.

unsigned long int is not always capable to have pointer in some cases
(LLP64, for example). Return a void pointer instead. Other libelf
implementations will also make this change (or already have).
Also update the documentation to state what is created and that NULL
is returned on error (don't document that the returned value is a
pointer to the actual header created).

Signed-off-by: Akihiko Odaki <akihiko.odaki.4i@stu.hosei.ac.jp>
Signed-off-by: Mark Wielaard <mjw@redhat.com>
7 years agoOnly workaround fts.h if we have a bad version that doesn't handle LFS.
Mark Wielaard [Wed, 23 Nov 2016 19:51:35 +0000 (20:51 +0100)]
Only workaround fts.h if we have a bad version that doesn't handle LFS.

Older versions of glibc included an fts implementation that didn't have
Large File System support. We worked around that in linux-kernel-modules.c
by including it early before config.h and then redefining some symbols
to get the 64-bit versions. This is somewhat fragile and not necessary
with newer glibc. If possible we want the 64bit fts version always.

Signed-off-by: Mark Wielaard <mjw@redhat.com>
7 years agoreadelf: Add optional --symbols[=SECTION] argument to select section name.
Mark Wielaard [Thu, 17 Nov 2016 14:19:54 +0000 (15:19 +0100)]
readelf: Add optional --symbols[=SECTION] argument to select section name.

Make it possible to display just the symbols from a named symbol section
instead of always displaying all symbol sections.

https://bugzilla.redhat.com/show_bug.cgi?id=1396092

Signed-off-by: Mark Wielaard <mjw@redhat.com>
7 years agoar: Fix GCC7 -Wformat-length issues.
Mark Wielaard [Thu, 10 Nov 2016 17:45:02 +0000 (18:45 +0100)]
ar: Fix GCC7 -Wformat-length issues.

GCC7 adds warnings for snprintf formatting into too small buffers.
Fix the two issues pointed out by the new warning. The ar header
fields are fixed length containing left-justified strings without
zero terminator. snprintf always adds a '\0' char at the end (which
we then don't copy into the ar header field) and numbers are decimal
strings of fixed 10 chars  (-Wformat-length thinks formatting
them as size_t might overflow the buffer on 64bit arches).

Signed-off-by: Mark Wielaard <mjw@redhat.com>
7 years agolibelf: Sanity check offset and size before trying to malloc and read data.
Mark Wielaard [Fri, 21 Oct 2016 13:24:34 +0000 (15:24 +0200)]
libelf: Sanity check offset and size before trying to malloc and read data.

Bad sh_off or sh_size could trigger a bad malloc or read. Sanity check
the header values first before trying to malloc a huge buffer or reading
any data that will certainly fail.

https://bugzilla.redhat.com/show_bug.cgi?id=1387584

Signed-off-by: Mark Wielaard <mjw@redhat.com>
7 years agolibelf: Always set ELF maxsize when reading an ELF file for sanity checks.
Mark Wielaard [Wed, 26 Oct 2016 11:08:52 +0000 (13:08 +0200)]
libelf: Always set ELF maxsize when reading an ELF file for sanity checks.

There are various sanity checks that depend on knowing the file size
of the underlying ELF file which we only used when mmapping the ELF file.
Although we probably won't crash if we use pread to try to read from
the file, we still might return completely bogus data structures. This
could cause us to malloc insane amounts of memory.

Always try to get the maxsize when unknown in elf_begin.c (read_file).

https://bugzilla.redhat.com/show_bug.cgi?id=1388057

Signed-off-by: Mark Wielaard <mjw@redhat.com>
7 years agolibdw: Correct spelling of DW_LANG_PLI in dwarf.h.
Mark Wielaard [Sat, 22 Oct 2016 17:18:51 +0000 (19:18 +0200)]
libdw: Correct spelling of DW_LANG_PLI in dwarf.h.

The name used in the standard and other DWARF implementations for
Programming Language One, PL/I, is DW_LANG_PLI (not DW_LANG_PL1).

Fix usage in dwarf_aggregate_size.

Signed-off-by: Mark Wielaard <mjw@redhat.com>
7 years agoAdd GCC7 -Wimplicit-fallthrough support/fixes.
Mark Wielaard [Wed, 2 Nov 2016 12:29:26 +0000 (13:29 +0100)]
Add GCC7 -Wimplicit-fallthrough support/fixes.

GCC7 will have a new -Wimplicit-fallthrough warning. It did catch one
small buglet in elflint option procession. So it seems useful to enable
to make sure all swatch case fallthroughs are deliberate.

Add configure check to detect whether gcc support -Wimplicit-fallthrough
and enable it. Add fixes and explicit fallthrough comments where necessary.

Signed-off-by: Mark Wielaard <mjw@redhat.com>
7 years agotests: unstrip: Add test for mismatched .strtab sections
Kevin Cernekee [Sun, 23 Oct 2016 17:25:56 +0000 (10:25 -0700)]
tests: unstrip: Add test for mismatched .strtab sections

Current unstrip test cases either have no .symtab/.strtab in the
stripped binary, or .strtab sections that are identical between the
stripped and debuginfo binaries.  Add a test case where .symtab/.strtab
in the stripped binary contains a small subset of the full unstripped
data.

Signed-off-by: Kevin Cernekee <cernekee@chromium.org>
7 years agounstrip: Don't try to use unstripped .symtab with stripped .strtab
Kevin Cernekee [Sun, 23 Oct 2016 17:25:55 +0000 (10:25 -0700)]
unstrip: Don't try to use unstripped .symtab with stripped .strtab

Prematurely matching up the stripped and unstripped .strtab sections
in the "Match each debuginfo" loop can lead to a case where sec->outscn
gets populated for the stripped .strtab, which we normally want to
ignore.  This causes the .strtab override in the "Make sure each main
file section" loop to be skipped, so the code winds up using indices
from the unstripped .symtab to look up strings in the stripped .strtab.
This returns incorrect strings for a little while, and then fails
catastrophically when it tries to read past the end of the (smaller)
stripped file's .strtab section:

    eu-unstrip: invalid string offset in symbol [1589]

Fix this by adding logic to the "Match each debuginfo" loop to
treat the unstripped .strtab, .shstrtab, and .symtab sections
essentially the same way.

The new logic will break if the .strtab section shows up earlier than
the .symtab section.  We will assume this never happens in practice.

Signed-off-by: Kevin Cernekee <cernekee@chromium.org>
7 years agoDo not depend on some non-POSIX features.
Akihiko Odaki [Thu, 13 Oct 2016 00:16:48 +0000 (09:16 +0900)]
Do not depend on some non-POSIX features.

Define/open code memrchr, rawmemchr, powerof2 and TEMP_FAILURE_RETRY if
not available through system headers.

Signed-off-by: Akihiko Odaki <akihiko.odaki.4i@stu.hosei.ac.jp>
Signed-off-by: Mark Wielaard <mjw@redhat.com>
7 years agolib: Provide MAX and MIN in system.h
Akihiko Odaki [Tue, 11 Oct 2016 14:06:48 +0000 (23:06 +0900)]
lib: Provide MAX and MIN in system.h

This change also creates a new header file libeu.h to provide the
prototypes for the function of libeu. That hides the definition of function
crc32, which can conflict with zlib, from libelf. It also prevents mistakes
to refer those functions from a component which doesn't link with libeu,
such as libelf.

Signed-off-by: Akihiko Odaki <akihiko.odaki.4i@stu.hosei.ac.jp>
7 years agostrip: Don't remove real symbols from allocated symbol tables.
Mark Wielaard [Thu, 6 Oct 2016 14:06:32 +0000 (16:06 +0200)]
strip: Don't remove real symbols from allocated symbol tables.

Having a symbol in an allocated symbol table (like .dynsym) that
points to an unallocated section is wrong. Traditionally strip
has removed such symbols if they are section or group symbols.
But removing a real symbol from an allocate symbol table is hard
and probably a mistake. Really removing it means rewriting the
dynamic segment and hash sections. Since we don't do that, don't
remove the symbol (and corrupt the ELF file). Do warn and set
the symbol section to SHN_UNDEF.

https://bugzilla.redhat.com/show_bug.cgi?id=1380961

Signed-off-by: Mark Wielaard <mjw@redhat.com>
7 years agolibcpu: Fix build of bpf_disasm.c for kernels < 3.20.
Mark Wielaard [Mon, 5 Sep 2016 09:15:50 +0000 (11:15 +0200)]
libcpu: Fix build of bpf_disasm.c for kernels < 3.20.

Before linux 3.20 the BPF_PSEUDO_MAP_FD constant wasn't defined.

Reported-by: Julian Ospald <hasufell@posteo.de>
Signed-off-by: Mark Wielaard <mjw@redhat.com>
7 years agotests: Fix --enable-gcov tests build. Add libdw to LDADD for asm_tsts.
Mark Wielaard [Tue, 30 Aug 2016 11:42:31 +0000 (13:42 +0200)]
tests: Fix --enable-gcov tests build. Add libdw to LDADD for asm_tsts.

Signed-off-by: Mark Wielaard <mjw@redhat.com>
7 years agoRegenerate .po files. elfutils-0.167
Mark Wielaard [Fri, 26 Aug 2016 09:55:59 +0000 (11:55 +0200)]
Regenerate .po files.

Signed-off-by: Mark Wielaard <mjw@redhat.com>
7 years agotests: Simplify backtrace-native tests. Drop raise jmp patching for x86_64.
Mark Wielaard [Thu, 25 Aug 2016 15:17:23 +0000 (17:17 +0200)]
tests: Simplify backtrace-native tests. Drop raise jmp patching for x86_64.

The backtrace-native[-biarch] testcase was a little too clever in places
making it unreliable.

On x86_64 we tried to make an interesting backtrace by catching the
first signal and then replacing the pc with the address of the first
instruction of a function. Then we would raise a new signal, through
ptrace, to create a backtrace that went from a signal frame into a
frame at the start of a function. That way we could check that we were
trying to fetch the correct CFI for the (jmp) function even at the
first instruction (normally we would substract one from the return
address to get at the call address).

This works as long as the CFI for the jmp() function is identical to
the CFI for the raise() function that we "patched away". Unfortunately
on Fedora rawhide glibc has a rewritten raise() implementation that has
different CFI, in particular the CFA is calculated differently. Making
the testcase fail because we cannot properly unwind from jmp().
So this special x86_64 case has been disabled (the code is still there
in case we find another way to test this in a more reliable way).

On Ubuntu there have been spurious testcase failures because
see_exec_module found two Dwfl_Modules with the same path. This would
trigger an assert. Although this might indicate some issue (maybe we
are not parsing the proc/pid/map correctly?) it isn't clear that it
really is a bug. Since the assert is not very helpful finding any
actual bug and for the testcase it is only necessary that the first
Dwfl_Module that represents the executable is found we just pick that
Dwfl_Module and don't iterate through any of the others.

Signed-off-by: Mark Wielaard <mjw@redhat.com>
7 years agostrip: Use ELF_CHF_FORCE to recompress any sections that were uncompressed.
Mark Wielaard [Thu, 25 Aug 2016 18:43:42 +0000 (20:43 +0200)]
strip: Use ELF_CHF_FORCE to recompress any sections that were uncompressed.

Older gcc might create small .debug_pubtype. If such a section is compressed
then strip should use ELF_CHF_FORCE to return it to compressed state after it
is done with the section. Found by the run-strip-reloc.sh testcase on rhel6.

Signed-off-by: Mark Wielaard <mjw@redhat.com>
7 years agoRegenerate .po files.
Mark Wielaard [Wed, 24 Aug 2016 17:42:31 +0000 (19:42 +0200)]
Regenerate .po files.

Signed-off-by: Mark Wielaard <mjw@redhat.com>
7 years agotests: Add testfilesparc64attrs.o.bz2 to EXTRA_DIST.
Mark Wielaard [Wed, 24 Aug 2016 15:55:53 +0000 (17:55 +0200)]
tests: Add testfilesparc64attrs.o.bz2 to EXTRA_DIST.

Signed-off-by: Mark Wielaard <mjw@redhat.com>
7 years agosparc: fix the printing of hw capabilities object attributes.
Jose E. Marchesi [Wed, 24 Aug 2016 13:47:57 +0000 (06:47 -0700)]
sparc: fix the printing of hw capabilities object attributes.

The GNU_Sparc_HWCAPS and GNU_Sparc_HWCAPS2 object attributes comprise
a set of hardware capabilities that may (or not) be present in the
target machine for which the object was compiled.  This patch adds the
support for printing a nicely formatted comma-separated list with the
selected hw capabilities.

Signed-off-by: Jose E. Marchesi <jose.marchesi@oracle.com>
7 years agoUpdated Polish translation
Piotr Drąg [Thu, 18 Aug 2016 13:33:54 +0000 (15:33 +0200)]
Updated Polish translation

https://bugzilla.redhat.com/show_bug.cgi?id=1368130

Signed-off-by: Piotr Drąg <piotrdrag@gmail.com>
7 years agoAdd --add-comments to XGETTEXT_OPTIONS in Makevars
Piotr Drąg [Thu, 18 Aug 2016 13:18:00 +0000 (15:18 +0200)]
Add --add-comments to XGETTEXT_OPTIONS in Makevars

So that translator comments show up in .po files.

https://bugzilla.redhat.com/show_bug.cgi?id=1368130

Signed-off-by: Piotr Drąg <piotrdrag@gmail.com>
7 years agoUpdate POTFILES.in
Piotr Drąg [Thu, 18 Aug 2016 13:10:09 +0000 (15:10 +0200)]
Update POTFILES.in

https://bugzilla.redhat.com/show_bug.cgi?id=1368130

Signed-off-by: Piotr Drąg <piotrdrag@gmail.com>
7 years agolibdwfl: Fix assert and set in.d_size in dwfl_link_map_report.
Mark Wielaard [Fri, 12 Aug 2016 09:36:10 +0000 (11:36 +0200)]
libdwfl: Fix assert and set in.d_size in dwfl_link_map_report.

When reading the phdrs from a core file segment fails we would try to read
them from the exec. This fallback path contained a faulty assert that the
requested size of the phdrs was still setup. But the core file reading
callback might have reset the d_size value to zero on error. So explicitly
set the number of bytes we want to read again instead of asserting the size.

https://bugzilla.redhat.com/show_bug.cgi?id=1365812

Signed-off-by: Mark Wielaard <mjw@redhat.com>
7 years agolibelf: Fix memory leak in elf_compress for mmapped ELF files.
Mark Wielaard [Sun, 7 Aug 2016 20:13:46 +0000 (22:13 +0200)]
libelf: Fix memory leak in elf_compress for mmapped ELF files.

The testcase added to run-strip-reloc.sh for strip-compressed.o showed
a memory leak when ran under valgrind (configure --enable-valgrind).

For a mmapped ELF file when existing section data was compressed
elf_end would fail to release the new compressed data buffer assigned
to rawdata_base. For non-mapped files rawdata_base is always freed.
For decompressed data rawdata_base is released together with zdata_base.

Use the Elf_Scn flag ELF_T_MALLOCED to track whether rawdata_base
points to malloced memory and free it in elf_end even for mmapped
ELF files.

Signed-off-by: Mark Wielaard <mjw@redhat.com>
7 years agostrip: Handle compressed relocation target sections.
Mark Wielaard [Sat, 6 Aug 2016 13:13:19 +0000 (15:13 +0200)]
strip: Handle compressed relocation target sections.

binutils 2.27 assembler will create compressed sections for x86 ELF
targets. The linker will decompress them again and it doesn't do this
for any other target. This broke one of the run-strip-reloc.sh self tests.

Fix by checking if the target of a relocation section is compressed and
first decompressing it before applying relocations and then compressing
again if necessary.

Add explicit testcases for compressed and uncompressed ET_REL files
to run-strip-reloc.sh.

Signed-off-by: Mark Wielaard <mjw@redhat.com>
7 years agoFix bpf disassembler for _FORTIFY_SOURCE
Richard Henderson [Wed, 10 Aug 2016 07:11:21 +0000 (12:41 +0530)]
Fix bpf disassembler for _FORTIFY_SOURCE

It's illegal to skip positional operands for printf.  Rearrange the
printing of the instructions to use exactly the operands required.

Also, fix printing of mod operations: s/%/%%/ in the print format.
Also, fix printing of endian operations: remove extra spaces.

7 years agoPrepare 0.167 release.
Mark Wielaard [Thu, 4 Aug 2016 11:36:34 +0000 (13:36 +0200)]
Prepare 0.167 release.

Signed-off-by: Mark Wielaard <mjw@redhat.com>
7 years agodwelf: Add string table functions from ebl.
Mark Wielaard [Fri, 8 Jul 2016 12:08:22 +0000 (14:08 +0200)]
dwelf: Add string table functions from ebl.

Move the strtab functions from libebl to libdw. Programs often want to
create ELF/DWARF string tables. We don't want (static) linking against
ebl since those are internal functions that might change.

This introduces dwelf_strtab_init, dwelf_strtab_add,
dwelf_strtab_add_len, dwelf_strtab_finalize, dwelf_strent_off,
dwelf_strent_str and dwelf_strtab_free. Documentation for each has
been added to libdwelf.h. The add fucntion got a variant that takes
the length explicitly and finalize was changed to return NULL on
out of memory instead of aborting. All code and tests now uses the
new functions.

Signed-off-by: Mark Wielaard <mjw@redhat.com>
7 years agoRemove eu-ld and unused code.
Mark Wielaard [Wed, 6 Jul 2016 16:27:54 +0000 (18:27 +0200)]
Remove eu-ld and unused code.

Nobody has hacked on eu-ld in a very long time. It didn't really work.
And we didn't install it by default in the spec file. Remove sources,
the build rules and any (now) unused code.

Signed-off-by: Mark Wielaard <mjw@redhat.com>