| Commit message (Collapse) | Author | Age | Files | Lines |
| ... | |
| |
|
|
|
|
|
|
| |
It was already possible to display the section groups using -a, but
the argp options didn't yet have an -g, --section-groups entry to
just display the section groups.
Signed-off-by: Mark Wielaard <[email protected]>
|
| |
|
|
|
|
|
|
|
| |
Also adjust the formatting for the resolved addresses to print them
on separate lines so they nicely line up even when the addresses are
resolved to symbol+offset names. And print the operands starting on
a new line.
Signed-off-by: Mark Wielaard <[email protected]>
|
| |
|
|
|
|
|
|
| |
Also adjust the formatting for the resolved addresses to print them
on separate lines so they nicely line up even when the addresses are
resolved to symbol+offset names.
Signed-off-by: Mark Wielaard <[email protected]>
|
| |
|
|
|
|
|
|
|
|
|
| |
When we see a DW_AT_decl_file or DW_AT_call_file attribute print the
actual file name. The current interface gives us a full (absolute) patch,
but we only want to show the file name for now to not clutter the output
too much. This helps a lot when trying to determine where something was
declared if you are just looking at the DIE tree. Otherwise you'll have
to cross match the number by hand with the corresponding line table entry.
Signed-off-by: Mark Wielaard <[email protected]>
|
| |
|
|
|
|
|
| |
If there is anything wrong with a DIE it is useful to know what the abbrev
code was so you can lookup the abbrev description.
Signed-off-by: Mark Wielaard <[email protected]>
|
| |
|
|
|
|
|
| |
Use only 2 spaces for index (there are never 10000, the most seen in the
wild is 64). Adjust re-indenting after GNU_entry_value.
Signed-off-by: Mark Wielaard <[email protected]>
|
| |
|
|
|
|
|
|
|
|
|
|
|
| |
Now an error getting the attribute value will not only print the DIE offset
and the reason, but also the attribute name and form. e.g.
DIE [b] cannot get attribute 'ranges' (sec_offset) value: .debug_ranges
section missing
Also we don't abort, but try to print the other attributes of the DIE
anyway. It might just be one attribute whose value cannot be resolved.
Signed-off-by: Mark Wielaard <[email protected]>
|
| |
|
|
|
|
|
|
|
|
| |
When processing large files it is useful to know the DIE offset if
printing of attributes fails (especially when redirecting the output).
With this change the error message looks like:
eu-readelf: DIE [2aeb8ef1] cannot get attribute value: invalid DWARF
Signed-off-by: Mark Wielaard <[email protected]>
|
| |
|
|
|
|
|
| |
Also format both DW_OP_call_ref and DW_OP_GNU_variable_value argument
as a normal DIE reference.
Signed-off-by: Mark Wielaard <[email protected]>
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
When compiling with -O3 gcc finds an interesting error:
src/ar.c: In function ‘do_oper_insert’:
src/ar.c:1077:56: error: ‘%-*ld’ directive output may be truncated writing between 6 and 10 bytes into a region of size 7 [-Werror=format-truncation=]
snprintf (tmpbuf, sizeof (tmpbuf), ofmt ? "%-*lo" : "%-*ld", bufsize, val);
^~~~~
The problem is that the ar header values have to fit in a limited
(not zero terminated) string. We should check the snprintf return
value to see if the values are representable.
Also make ar valgrind and ubsan clean and add a minimal sanity test.
Reported-by: Matthias Klose <[email protected]>
Signed-off-by: Mark Wielaard <[email protected]>
|
| |
|
|
|
|
|
| |
Replace horizontal tab '\v' with double line feed '\n\n' in doc strings.
Regenerate .po files.
Signed-off-by: Mark Wielaard <[email protected]>
|
| |
|
|
|
|
|
|
|
| |
We don't know sizeof(pid_t) as it's not specified in any standard. In
order to still print it, we cast to long long, the largest integer type
we can easily print.
Signed-off-by: Ulf Hermann <[email protected]>
Signed-off-by: Mark Wielaard <[email protected]>
|
| |
|
|
|
|
|
|
| |
We assume core files from linux systems, so we should use the linux
version of the signals when reading them. Other OS might have different
signal numbers.
Signed-off-by: Ulf Hermann <[email protected]>
|
| |
|
|
|
|
|
|
|
|
| |
Accept version 5 .debug_macro format, which is identical to the GNU
version 4 format. No real support yet for the new supplementary object
file (sup) and indirect string references (strx). GCC doesn't generate
them yet. readelf does recognize them, but doesn't try to decode them.
dwarf_getmacros currently rejects the new formats.
Signed-off-by: Mark Wielaard <[email protected]>
|
| |
|
|
|
|
|
|
|
| |
Add DW_DEFAULTED_no, DW_DEFAULTED_in_class and DW_DEFAULTED_out_of_class
to dwarf.h.
Print value (no, in_class or out_of_class) of DW_AT_defaulted in readelf.
Signed-off-by: Mark Wielaard <[email protected]>
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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 <[email protected]>
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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 <[email protected]>
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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 <[email protected]>
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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 <[email protected]>
|
| |
|
|
|
|
| |
We cannot rely on it to be available from any of the other headers.
Signed-off-by: Ulf Hermann <[email protected]>
|
| |
|
|
|
|
|
| |
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 <[email protected]>
|
| |
|
|
|
|
|
|
|
| |
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 <[email protected]>
|
| |
|
|
|
|
|
|
|
| |
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 <[email protected]>
|
| |
|
|
|
|
| |
https://sourceware.org/bugzilla/show_bug.cgi?id=21320
Signed-off-by: Mark Wielaard <[email protected]>
|
| |
|
|
|
|
|
|
|
| |
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 <[email protected]>
|
| |
|
|
|
|
|
|
|
|
| |
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 <[email protected]>
|
| |
|
|
|
|
|
|
|
| |
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 <[email protected]>
|
| |
|
|
|
|
|
|
|
|
| |
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 <[email protected]>
|
| |
|
|
|
|
|
|
|
|
| |
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 <[email protected]>
|
| |
|
|
|
|
|
|
| |
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 <[email protected]>
|
| |
|
|
|
|
|
|
| |
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 <[email protected]>
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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 <[email protected]>
|
| |
|
|
|
|
|
|
|
| |
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 <[email protected]>
|
| |
|
|
|
|
|
|
|
|
|
|
| |
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 <[email protected]>
|
| |
|
|
|
|
|
|
|
|
|
| |
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 <[email protected]>
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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 <[email protected]>
|
| |
|
|
|
|
|
|
|
|
| |
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 <[email protected]>
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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 <[email protected]>
|
| |
|
|
|
|
|
|
| |
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 <[email protected]>
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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 <[email protected]>
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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 <[email protected]>
|
| |
|
|
|
|
|
|
| |
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 <[email protected]>
|
| |
|
|
|
|
|
|
|
|
| |
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 <[email protected]>
|
| |
|
|
| |
Signed-off-by: Richard Henderson <[email protected]>
|
| |
|
|
|
|
|
|
|
|
|
|
| |
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 <[email protected]>
|
| |
|
|
|
| |
Reported-by: Florian Weimer <[email protected]>
Signed-off-by: Mark Wielaard <[email protected]>
|
| |
|
|
|
|
|
|
| |
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 <[email protected]>
|
| |
|
|
|
|
| |
We accidentally set force = true after handling -q and setting verbose--.
Signed-off-by: Mark Wielaard <[email protected]>
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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 <[email protected]>
|
| |
|
|
|
|
|
| |
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 <[email protected]>
|