platform/upstream/elfutils.git
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>
8 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>
8 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>
8 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>
8 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>
8 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>
8 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>
8 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>
8 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>
8 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>
8 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>
8 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>
8 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>
8 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>
8 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>
8 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>
8 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>
8 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>
8 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>
8 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>
8 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.

8 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>
8 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>
8 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>
8 years agoAdd m68k tests
Andreas Schwab [Sun, 10 Jul 2016 15:36:38 +0000 (17:36 +0200)]
Add m68k tests

Signed-off-by: Andreas Schwab <schwab@linux-m68k.org>
8 years agounstrip: Fix off by one array access with unstripped_strent.
Mark Wielaard [Wed, 6 Jul 2016 19:31:54 +0000 (21:31 +0200)]
unstrip: Fix off by one array access with unstripped_strent.

When configuring with --enable-sanitize-undefined the latest GCC found
an array out of bounds access when running the un-strip-strmerge.sh test.
We keep an array of section names. But skipped section zero, since it
didn't have a name. We should however not actually skip the first array
index (zero) when storing and reading the names.

Signed-off-by: Mark Wielaard <mjw@redhat.com>
8 years agolibelf: Allow updating phdrs for any e_type.
Mark Wielaard [Wed, 6 Jul 2016 13:27:56 +0000 (15:27 +0200)]
libelf: Allow updating phdrs for any e_type.

elf[32|64]_updatenull would sanity check the e_type before allowing to
update the phdrs. This prevents creating an ET_REL file with phdrs. It
also prevents creating any vendor specific ELF file having phdrs. We
only check this when updating/writing out the file. But we would just
read such files. Don't prevent people from creating unexpected ELF files.
elflint will warn for such files.

While writing a new testcase for this another bug was found that
prevented updating a just created phdr because elf_getphdrnum would
sanity check the phdr offset in the file (which doesn't exist yet).
Fix that by only doing such a sanity check if the phdrs haven't been
read in or created yet.

This second bug should have been found by the existing elfshphehdr
test, but that test contained a typo checking elf_getphdrnum.
It tested that the called failed when there were no phdrs, but then
elf_getphdrnum should simply succeed and return zero.

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

Signed-off-by: Mark Wielaard <mjw@redhat.com>
8 years agolibelf: find 1st section instead of assuming
John Ogness [Thu, 23 Jun 2016 14:03:58 +0000 (16:03 +0200)]
libelf: find 1st section instead of assuming

When getting section headers it is assumed that the first section
is on the first section list. However, it is possible that the
first section list only contains the zeroth section, in which
case either illegal memory access occurs or elf_nextscn()
erroneously returns NULL.

With this patch, checks are added to avoid the illegal memory
access and (if available) the second section list is looked at
to find the first section.

A new test emptyfile is added that tests adding a section to
and "empty" ELF file 32/64 class with ELF_C_RDWR[_MMAP].

Signed-off-by: John Ogness <john.ogness@linutronix.de>
Signed-off-by: Mark Wielaard <mjw@redhat.com>
8 years agoAdd support for BPF
Richard Henderson [Tue, 21 Jun 2016 22:10:10 +0000 (15:10 -0700)]
Add support for BPF

Signed-off-by: Richard Henderson <rth@redhat.com>
8 years agoSync elf.h from glibc
Richard Henderson [Tue, 21 Jun 2016 22:10:09 +0000 (15:10 -0700)]
Sync elf.h from glibc

Add lots of new EM_* definitions.
Add R_BPF_* definitions.

Signed-off-by: Richard Henderson <rth@redhat.com>
8 years agoCONTRIBUTING: Extend patch, committer and maintainer guidelines.
Mark Wielaard [Fri, 10 Jun 2016 12:03:15 +0000 (14:03 +0200)]
CONTRIBUTING: Extend patch, committer and maintainer guidelines.

Signed-off-by: Mark Wielaard <mjw@redhat.com>
8 years agoAdd support for m68k
Andreas Schwab [Fri, 20 May 2016 17:37:29 +0000 (19:37 +0200)]
Add support for m68k

Signed-off-by: Andreas Schwab <schwab@linux-m68k.org>
8 years agoconfig: Pass the compiler -Werror during warning detection
Filipe Brandenburger [Mon, 2 May 2016 20:26:13 +0000 (13:26 -0700)]
config: Pass the compiler -Werror during warning detection

Otherwise the compilation prints a warning but exits with 0 return code.
However, later during the compilation, when -Werror is enforced to about
every file, the unsupported options start breaking the builds.

Tested: Ran configure with clang-3.5 and built libelf/ tree with it.

  $ autoreconf -i
  $ ./configure CC=clang-3.5 ...
  $ make -C libelf

Signed-off-by: Filipe Brandenburger <filbranden@google.com>
8 years agoconfig: Fix check for argp_parse to pass &argv
Filipe Brandenburger [Mon, 2 May 2016 19:18:47 +0000 (12:18 -0700)]
config: Fix check for argp_parse to pass &argv

Right now it's passing a char* when it expects a char** instead.

This usually produces a warning that may go unnoticed, but if CFLAGS
contains -Werror, that breaks the ./configure run with the following
error:

  $ ./configure CFLAGS=-Werror
  ...
  configure: WARNING: "libc does not have argp"
  checking for argp_parse in -largp... no
  configure: error: "no libargp found"

Tested: Checked that after this fix, running ./configure CFLAGS=-Werror
works as expected and argp_parse is correctly detected.

Signed-off-by: Filipe Brandenburger <filbranden@google.com>
8 years agolibdwfl: Fix memory leak in dwfl_module_getsrc_file on invalid DWARF.
Mark Wielaard [Thu, 14 Apr 2016 19:53:33 +0000 (21:53 +0200)]
libdwfl: Fix memory leak in dwfl_module_getsrc_file on invalid DWARF.

If we allocated the match results array ourselves, then free it when
we detect invalid DWARF and return an error.

Signed-off-by: Mark Wielaard <mjw@redhat.com>
8 years agolibdwfl: Fix memory leak in proc_maps_report on bad file mapping.
Mark Wielaard [Thu, 14 Apr 2016 19:32:55 +0000 (21:32 +0200)]
libdwfl: Fix memory leak in proc_maps_report on bad file mapping.

Normally last_file is freed inside report(), but in the case of a bad
file mapping we don't call report.

Signed-off-by: Mark Wielaard <mjw@redhat.com>
8 years agolibelf: Fix memory leak when zlib deflateInit fails in elf_compress.
Mark Wielaard [Thu, 14 Apr 2016 19:02:39 +0000 (21:02 +0200)]
libelf: Fix memory leak when zlib deflateInit fails in elf_compress.

On error we return NULL, not out_buf. So make sure to not leak it.

Signed-off-by: Mark Wielaard <mjw@redhat.com>
8 years agoelfcmp: fix self-comparison error with GCC 6
David Abdurachmanov [Mon, 11 Apr 2016 14:00:57 +0000 (16:00 +0200)]
elfcmp: fix self-comparison error with GCC 6

Noticed with Fedora 24 Alpha, gcc (GCC) 6.0.0 20160406
(Red Hat 6.0.0-0.20).

elfcmp.c: In function ‘main’:
elfcmp.c:364:199: error: self-comparison always evaluates
to false [-Werror=tautological-compare]
        if (unlikely (name1 == NULL || name2 == NULL

Signed-off-by: David Abdurachmanov <davidlt@cern.ch>
8 years agoPrepare 0.166 release. elfutils-0.166
Mark Wielaard [Thu, 31 Mar 2016 09:04:25 +0000 (11:04 +0200)]
Prepare 0.166 release.

Signed-off-by: Mark Wielaard <mjw@redhat.com>
8 years agonm: Check for malloc size argument overflow in show_symbols.
Mark Wielaard [Mon, 21 Mar 2016 15:01:02 +0000 (16:01 +0100)]
nm: Check for malloc size argument overflow in show_symbols.

Reported-by: Florian Weimer <fweimer@redhat.com>
Signed-off-by: Mark Wielaard <mjw@redhat.com>
8 years agoconfig: Use --program-prefix=eu- by default.
Mark Wielaard [Wed, 2 Mar 2016 14:04:43 +0000 (15:04 +0100)]
config: Use --program-prefix=eu- by default.

We want eu- as default program prefix if none was given by the user.
But if the user explicitly provided --program-prefix="" then pretend
it wasn't set at all (NONE).

This makes sure all tools will be installed as eu-<program>.
We want this default since most tools would normally conflict with
the GNU binutils variants that have similar names.

Signed-off-by: Mark Wielaard <mjw@redhat.com>
8 years agolibdwfl: clean up non-Linux GNU platforms code
Steven Chamberlain [Tue, 1 Mar 2016 13:32:37 +0000 (13:32 +0000)]
libdwfl: clean up non-Linux GNU platforms code

For non-Linux GNU platforms (like kFreeBSD, Hurd), linux-pid-attach.c
had some stub functions that are not used or exported.  Since gcc-6,
having these caused compiler errors due to -Wall -Werror:

linux-pid-attach.c:479:36: error: 'pid_thread_callbacks' defined but not used [-Werror=unused-const-variable=]

linux-pid-attach.c:474:1: error: 'pid_thread_detach' defined but not used [-Werror=unused-function]
linux-pid-attach.c:461:1: error: 'pid_detach' defined but not used [-Werror=unused-function]
linux-pid-attach.c:452:1: error: 'pid_set_initial_registers' defined but not used [-Werror=unused-function]
linux-pid-attach.c:441:1: error: 'pid_memory_read' defined but not used [-Werror=unused-function]
linux-pid-attach.c:420:1: error: 'pid_getthread' defined but not used [-Werror=unused-function]
linux-pid-attach.c:410:1: error: 'pid_next_thread' defined but not used [-Werror=unused-function]

This part of the source file is guarded by #ifndef __linux__

Signed-off-by: Steven Chamberlain <steven@pyro.eu.org>
8 years agosparc: restore 32-bit build.
Jose E. Marchesi [Fri, 26 Feb 2016 18:30:30 +0000 (10:30 -0800)]
sparc: restore 32-bit build.

This patch provides a dummy sparc_set_initial_registers-tid for
sparc32.  This fixes the build in sparcv9-*-* targets.

Signed-off-by: Jose E. Marchesi <jose.marchesi@oracle.com>
8 years agoAdd support for DT_PPC_OPT
Andreas Schwab [Fri, 26 Feb 2016 14:47:21 +0000 (15:47 +0100)]
Add support for DT_PPC_OPT

https://sourceware.org/ml/binutils/2013-10/msg00378.html

Signed-off-by: Andreas Schwab <schwab@suse.de>
8 years agolibdwfl: Check for kernel debuginfo file without .debug extension as well
Ravi Bangoria [Tue, 16 Feb 2016 16:21:35 +0000 (21:51 +0530)]
libdwfl: Check for kernel debuginfo file without .debug extension as well

Elfutils, looking for kernel debuginfo file, tries to find it at
various places. If elfutils finds /boot/vmlinu*x* file, it checks
for debufginfo section. If debuginfo is not present, it saves it as
'main elf' and continue looking for debuginfo file having .debug
extension i.e. vmlinux-RELEASE.debug.

'Ubuntu on powerpc' installs kernel as /boot/vmlinux and installs
debuginfo without any extension as /usr/lib/debug/boot/vmlinux-RELEASE
and hence, elfutils is not able to find the debuginfo file.

Here is the launchpad bug for the same:
  https://bugs.launchpad.net/ubuntu/+source/systemtap/+bug/1537125

This patch adds functionality to search for a kernel or debuginfo file
both with and without .debug extension.

Signed-off-by: Ravi Bangoria <ravi.bangoria@linux.vnet.ibm.com>
Signed-off-by: Mark Wielaard <mjw@redhat.com>
8 years agoreadelf: Warn when uncompressing fails and error when gelf_getshdr fails.
Mark Wielaard [Sat, 13 Feb 2016 19:00:37 +0000 (20:00 +0100)]
readelf: Warn when uncompressing fails and error when gelf_getshdr fails.

After decompressing we want to get the new shdr. This can theoretically
fail so we have to check. Also warn the user if a section couldn't be
uncompressed.

Signed-off-by: Mark Wielaard <mjw@redhat.com>
8 years agoelfcompress: -q should not imply --force.
Mark Wielaard [Sat, 13 Feb 2016 18:56:13 +0000 (19:56 +0100)]
elfcompress: -q should not imply --force.

We accidentally set force = true after handling -q and setting verbose--.

Signed-off-by: Mark Wielaard <mjw@redhat.com>
8 years agolibelf: Don't leak memory when out of memory in updatemmap.
Mark Wielaard [Sat, 13 Feb 2016 18:51:48 +0000 (19:51 +0100)]
libelf: Don't leak memory when out of memory in updatemmap.

We forgot to free scns when returning ELF_E_NOMEM.

Signed-off-by: Mark Wielaard <mjw@redhat.com>
8 years agolibdwfl: Don't leak memory in proc_maps_report when ENOEXEC.
Mark Wielaard [Sat, 13 Feb 2016 18:48:57 +0000 (19:48 +0100)]
libdwfl: Don't leak memory in proc_maps_report when ENOEXEC.

We forgot to free last_file on error.

Signed-off-by: Mark Wielaard <mjw@redhat.com>
8 years agolibdwfl: Don't crash on out of memory when frame unwinding.
Mark Wielaard [Sat, 13 Feb 2016 18:44:59 +0000 (19:44 +0100)]
libdwfl: Don't crash on out of memory when frame unwinding.

new_unwound didn't check whether malloc was successful. Check that we
could allocate memory before use and return DWFL_E_NOMEM otherwise.

Signed-off-by: Mark Wielaard <mjw@redhat.com>
8 years agolibdw: Fix bad free on invalid data in dwarf_getsrclines.c.
Mark Wielaard [Sat, 13 Feb 2016 18:36:50 +0000 (19:36 +0100)]
libdw: Fix bad free on invalid data in dwarf_getsrclines.c.

If the last dir name wasn't zero terminated we goto invalid_data
and might free the wrong data because we believe ndirlist is valid.
Don't update ndirlist until we are sure we will use all dirs.

Signed-off-by: Mark Wielaard <mjw@redhat.com>
8 years agoconfig: Check for and use gcc -Wnull-dereference.
Mark Wielaard [Sat, 13 Feb 2016 18:10:00 +0000 (19:10 +0100)]
config: Check for and use gcc -Wnull-dereference.

-Wnull-dereference is new in GCC6

Signed-off-by: Mark Wielaard <mjw@redhat.com>
8 years agoFix GCC6 -Wnull-dereference warnings.
Mark Wielaard [Fri, 12 Feb 2016 22:59:32 +0000 (23:59 +0100)]
Fix GCC6 -Wnull-dereference warnings.

asm_begin.c: In function ‘asm_begin’:
asm_begin.c:62:7: error: potential null pointer dereference [-Werror=null-dereference]
       __fsetlocking (result->out.file, FSETLOCKING_BYCALLER);
       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

We set result to NULL just before this call in case of error.
Fixed by only calling __fsetlocking when result is not NULL.

strip.c: In function ‘handle_elf.constprop’:
strip.c:1270:31: error: null pointer dereference [-Werror=null-dereference]
       elf_assert ((versiondata->d_size / sizeof (Elf32_Word))
                    ~~~~~~~~~~~^~~

src/strip.c:597:37: note: in definition of macro ‘elf_assert’
 #define elf_assert(test) do { if (!(test)) goto illformed; } while (0)
                                     ^~~~

That is the wrong check, we want to check shndxdata, not versiondata here.

Signed-off-by: Mark Wielaard <mjw@redhat.com>
8 years agoAdd new i386 and x86_64 relocation types.
Mark Wielaard [Thu, 28 Jan 2016 12:59:20 +0000 (13:59 +0100)]
Add new i386 and x86_64 relocation types.

Update elf.h from glibc and recognize R_386_GOT32X, R_X86_64_GOTPCRELX
and R_x86_64_REX_GOTPCRELX as non-dynamic relocations.

Signed-off-by: Mark Wielaard <mjw@redhat.com>
8 years agolibdwfl: Check result of gelf_get* calls in relocate.c upstream/0.165
Mark Wielaard [Thu, 11 Feb 2016 12:20:59 +0000 (13:20 +0100)]
libdwfl: Check result of gelf_get* calls in relocate.c

For corrupted ELF files gelf_get calls might fail in which case it
is better to immediately return an error instead of using the NULL
result and crashing.

Signed-off-by: Mark Wielaard <mjw@redhat.com>
8 years agolibdwfl: Check result of gelf_update_* calls in relocate_section.
Mark Wielaard [Thu, 11 Feb 2016 11:46:03 +0000 (12:46 +0100)]
libdwfl: Check result of gelf_update_* calls in relocate_section.

For corrupted ELF files the gelf_update calls might fail in which case it
is better to immediately return an error message instead of (silently)
continuing.

Signed-off-by: Mark Wielaard <mjw@redhat.com>
8 years agoreadelf: Read and print (encoded) DW_CFA_set_loc op and update pc.
Mark Wielaard [Tue, 9 Feb 2016 22:25:54 +0000 (23:25 +0100)]
readelf: Read and print (encoded) DW_CFA_set_loc op and update pc.

DW_CFA_set_loc takes an address as op, not an uleb128. Read and decode it.
Print the actual address and (updated) pc (address plus vma_base).

Signed-off-by: Mark Wielaard <mjw@redhat.com>
8 years agoAdd NT_ARM_SYSTEM_CALL aarch64 syscall regset.
Mark Wielaard [Fri, 12 Feb 2016 17:04:30 +0000 (18:04 +0100)]
Add NT_ARM_SYSTEM_CALL aarch64 syscall regset.

Linux kernel 3.18 added the NT_ARM_SYSTEM_CALL regset for aarch64.
Recognize and print this new core item.

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

Signed-off-by: Mark Wielaard <mjw@redhat.com>
8 years agolibebl: Don't assume ELF notes are "GNU" when unknown, recognize "Go" notes.
Mark Wielaard [Fri, 12 Feb 2016 14:04:00 +0000 (15:04 +0100)]
libebl: Don't assume ELF notes are "GNU" when unknown, recognize "Go" notes.

We used to assume any unknown ELF note provider name was "GNU" and didn't
recognize any of the "Go" provider types. We now check the provider name
explictly in ebl_object_note_type_name and recognize the following Go
note names: PKGLIST, ABIHASH, DEPS and BUILDID. But there is no attempt
yet in ebl_object_note to decode the description of these notes.

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

Signed-off-by: Mark Wielaard <mjw@redhat.com>
8 years agoconfig: Check for and use gcc -Wlogical-op and -Wduplicated-cond.
Mark Wielaard [Tue, 9 Feb 2016 15:10:22 +0000 (16:10 +0100)]
config: Check for and use gcc -Wlogical-op and -Wduplicated-cond.

Both -Wlogical-op and -Wduplicated-cond may produce useful warnings.
But we have to check them first. Older versions of gcc had a -Wlogical-op
that warned on some constructs using macros that are not erronious.
Only GCC6 has -Wduplicated-cond.

Signed-off-by: Mark Wielaard <mjw@redhat.com>
8 years agoelflint: Fix sh_entsize check when comparing SHT_HASH and SHT_GNU_HASH.
Mark Wielaard [Tue, 9 Feb 2016 13:18:49 +0000 (14:18 +0100)]
elflint: Fix sh_entsize check when comparing SHT_HASH and SHT_GNU_HASH.

GCC6 -Wduplicated-cond found the following issue:

elflint.c: In function ‘compare_hash_gnu_hash’:
elflint.c:2483:34: error: duplicated ‘if’ condition [-Werror=duplicated-cond]
   else if (hash_shdr->sh_entsize == sizeof (Elf64_Word))
            ~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~
elflint.c:2448:29: note: previously used here
   if (hash_shdr->sh_entsize == sizeof (Elf32_Word))
       ~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~

Which is correct, a Word in both Elf32 and Elf64 files is 4 bytes.
We meant to check for sizeof (Elf64_Xword) which is 8 bytes.

Also fix the section index and name in the error message.

The reason we probably didn't see this issue before is that SHT_HASH
sections really always should have sh_entsize of 4 even on 64bit arches.
There are however a couple of arches with mistakes in their sysv ABI.
See libelf/common.h. This also would only be triggered if on such an
architectures when the ELF file would have both a SHT_HASH and SHT_GNU_HASH
section and elflint would try to compare those sections.

Add an example testfile-s390x-hash-both to run-elflint-test.sh.

Signed-off-by: Mark Wielaard <mjw@redhat.com>
8 years agolibelf: elf_getdata should not adjust alignment for SHT_NOBITS sections.
Mark Wielaard [Thu, 4 Feb 2016 08:53:41 +0000 (09:53 +0100)]
libelf: elf_getdata should not adjust alignment for SHT_NOBITS sections.

In commit c0748e "libelf: More checking of valid sh_addralign values." we
adjusted bogus alignment of data buffers if they were greater than the
offset of the data in the file. This works OK, except when there is no
data in the file. So make sure to not adjust any NOBITS sections.

Also adds a test that shows the issue and makes sure elflint is called
with --gnu in run-strip-test.sh.

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

Signed-off-by: Mark Wielaard <mjw@redhat.com>
8 years agoMove nested functions in elf_compress.c and elf_strptr.c.
Chih-Hung Hsieh [Fri, 22 Jan 2016 18:04:33 +0000 (10:04 -0800)]
Move nested functions in elf_compress.c and elf_strptr.c.

* elf_compress.c (__libelf_compress): do_deflate_cleanup
* elf_strptr.c (elf_strptr): get_zdata

Signed-off-by: Chih-Hung Hsieh <chh@google.com>
8 years agotests: Skip dwfl-bug-fd-leak test if dwfl_linux_proc_report is unsupported.
Mark Wielaard [Wed, 13 Jan 2016 22:06:33 +0000 (23:06 +0100)]
tests: Skip dwfl-bug-fd-leak test if dwfl_linux_proc_report is unsupported.

Signed-off-by: Mark Wielaard <mjw@redhat.com>
8 years agoelflint: Recognize ELFOSABI_FREEBSD which Debian kFreeBSD uses.
Mark Wielaard [Wed, 13 Jan 2016 21:57:03 +0000 (22:57 +0100)]
elflint: Recognize ELFOSABI_FREEBSD which Debian kFreeBSD uses.

Signed-off-by: Mark Wielaard <mjw@redhat.com>
8 years agotests: Guard linux specific header includes with ifdef __linux__.
Mark Wielaard [Wed, 13 Jan 2016 21:49:02 +0000 (22:49 +0100)]
tests: Guard linux specific header includes with ifdef __linux__.

Signed-off-by: Mark Wielaard <mjw@redhat.com>
8 years agoconfigure: clarify zlib error message
Mike Frysinger [Thu, 14 Jan 2016 18:46:18 +0000 (13:46 -0500)]
configure: clarify zlib error message

Also drop the spurious quotes.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
8 years agogitignore: update
Mike Frysinger [Thu, 14 Jan 2016 18:46:12 +0000 (13:46 -0500)]
gitignore: update

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
8 years agolibelf: Add ELF compression types and defines to libelf.h for older glibc.
Mark Wielaard [Wed, 13 Jan 2016 16:16:48 +0000 (17:16 +0100)]
libelf: Add ELF compression types and defines to libelf.h for older glibc.

Older glibc elf.h might not define the new ELF compression defines and
types. If not just define them in libelf.h directly to make the libelf
headers work on older glibc systems.

Also include a testcase to check the libelf headers build against the
system elf.h.

https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=810885

Signed-off-by: Mark Wielaard <mjw@redhat.com>
8 years agoRegenerate .po files. elfutils-0.165
Mark Wielaard [Mon, 11 Jan 2016 10:11:44 +0000 (11:11 +0100)]
Regenerate .po files.

Signed-off-by: Mark Wielaard <mjw@redhat.com>
8 years agolibebl: Fix missing brackets around if statement body.
Mark Wielaard [Sat, 9 Jan 2016 21:09:48 +0000 (22:09 +0100)]
libebl: Fix missing brackets around if statement body.

GCC6 [will have] a nice new warning that showed a real bug:

elfutils/libebl/eblobjnote.c: In function ‘ebl_object_note’:
elfutils/libebl/eblobjnote.c:135:5: error: statement is indented as if it were guarded by... [-Werror=misleading-indentation]
     switch (type)
     ^~~~~~

elfutils/libebl/eblobjnote.c:45:3: note: ...this ‘if’ clause, but it is not
   if (! ebl->object_note (name, type, descsz, desc))
   ^~

And indeed, it should have been under the if, but wasn't because of missing
brackets. Added brackets (and reindent).

Signed-off-by: Mark Wielaard <mjw@redhat.com>
8 years agotests: Fix parentheses in elfputzdata strncmp test.
Mark Wielaard [Fri, 8 Jan 2016 20:55:58 +0000 (21:55 +0100)]
tests: Fix parentheses in elfputzdata strncmp test.

We were checking strlen () == 0 instead of strncmp () == 0. Oops.

Signed-off-by: Mark Wielaard <mjw@redhat.com>
8 years agoFix build on 32bit systems.
Mark Wielaard [Fri, 8 Jan 2016 15:45:12 +0000 (16:45 +0100)]
Fix build on 32bit systems.

size_t has a different size on 32 and 64 bit systems.

Signed-off-by: Mark Wielaard <mjw@redhat.com>
8 years agoPrepare 0.165 release.
Mark Wielaard [Fri, 8 Jan 2016 13:44:49 +0000 (14:44 +0100)]
Prepare 0.165 release.

Signed-off-by: Mark Wielaard <mjw@redhat.com>
8 years agoSimplify code and build now that zlib support is no longer optional.
Mark Wielaard [Fri, 8 Jan 2016 12:35:33 +0000 (13:35 +0100)]
Simplify code and build now that zlib support is no longer optional.

Now that we always require zlib support we don't need to conditionally
build or compile code that depends on it.

Signed-off-by: Mark Wielaard <mjw@redhat.com>
8 years agoUpdated Polish translation
Piotr Drąg [Thu, 7 Jan 2016 14:46:50 +0000 (15:46 +0100)]
Updated Polish translation

Signed-off-by: Piotr Drąg <piotrdrag@gmail.com>
8 years agoUpdated Polish translation
Piotr Drąg [Thu, 24 Dec 2015 13:16:15 +0000 (14:16 +0100)]
Updated Polish translation

Signed-off-by: Piotr Drąg <piotrdrag@gmail.com>
8 years agoelfcompress: New utility.
Mark Wielaard [Tue, 1 Dec 2015 13:55:07 +0000 (14:55 +0100)]
elfcompress: New utility.

Usage: elfcompress [OPTION...] FILE...
Compress or decompress sections in an ELF file.

 -f, --force              Force compression of section even if it would
                          become larger
 -n, --name=SECTION       SECTION name to (de)compress, SECTION is an
                          extended wildcard pattern (defaults to
                          '.?(z)debug*')
 -o, --output=FILE        Place (de)compressed output into FILE
 -p, --permissive         Relax a few rules to handle slightly broken ELF
                          files
 -q, --quiet              Be silent when a section cannot be compressed
 -t, --type=TYPE          What type of compression to apply. TYPE can be
                          'none' (decompress), 'zlib' (ELF ZLIB compression,
                          the default, 'zlib-gabi' is an alias) or
                          'zlib-gnu' (.zdebug GNU style compression, 'gnu'
                          is an alias)
 -v, --verbose            Print a message for each section being
                          (de)compressed
 -?, --help               Give this help list
     --usage              Give a short usage message
 -V, --version            Print program version

Signed-off-by: Mark Wielaard <mjw@redhat.com>
8 years agoelflint: Recognize and check SHF_COMPRESSED section flag.
Mark Wielaard [Fri, 18 Dec 2015 14:51:37 +0000 (15:51 +0100)]
elflint: Recognize and check SHF_COMPRESSED section flag.

SHF_COMPRESSED is a valid section flag, it can optionally be on any special
section, but it cannot be used on NOBITS sections or together with SHF_ALLOC.
A section that has SHF_COMPRESSED set must have a valid Chdr.

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