| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
| |
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]>
|
|
|
|
| |
Signed-off-by: Mark Wielaard <[email protected]>
|
|
|
|
|
|
|
|
|
|
| |
Add dwarf_default_lower_bound to get the default lower bound for a language
when not given as attribute for an subrange type. Implementation extracted
from dwarf_aggregate_size.
Add a test to check all known language codes are handled.
Signed-off-by: Mark Wielaard <[email protected]>
|
|
|
|
|
|
|
|
|
|
| |
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 <[email protected]>
|
|
|
|
|
|
|
| |
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 <[email protected]>
|
|
|
|
|
|
|
|
|
|
| |
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 <[email protected]>
|
|
|
|
|
|
|
|
|
|
|
|
| |
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 <[email protected]>
|
|
|
|
|
|
|
| |
* 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 <[email protected]>
|
|
|
|
| |
Signed-off-by: Mark Wielaard <[email protected]>
|
|
|
|
|
|
|
|
|
|
| |
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 <[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]>
|
|
|
|
|
|
|
|
|
| |
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 <[email protected]>
|
|
|
|
|
|
|
| |
/dev/zero is meant for reading zeroes. /dev/null is for writing into
nirvana.
Signed-off-by: Ulf Hermann <[email protected]>
|
|
|
|
|
|
|
|
|
|
| |
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 <[email protected]>
|
|
|
|
|
|
|
|
|
| |
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 <[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]>
|
|
|
|
|
|
|
| |
This fixes the elflint self test when the compiler is configured for PIE
default.
Signed-off-by: Andreas Schwab <[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]>
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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 <[email protected]>
|
|
|
|
|
|
|
| |
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 <[email protected]>
|
|
|
|
|
|
|
|
|
| |
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 <[email protected]>
Signed-off-by: Mark Wielaard <[email protected]>
|
|
|
|
|
|
|
| |
We don't want to use it, even if it exists.
Signed-off-by: Ulf Hermann <[email protected]>
Signed-off-by: Mark Wielaard <[email protected]>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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 <[email protected]>
Signed-off-by: Mark Wielaard <[email protected]>
|
|
|
|
|
|
|
| |
Add a simple i386_unwind.c frame pointer unwinder as fallback if DWARF/CFI
unwinding fails.
Signed-off-by: Mark Wielaard <[email protected]>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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 <[email protected]>
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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 <[email protected]>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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 <[email protected]>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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 <[email protected]>
|
|
|
|
|
|
|
| |
F_GETFD is both cheaper and easier to port, and otherwise has the same
effect here.
Signed-off-by: Ulf Hermann <[email protected]>
|
|
|
|
|
|
|
|
|
|
| |
__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 <[email protected]>
|
|
|
|
|
|
|
|
| |
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 <[email protected]>
|
|
|
|
|
|
| |
Otherwise we skip the munmap() later. This leaks resources.
Signed-off-by: Ulf Hermann <[email protected]>
|
|
|
|
|
|
|
|
|
|
|
| |
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 <[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]>
|
|
|
|
|
|
|
| |
Otherwise the build will fail on systems that actually need file
extension for executables.
Signed-off-by: Ulf Hermann <[email protected]>
|
|
|
|
|
|
| |
BYTE_ORDER and friends are customarily defined in endian.h.
Signed-off-by: Ulf Hermann <[email protected]>
|
|
|
|
| |
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]>
|
|
|
|
|
|
| |
Not all search.h declare it, and it is not very helpful anyway.
Signed-off-by: Ulf Hermann <[email protected]>
|
|
|
|
|
|
| |
We only include them where we actually need them and only on linux.
Signed-off-by: Ulf Hermann <[email protected]>
|
|
|
|
|
|
|
| |
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 <[email protected]>
|
|
|
|
|
|
|
|
|
|
|
|
| |
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 <[email protected]>
|
|
|
|
| |
Signed-off-by: Mark Wielaard <[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]>
|
|
|
|
|
|
|
|
|
|
| |
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 <[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]>
|