| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
| |
Signed-off-by: Mark Wielaard <mjw@redhat.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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>
|
|
|
|
|
|
| |
We were checking strlen () == 0 instead of strncmp () == 0. Oops.
Signed-off-by: Mark Wielaard <mjw@redhat.com>
|
|
|
|
|
|
| |
size_t has a different size on 32 and 64 bit systems.
Signed-off-by: Mark Wielaard <mjw@redhat.com>
|
|
|
|
| |
Signed-off-by: Mark Wielaard <mjw@redhat.com>
|
|
|
|
|
|
|
| |
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>
|
|
|
|
| |
Signed-off-by: Piotr Drąg <piotrdrag@gmail.com>
|
|
|
|
| |
Signed-off-by: Piotr Drąg <piotrdrag@gmail.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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>
|
|
|
|
|
|
|
|
| |
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>
|
|
|
|
|
|
|
|
|
| |
elf_strptr indexes into the section data. This is defined as index into
the uncompressed data of the section. If the section is compressed make
sure the uncompressed data is available, but don't really decompress the
section header (elf_getdata will still return compressed data).
Signed-off-by: Mark Wielaard <mjw@redhat.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
When printing a (non-string, non-data) section use uncompressed data when
possible. For dumping hex and string sections (-x and -p) -z will dump the
uncompressed data (otherwise the compressed data is dumped).
-z, --decompress Show compression information for compressed
sections (when used with -S); decompress section
before dumping data (when used with -p or -x)
Includes test cases for ET_REL files using compressed relocation (target)
debug sections to test libdwfl transparent uncompression of sections.
Signed-off-by: Mark Wielaard <mjw@redhat.com>
|
|
|
|
|
|
|
|
|
| |
This makes usage of the libdwfl symbol functions work out of the box even
when some sections (string, symbol or xndx) are compressed. For ET_REL
files this makes relocations just work by making sure the target section
is decompressed first before relocations are applied.
Signed-off-by: Mark Wielaard <mjw@redhat.com>
|
|
|
|
|
|
|
|
| |
libdw used its own code for decompressing GNU style .zdebug sections.
Using elf_compress and elf_compress_gnu instead makes it possible to
transparently use either GNU style or ELF style compressed data.
Signed-off-by: Mark Wielaard <mjw@redhat.com>
|
|
|
|
| |
Signed-off-by: Mark Wielaard <mjw@redhat.com>
|
|
|
|
|
|
|
| |
-z, --decompress Show compression information for compressed
sections (when used with -S).
Signed-off-by: Mark Wielaard <mjw@redhat.com>
|
|
|
|
|
|
|
|
|
| |
Elf_Data of a compressed section has type ELF_T_CHDR. This type can be
xlated to the file or memory representation. This will make sure the Chdr
is in the correct endianess. The compressed data following the Chdr isn't
translated.
Signed-off-by: Mark Wielaard <mjw@redhat.com>
|
|
|
|
|
|
| |
Helper function to get the size of a GNU compressed zdebug section.
Signed-off-by: Mark Wielaard <mjw@redhat.com>
|
|
|
|
| |
Signed-off-by: Mark Wielaard <mjw@redhat.com>
|
|
|
|
|
|
|
|
|
|
| |
gnuld might keep dangling/unused symbols around (see sourceware PR13621).
Add _edata (end of initialized data address) and _end (end of uninitialized
data address) to that list. They might have been added by gnuld even if
there is no such [un]initialized data. Also add the double underscore
variants which are used on some architectures.
Signed-off-by: Mark Wielaard <mjw@redhat.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Old linkers might have created an STT_SECTION symbol for the section
header string table section, which isn't actually used. For now just
warn about such symbols. If such a symbol would actually really be used
(but why?) then we would have to handle it by removing it and rewriting
the symbol table.
This is a testsuite only change, but includes an extra test with files
that have such STT_SECTION symbols to make sure it will be handled in
case we "upgrade" the elfstrmerge test to a real utility.
Signed-off-by: Mark Wielaard <mjw@redhat.com>
|
|
|
|
|
|
|
| |
Silent rules already are the default, but automake and make both still
tell which directory is being entered/build. Disable printing from make.
Signed-off-by: Mark Wielaard <mjw@redhat.com>
|
|
|
|
|
|
| |
* Move nested function 'report' to file scope to compile with clang.
Signed-off-by: Chih-Hung Hsieh <chh@google.com>
|
|
|
|
|
|
| |
* Move nested functions 'fail', 'update_end', and 'more' to file scope.
Signed-off-by: Chih-Hung Hsieh <chh@google.com>
|
|
|
|
|
|
|
|
| |
* In libdwfl/link_map.c, nested functions check64, check32, are moved
to file scope to compile with clang.
Signed-off-by: Chih-Hung Hsieh <chh@google.com>
Signed-off-by: Mark Wielaard <mjw@redhat.com>
|
|
|
|
|
|
|
| |
This patch implements the set_initial_registers_tid hook for sparc.
It works in both sparcv9-*-* and sparc64-*-* targets.
Signed-off-by: Jose E. Marchesi <jose.marchesi@oracle.com>
|
|
|
|
|
|
|
|
| |
This patch adds sparc support to the unwinder, providing a default CFI
program that works in both sparcv9-*-* and sparc64-*-* targets.
Signed-off-by: Jose E. Marchesi <jose.marchesi@oracle.com>
Signed-off-by: Mark Wielaard <mjw@redhat.com>
|
|
|
|
|
|
|
|
|
| |
Ebl backends can define an offset that must be applied to the value of
the "return address register" defined in the CFI ABI information.
This patch makes the unwinder to use that offset when reading the RA
CFI register.
Signed-off-by: Jose E. Marchesi <jose.marchesi@oracle.com>
|
|
|
|
|
|
|
|
| |
Some backends need to fine-tune the return address as fetched from the
corresponding CFI register. This patch adds a new backend attribute
ra_offset and the corresponding ebl_ra_offset getter function.
Signed-off-by: Jose E. Marchesi <jose.marchesi@oracle.com>
|
|
|
|
|
|
|
|
|
| |
When --enable-valgrind is given run the testsuite with --leak-check=full
treating any memory leak as a failure. Also disable valgrind for those
tests that trigger a valgrind bug.
https://bugs.kde.org/show_bug.cgi?id=327427
Signed-off-by: Mark Wielaard <mjw@redhat.com>
|
|
|
|
|
|
|
|
| |
Although it isn't supposed to happen there could be FDEs that cover the
same address range. Don't leak such FDEs and use an existing FDE for
consistency.
Signed-off-by: Mark Wielaard <mjw@redhat.com>
|
|
|
|
|
|
|
|
|
|
|
| |
If we need Dwarf and the file is ET_REL use the same trick as in readelf
to get a relocated Dwarf. Otherwise lots of references in the debug_info
will come out as zero.
This also explains the "bogus" Dwarf seen that caused the memory leak in
the local_root that was fixed previously.
Signed-off-by: Mark Wielaard <mjw@redhat.com>
|
|
|
|
|
|
|
| |
Badly formed DWARF can have duplicate local names. In which case we do
want to detect those so we don't leak the memory.
Signed-off-by: Mark Wielaard <mjw@redhat.com>
|
|
|
|
|
|
|
| |
When we copy elided sections some section data is newly allocated.
Track those allocations so we can free them when done.
Signed-off-by: Mark Wielaard <mjw@redhat.com>
|
|
|
|
|
|
|
|
|
|
| |
If the FDE end <= start then it doesn't actually cover a valid code range.
Don't use and cache such FDEs (it will cause memory leaks if there is
another FDE that has the same start address and a valid code range).
Such FDEs have been seen in the backtrace.ppc.exec testfile.
Signed-off-by: Mark Wielaard <mjw@redhat.com>
|
|
|
|
|
|
|
|
| |
The phdrs buffer could come from the core file or through the executable.
dwfl_link_map_report would leak the buffer if it came from the executable.
Track where the buffer came from and free appropriately.
Signed-off-by: Mark Wielaard <mjw@redhat.com>
|
|
|
|
|
|
|
|
| |
Our argp helper would leak the core Elf and core file descriptor when
given by the user. Store both in the Dwfl as a new Dwfl_User_Core so
they get cleaned up by dwfl_end.
Signed-off-by: Mark Wielaard <mjw@redhat.com>
|
|
|
|
|
|
|
| |
Make sure all structures allocated in the testcases are disposed so
running them under valgrind will show no memory leaks.
Signed-off-by: Mark Wielaard <mjw@redhat.com>
|
|
|
|
|
|
|
|
| |
The fake_loc_cu is used when synthesizing attributes for Dwarf_Ops that
came from a location list entry in dwarf_getlocation_attr. Make sure
we remove the loc cache stored in it when disposing of the fake_loc_cu.
Signed-off-by: Mark Wielaard <mjw@redhat.com>
|
|
|
|
|
|
|
| |
open_file () explicitly gets Ebl handles for both Elf files to compare.
Make sure to close those when done.
Signed-off-by: Mark Wielaard <mjw@redhat.com>
|
|
|
|
|
|
|
|
| |
* In dwfl_module_getdwarf.c, nested functions 'consider_shdr'
and 'translate_offs' are moved to file scope to compile with clang.
Signed-off-by: Chih-Hung Hsieh <chh@google.com>
Signed-off-by: Mark Wielaard <mjw@redhat.com>
|
|
|
|
|
|
|
| |
* Move nested functions 'same_section', 'binding_value',
'try_sym_value', and 'search_table'.
Signed-off-by: Chih-Hung Hsieh <chh@google.com>
|
|
|
|
|
|
| |
No nested functions to compile with clang/llvm.
Signed-off-by: Chih-Hung Hsieh <chh@google.com>
|
|
|
|
|
|
|
| |
* No nested functions to compile with clang/llvm.
Signed-off-by: Chih-Hung Hsieh <chh@google.com>
Signed-off-by: Mark Wielaard <mjw@redhat.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
libdwfl sets the Dwfl_Module Ebl for the eh_cfi and dwarf_cfi cache to
save a bit of memory. It also calls ebl_closebackend on the ebl to free
it. The Dwarf_CFI never frees the Ebl in the cache, even when it opened
one itself. This means that if only libdw calls are used to access the
Dwarf_CFI the Ebl might be leaked.
Always destroy the Dwarf_CFI cache Ebl in __libdw_destroy_frame_cache.
And in __libdwfl_module_free clear the Dwarf_CFI Ebl if it is the
Dwfl_Module Ebl before calling dwarf_cfi_end and dwarf_end.
Signed-off-by: Mark Wielaard <mjw@redhat.com>
|
|
|
|
|
|
|
|
| |
Starting with commit f8443bd09f8a8d3d84a63e5ce206a218e57dff7a,
we might jump to "out" on error before initialization of "state".
Initialize "state" early to fix this issue.
Signed-off-by: Dmitry V. Levin <ldv@altlinux.org>
|
|
|
|
|
|
|
| |
Move nested functions in libdw/dwarf_getsrclines.c to file scope.
Signed-off-by: Chih-Hung Hsieh <chh@google.com>
Signed-off-by: Mark Wielaard <mjw@redhat.com>
|
|
|
|
|
|
|
|
| |
* libdwfl/gzip.c should now compile with clang.
All local variables used by nested functions are
passed in an unzip_state structure.
Signed-off-by: Chih-Hung Hsieh <chh@google.com>
|
|
|
|
|
| |
Signed-off-by: Chih-Hung Hsieh <chh@google.com>
Signed-off-by: Mark Wielaard <mjw@redhat.com>
|
|
|
|
|
|
|
|
|
| |
* Nested functions in this file are moved to file scope
to compile with clang. Extra parameters are added to pass
local variables.
Signed-off-by: Chih-Hung Hsieh <chh@google.com>
Signed-off-by: Mark Wielaard <mjw@redhat.com>
|