platform/upstream/elfutils.git
11 years agoreadelf: Accept version 8 .gdb_index section format.
Mark Wielaard [Mon, 18 Mar 2013 12:54:50 +0000 (13:54 +0100)]
readelf: Accept version 8 .gdb_index section format.

Version 8 just indicates that if the .gdb_index was generated by the gold
linker it correctly includes TUs for symbols. http://sourceware.org/PR15021

Signed-off-by: Mark Wielaard <mjw@redhat.com>
11 years agolibdw and libdwfl srcfiles and srclines fixes for partial_units.
Mark Wielaard [Tue, 12 Mar 2013 11:02:51 +0000 (12:02 +0100)]
libdw and libdwfl srcfiles and srclines fixes for partial_units.

dwfl_getsrclines would always fail, even when lines were found.
dwarf_decl_file, and other functions relying on srcfiles or srclines would
fail for DIEs in partial_units because stmt_lists on partial_units
were ignored.

Note that dwz contained a bug which makes things fail in __libdw_formptr
for DW_AT_stmt_list with a bogus DW_FORM even with these fixes.
https://bugzilla.redhat.com/show_bug.cgi?id=919755

Signed-off-by: Mark Wielaard <mjw@redhat.com>
11 years agoFix two memory leaks in findtextrel and strip.
Mark Wielaard [Fri, 1 Mar 2013 10:51:58 +0000 (11:51 +0100)]
Fix two memory leaks in findtextrel and strip.

The findtextrel leak is real, when processing lots of files without text
relocations the files and memory wouldn't be released. The strip leak is
minor since it can only happen when using -f which only allows one file
as argument. But it is nice to see valgrind say:

  "All heap blocks were freed -- no leaks are possible".

Signed-off-by: Mark Wielaard <mjw@redhat.com>
11 years agoelflint.c (check_symtab): Add __bss_start__ to the list of allowed symbols.
Mark Wielaard [Sun, 24 Feb 2013 21:58:49 +0000 (22:58 +0100)]
elflint.c (check_symtab): Add __bss_start__ to the list of allowed symbols.

Some architectures (ARM) use __bss_start__ instead of __bss_start.

Signed-off-by: Mark Wielaard <mjw@redhat.com>
11 years agolibdwfl: Try opening files all installed compression libraries.
Mark Wielaard [Fri, 22 Feb 2013 22:42:59 +0000 (23:42 +0100)]
libdwfl: Try opening files all installed compression libraries.

rhbz #909481. When a compression library wasn't installed libdwfl would
not try the next compression library for opening a file. Retry with the
next available compression library if a previous one isn't installed. Also
disable tests that depend on a particular compression library
(run-readelf-s.sh and run-dwflsyms.sh) if that library isn't installed.

Signed-off-by: Mark Wielaard <mjw@redhat.com>
11 years agolibdw: Handle FORM_GNU_strp_alt for files with string data only in dwz file.
Mark Wielaard [Fri, 15 Feb 2013 21:45:22 +0000 (22:45 +0100)]
libdw: Handle FORM_GNU_strp_alt for files with string data only in dwz file.

dwarf_formstring should check that the dbg file from which we want the
strp data actually has a IDX_debug_str section.

Reported-By: Tom Tromey <tromey@redhat.com>
Signed-off-by: Mark Wielaard <mjw@redhat.com>
11 years agolibdwfl: Use actual file names in parse_opt failure cases.
Mark Wielaard [Sun, 10 Feb 2013 14:07:33 +0000 (15:07 +0100)]
libdwfl: Use actual file names in parse_opt failure cases.

When handling ARGP_KEY_SUCCESS the failure handling code would use 'arg'
as failure string. But 'arg' would be NULL in such cases leading to failure
messages like: "cannot open '(null)': No such file or directory".
Use opt->e and opt->core explicitly to show file names that caused failure.

Signed-off-by: Mark Wielaard <mjw@redhat.com>
11 years agoelflint: Add two more symbols to gnuld list of allowed bad values.
Mark Wielaard [Wed, 6 Feb 2013 15:20:17 +0000 (16:20 +0100)]
elflint: Add two more symbols to gnuld list of allowed bad values.

Add __bss_start and __TMC_END__ to the list of symbols allowed to have
out of section values because of the following GNU ld bug:
http://sourceware.org/bugzilla/show_bug.cgi?id=13621.
Allow them to appear in either .symtab or .dynsym, but only when they
are zero sized. It is impossible to define a general rule for this bug,
but this should catch most common issues that are mostly harmless
because the symbols signify the removed section was empty to being with.
This catches at least all symbols often flagged in the tests.

Signed-off-by: Mark Wielaard <mjw@redhat.com>
11 years agobackends: Check type DIE exists before calling dwarf_tag ().
Mark Wielaard [Wed, 6 Feb 2013 12:15:10 +0000 (13:15 +0100)]
backends: Check type DIE exists before calling dwarf_tag ().

dwarf_attr () or dwarf_form () functions leave typedie NULL when they fail
because of missing attribute or unexpected form. In such cases first check
the DIE exists and return error instead of calling dwarf_tag () and crashing.

This also happens in the testsuite with native tests when elfutils is build
without DWZ support on a distro that uses DWZ DWARF compression on system
libraries. Only the backends used dwarf_tag () directly without checking,
all other uses in elfutils already checked whether the given DIE was NULL.

Signed-off-by: Mark Wielaard <mjw@redhat.com>
11 years agoAdd readelf test for --debug-dump=loc --debug-dump=ranges, -N and -U.
Mark Wielaard [Wed, 30 Jan 2013 10:04:38 +0000 (11:04 +0100)]
Add readelf test for --debug-dump=loc --debug-dump=ranges, -N and -U.

Signed-off-by: Mark Wielaard <mjw@redhat.com>
11 years agoreadelf: Add -U, --unresolved-address-offsets output control.
Mark Wielaard [Thu, 24 Jan 2013 10:29:21 +0000 (11:29 +0100)]
readelf: Add -U, --unresolved-address-offsets output control.

format_dwarf_addr () takes an extra argument 'raw' that is displayed
when the user requests printing raw offsets values output for DWARF data.

Signed-off-by: Mark Wielaard <mjw@redhat.com>
11 years agoreadelf: Add base to offsets in format_dwarf_addr for debug_loc/ranges.
Mark Wielaard [Fri, 18 Jan 2013 21:19:08 +0000 (22:19 +0100)]
readelf: Add base to offsets in format_dwarf_addr for debug_loc/ranges.

Collect the base address of the CU while creating the listptr_tables
and use them when printing debug ranges and location entries with
format_dwarf_addr ().

Signed-off-by: Mark Wielaard <mjw@redhat.com>
11 years agolibdwfl/
Jan Kratochvil [Wed, 10 Oct 2012 18:42:30 +0000 (20:42 +0200)]
libdwfl/
linux-proc-maps.c: Include system.h.
(PROCEXEFMT, get_pid_class): New.
(grovel_auxv): Detect 32-bit vs. 64-bit auxv, possibly call get_pid_class.

Signed-off-by: Jan Kratochvil <jan.kratochvil@redhat.com>
11 years agobackends/
Jan Kratochvil [Wed, 10 Oct 2012 17:32:05 +0000 (19:32 +0200)]
backends/
* Makefile.am (s390_SRCS): Add s390_corenote.c and s390x_corenote.c.
* linux-core-note.c (ALIGN_PR_REG): New definitions.
(struct EBLHOOK(prstatus)): Change field pr_reg to anonymous struct with
ALIGN_PR_REG.
(EXTRA_ITEMS): New macro.
* s390_corenote.c: New file.
* s390_init.c (s390x_core_note): New declaration.
(s390_init): Install s390x_core_note and s390_core_note.
* s390x_corenote.c: New file.

tests/
* run-readelf-mixed-corenote.sh: New testcase for readelf -n of s390
and s390x core notes.
* testfile67.bz2: New file.
* testfile68.bz2: New file.
* Makefile.am (EXTRA_DIST): Add testfile67.bz2 and testfile68.bz2 .

Signed-off-by: Jan Kratochvil <jan.kratochvil@redhat.com>
11 years agosrc/
Jan Kratochvil [Wed, 10 Oct 2012 17:32:05 +0000 (19:32 +0200)]
src/
* readelf.c (handle_core_items): Limit special repeated items handling
to single-item formats '\n', 'b' and 'B', assert OFFSET 0 there.

Signed-off-by: Jan Kratochvil <jan.kratochvil@redhat.com>
11 years agobackends/
Jan Kratochvil [Wed, 30 Jan 2013 19:26:14 +0000 (20:26 +0100)]
backends/
* arm_corenote.c (vfp_items): Remove zero COUNT initializer.

Signed-off-by: Jan Kratochvil <jan.kratochvil@redhat.com>
11 years agolibdwfl: Support auxiliary symbol table only for getsym and addrsym.
Mark Wielaard [Wed, 23 Jan 2013 16:39:19 +0000 (17:39 +0100)]
libdwfl: Support auxiliary symbol table only for getsym and addrsym.

Static binaries can have only an auxiliary symbol table and no dynsym
or symtab table.

Signed-off-by: Mark Wielaard <mjw@redhat.com>
11 years agotests: readelf --elf-section, dwfl_module_addrsym and dwfl_module_getsym.
Mark Wielaard [Wed, 16 Jan 2013 14:19:40 +0000 (15:19 +0100)]
tests: readelf --elf-section, dwfl_module_addrsym and dwfl_module_getsym.

Various tests for the new minisymtab support.

Signed-off-by: Mark Wielaard <mjw@redhat.com>
11 years agolibdwfl: Add minisymtab support.
Mark Wielaard [Wed, 16 Jan 2013 14:19:32 +0000 (15:19 +0100)]
libdwfl: Add minisymtab support.

Add an auxiliary symbol table dwfl_file aux_sym to Dwfl_Module if all we
have is the dynsym table.  The main file might contain a .gnu_debugdata
section. The .gnu_debugdata section is a compressed embedded ELF file
that contains the text (code) section symbols from the symtab table
that are not in the main file dynsym table. dwfl_module_getsymtab (),
dwfl_module_addrsym () and dwfl_module_getsym () will use the auxiliary
symbol table when available (and no full symtab is available from the
debug file).

    * libdwflP.h (struct Dwfl_Module): Add aux_sym, aux_symdata,
    aux_syments, aux_symstrdata, aux_symxndxdata and aux_first_global.
    (dwfl_adjusted_aux_sym_addr): New function.
    (dwfl_deadjust_aux_sym_addr): Likewise.
    (dwfl_adjusted_st_value): Take and check symfile argument.
    (dwfl_deadjust_st_value): Likewise.
    * dwfl_module_getdwarf.c (find_prelink_address_sync): Take and
    use dwfl_file as argument to set address_sync.
    (find_debuginfo): Call find_prelink_address_sync with debug file.
    (find_aux_sym): New function.
    (find_symtab): Use find_aux_sym if all we have is the dynsym table
    and fill in aux DwflModule fields.
    (dwfl_module_getsymtab): Return syments plus aux_syments.
    (load_symtab): Always set first_global.
    * dwfl_module_addrsym.c (dwfl_module_addrsym): Check symfile
    when using same_section. Calculate first_global based on both
    mod->first_global and mod->aux_first_global.
    * dwfl_module.c (__libdwfl_module_free): Free aux_sym.
    * dwfl_module_getsym.c (dwfl_module_getsym): Use auxsym table
    to retrieve symbol and name if necessary, making sure all locals
    from any table come before any globals.
    * dwfl_module_info.c (dwfl_module_info): Call dwfl_adjusted_st_value
    with symfile.
    * relocate.c (resolve_symbol): Likewise.

https://fedoraproject.org/wiki/Features/MiniDebugInfo

Signed-off-by: Mark Wielaard <mjw@redhat.com>
11 years agoreadelf: Add --elf-section input option to inspect an embedded ELF file.
Mark Wielaard [Wed, 16 Jan 2013 14:19:20 +0000 (15:19 +0100)]
readelf: Add --elf-section input option to inspect an embedded ELF file.

Some binaries might have (compressed) embedded ELF files inside a section.
The default section name for this is .gnu_debugdata.  This normally
consists of just those sections needed to provide an auxiluary symbol
table.  But can theoretically contain other (debug) sections.  The new
--elf-section arguments makes it possible to easily inspect it as if it
is a normal ELF file.  libdwfl takes care of automatically decompressing
any data in the section if necessary.

https://fedoraproject.org/wiki/Features/MiniDebugInfo

ELF input selection:
   --elf-section[=SECTION]  Use the named SECTION (default .gnu_debugdata)
                            as (compressed) ELF input data

Signed-off-by: Mark Wielaard <mjw@redhat.com>
11 years agoar.c (do_oper_delete): Fix num passed to memset.
David Abdurachmanov [Sun, 13 Jan 2013 15:44:21 +0000 (16:44 +0100)]
ar.c (do_oper_delete): Fix num passed to memset.

Signed-off-by: David Abdurachmanov <David.Abdurachmanov@cern.ch>
11 years agoMake run-prelink-addr-test.sh robust in its use of ln.
Roland McGrath [Mon, 7 Jan 2013 23:13:46 +0000 (15:13 -0800)]
Make run-prelink-addr-test.sh robust in its use of ln.

Signed-off-by: Roland McGrath <roland@hack.frob.com>
11 years agodwfl_link_map_report: Handle unaligned auxv data.
Roland McGrath [Mon, 7 Jan 2013 22:53:37 +0000 (14:53 -0800)]
dwfl_link_map_report: Handle unaligned auxv data.

Signed-off-by: Roland McGrath <roland@hack.frob.com>
11 years agoelf_getarsym: Handle unaligned data in archive index.
Roland McGrath [Mon, 7 Jan 2013 22:30:54 +0000 (14:30 -0800)]
elf_getarsym: Handle unaligned data in archive index.

11 years agoelf_getarsym: Use memcpy instead of pointer dereference so as not to assume the field...
Roland McGrath [Mon, 7 Jan 2013 21:01:10 +0000 (13:01 -0800)]
elf_getarsym: Use memcpy instead of pointer dereference so as not to assume the field is naturally aligned.

Signed-off-by: Roland McGrath <roland@hack.frob.com>
11 years agoreadelf: Adjust initial FDE address if pcrel before printing.
Mark Wielaard [Fri, 21 Dec 2012 21:11:44 +0000 (22:11 +0100)]
readelf: Adjust initial FDE address if pcrel before printing.

The FDE initial_location is printed as start address with format_dwarf_addr.
Which does the right thing for .debug_frame addresses, but in .eh_frame
this is encoded as DW_EH_PE_pcrel and so needs to be adjusted before
formatting.

Signed-off-by: Mark Wielaard <mjw@redhat.com>
11 years agoaddr2line: Cleanup Dwfl when done.
Mark Wielaard [Fri, 21 Dec 2012 09:02:11 +0000 (10:02 +0100)]
addr2line: Cleanup Dwfl when done.

Make sure addr2line and libdwfl don't leak memory.

Signed-off-by: Mark Wielaard <mjw@redhat.com>
11 years agoFix sig8_hash memory leak in libdw/dwarf_begin_elf.c on error.
Mark Wielaard [Tue, 18 Dec 2012 13:14:22 +0000 (14:14 +0100)]
Fix sig8_hash memory leak in libdw/dwarf_begin_elf.c on error.

Signed-off-by: Mark Wielaard <mjw@redhat.com>
11 years agoFix two failure condition checks in libdwfl/linux-kernel-modules.c.
Mark Wielaard [Tue, 11 Dec 2012 13:21:01 +0000 (14:21 +0100)]
Fix two failure condition checks in libdwfl/linux-kernel-modules.c.

In report_kernel () if find_kernel_elf () fails then fname hasn't been
allocated or already freed. Don't free it again.

Brackets around unlikely expression in report_kernel_archive were incorrect
making the check always succeed.

Signed-off-by: Mark Wielaard <mjw@redhat.com>
11 years agoAdd missing semicolon in show_symbols_sysv
Mark Wielaard [Tue, 11 Dec 2012 21:27:05 +0000 (22:27 +0100)]
Add missing semicolon in show_symbols_sysv

Signed-off-by: Mark Wielaard <mjw@redhat.com>
11 years agonm: Fix size passed to snprintf for invalid sh_name case.
Roland McGrath [Tue, 11 Dec 2012 17:42:07 +0000 (09:42 -0800)]
nm: Fix size passed to snprintf for invalid sh_name case.

Signed-off-by: Roland McGrath <roland@hack.frob.com>
11 years agoRun valgrind tests with --run-libc-freeres=no.
Mark Wielaard [Mon, 3 Dec 2012 16:01:09 +0000 (17:01 +0100)]
Run valgrind tests with --run-libc-freeres=no.

By default valgrind tries to free up glibc memory at exit by running
__libc_freeres (). Unfortunately some older glibc versions have bugs
that either crash the test or make valgrind report errors. Since we
aren't interested in tracking memory leaks in glibc anyway, just
disable it.

Signed-off-by: Mark Wielaard <mjw@redhat.com>
11 years agolibdwfl/
Jan Kratochvil [Wed, 17 Oct 2012 22:11:30 +0000 (00:11 +0200)]
libdwfl/
* argp-std.c: Update Copyright year.
(offline_find_elf): New function.
(offline_callbacks): Use it for find_elf.
(struct parse_opt): New.
(parse_opt): New key ARGP_KEY_INIT.  In other make hook struct
parse_opt pointer from former Dwfl pointer.  Delay 'e and OPT_COREFILE
processing till ARGP_KEY_SUCCESS.  Initialize state->input already from
ARGP_KEY_SUCCESS.  Modify the cleanup in ARGP_KEY_ERROR.  Make the
final state->input initialization optional.
* dwfl_end.c: Update Copyright year.
(dwfl_end): Free executable_for_core.
* libdwflP.h: Update Copyright year.
(struct Dwfl): New field executable_for_core.

tests/
* run-addrname-test.sh: New test for PIE relocation.
* testfile70.core.bz2: New file.
* testfile70.exec.bz2: New file.
* Makefile.am (EXTRA_DIST): Add testfile70.core.bz2 and
testfile70.exec.bz2 .

Signed-off-by: Jan Kratochvil <jan.kratochvil@redhat.com>
11 years agolibdwfl/
Jan Kratochvil [Sat, 27 Oct 2012 18:45:27 +0000 (20:45 +0200)]
libdwfl/
* dwfl_report_elf.c (__libdwfl_report_elf): Simplify START and BIAS
calculation.

Signed-off-by: Jan Kratochvil <jan.kratochvil@redhat.com>
11 years agoreadelf.c (print_ops): Ajust DW_OP_skip and DW_OP_bra targets calculation.
Mark Wielaard [Fri, 16 Nov 2012 11:25:04 +0000 (12:25 +0100)]
readelf.c (print_ops): Ajust DW_OP_skip and DW_OP_bra targets calculation.

The 2-byte constant is the number of bytes of the DWARF expression to skip
forward or backward from the current operation, beginning after the 2-byte
constant.

Signed-off-by: Mark Wielaard <mjw@redhat.com>
11 years agotests/
Jan Kratochvil [Sat, 27 Oct 2012 19:31:58 +0000 (21:31 +0200)]
tests/
* Makefile.am (EXTRA_DIST): Add testfile64.bz2, testfile65.bz2,
testfile69.core.bz2 and testfile69.so.bz2 .

Signed-off-by: Jan Kratochvil <jan.kratochvil@redhat.com>
11 years agolibdwfl/
Jan Kratochvil [Wed, 17 Oct 2012 19:49:10 +0000 (21:49 +0200)]
libdwfl/
2012-10-17  Jan Kratochvil  <jan.kratochvil@redhat.com>

* dwfl_module_getdwarf.c (mod_verify_build_id): New function with code
from ...
(__libdwfl_getelf): ... here.  Call it.

tests/
2012-10-17  Jan Kratochvil  <jan.kratochvil@redhat.com>

* run-addrname-test.sh: New test for DSO with build-id bias.
* testfile69.core.bz2: New file.
* testfile69.so.bz2: New file.

Signed-off-by: Jan Kratochvil <jan.kratochvil@redhat.com>
11 years agolibdwfl/
Jan Kratochvil [Wed, 17 Oct 2012 20:04:24 +0000 (22:04 +0200)]
libdwfl/
2012-10-17  Jan Kratochvil  <jan.kratochvil@redhat.com>

* libdwfl.h (dwfl_module_getelf): Add __nonnull_attribute__.

Signed-off-by: Jan Kratochvil <jan.kratochvil@redhat.com>
11 years agolibebl/
Jan Kratochvil [Fri, 12 Oct 2012 18:43:21 +0000 (20:43 +0200)]
libebl/
2012-10-12  Jan Kratochvil  <jan.kratochvil@redhat.com>

* ebl-hooks.h (abi_cfi): Extend its comment for return value.
* eblopenbackend.c (default_abi_cfi): Return -1.
* libebl.h (ebl_abi_cfi): Extend its comment for return value.

Signed-off-by: Jan Kratochvil <jan.kratochvil@redhat.com>
11 years agosrc/
Jan Kratochvil [Wed, 10 Oct 2012 20:27:58 +0000 (22:27 +0200)]
src/
2012-10-12  Jan Kratochvil  <jan.kratochvil@redhat.com>

* readelf.c (ITEM_WRAP_COLUMN, REGISTER_WRAP_COLUMN): Merge to ...
(WRAP_COLUMN): ... here.
(print_core_item): Remove parameter format_max.  Update function
comment.  Replace FORMAT_MAX by the real output width.
(handle_core_item): Remove the FORMAT_MAX values in TYPES, DO_TYPE,
calls of print_core_item, remove variable maxfmt, change
ITEM_WRAP_COLUMN to WRAP_COLUMN.
(handle_core_register): Remove the FORMAT_MAX values in TYPES, BITS,
calls of print_core_item, change REGISTER_WRAP_COLUMN to WRAP_COLUMN.

backends/
2012-10-12  Jan Kratochvil  <jan.kratochvil@redhat.com>

* linux-core-note.c (prstatus_items): Rename groups of sigpend and
sighold to signal2 and signal3.

Signed-off-by: Jan Kratochvil <jan.kratochvil@redhat.com>
11 years agoMissing ChangeLog entry from last commit.
Roland McGrath [Thu, 11 Oct 2012 21:53:18 +0000 (14:53 -0700)]
Missing ChangeLog entry from last commit.

Signed-off-by: Roland McGrath <roland@hack.frob.com>
11 years agosrc/
Jan Kratochvil [Thu, 11 Oct 2012 19:47:26 +0000 (21:47 +0200)]
src/
2012-10-11  Jan Kratochvil  <jan.kratochvil@redhat.com>

* readelf.c (handle_core_item) <b>: Make run an outer block variable.
Increase run only if LASTBIT != 0.  Print last element only if RUN > 0.

Signed-off-by: Jan Kratochvil <jan.kratochvil@redhat.com>
11 years agoRobustify makefile redirection use.
Roland McGrath [Wed, 10 Oct 2012 16:31:42 +0000 (09:31 -0700)]
Robustify makefile redirection use.

11 years agoMerge branch 'jankratochvil/vdso-bias'
Roland McGrath [Wed, 10 Oct 2012 16:31:00 +0000 (09:31 -0700)]
Merge branch 'jankratochvil/vdso-bias'

11 years agoHandle GNU extension opcodes in dwarf_getlocation
Petr Machata [Tue, 9 Oct 2012 00:11:29 +0000 (02:11 +0200)]
Handle GNU extension opcodes in dwarf_getlocation

11 years agoHandle partial read or write.
Adam Markey [Tue, 9 Oct 2012 09:05:53 +0000 (11:05 +0200)]
Handle partial read or write.

Ran into a situation where pread was returning less data than requested for
remote files on a networked filesystem. This patch modifies the IO wrappers
to request the remaining data as long as no real errors occured.

Signed-off-by: Adam Markey <adam@etinternational.com>
Signed-off-by: Mark Wielaard <mjw@redhat.com>
11 years agolibdwfl/
Jan Kratochvil [Wed, 10 Oct 2012 06:08:44 +0000 (08:08 +0200)]
libdwfl/
dwfl_segment_report_module.c (dwfl_segment_report_module): Initialize
mod->MAIN_BIAS.

tests/
run-addrname-test.sh: New test for core vDSO bias.
testfile65.bz2: New file.

Signed-off-by: Jan Kratochvil <jan.kratochvil@redhat.com>
11 years agolibdwfl/
Jan Kratochvil [Wed, 10 Oct 2012 06:04:01 +0000 (08:04 +0200)]
libdwfl/
* dwfl_module_addrsym.c (dwfl_module_addrsym): New function binding_value.  Use
it for both zero and non-zero size symbols comparisons.

tests/
* run-addrname-test.sh: New test for symbol preferences.
* testfile64.bz2: New file.

Signed-off-by: Jan Kratochvil <jan.kratochvil@redhat.com>
11 years agolib/
Jan Kratochvil [Mon, 8 Oct 2012 21:51:31 +0000 (23:51 +0200)]
lib/
system.h (eu_static_assert): New macro.

libdw/
cfi.c: New include system.h.
(execute_cfi) (enough_registers): Clear new memory after realloc.

Signed-off-by: Jan Kratochvil <jan.kratochvil@redhat.com>
11 years agolibdw/
Jan Kratochvil [Mon, 8 Oct 2012 21:34:35 +0000 (23:34 +0200)]
libdw/
fde.c (__libdw_find_fde): Change <fde != NULL> to likely.  Return
DWARF_E_NO_MATCH if .eh_frame_hdr points to FDE which is too short for searched
PC.

Signed-off-by: Jan Kratochvil <jan.kratochvil@redhat.com>
11 years agodwarf_getlocation.c (__libdw_intern_expression) <cfap>: Make new loclist
Jan Kratochvil [Mon, 8 Oct 2012 21:08:01 +0000 (23:08 +0200)]
dwarf_getlocation.c (__libdw_intern_expression) <cfap>: Make new loclist
element DW_OP_call_frame_cfa before decoding the opcodes.  Remove the later
DW_OP_call_frame_cfa push to RESULT.

Signed-off-by: Jan Kratochvil <jan.kratochvil@redhat.com>
11 years agoCode cleanup.
Jan Kratochvil [Mon, 8 Oct 2012 21:04:54 +0000 (23:04 +0200)]
Code cleanup.
fde.c (binary_search_fde): Remove always true <address >= start> conditional.
Move L initialization upwards.

Signed-off-by: Jan Kratochvil <jan.kratochvil@redhat.com>
11 years agoAdd configure --enable-valgrind option to run all tests under valgrind.
Mark Wielaard [Mon, 1 Oct 2012 14:14:12 +0000 (16:14 +0200)]
Add configure --enable-valgrind option to run all tests under valgrind.

Signed-off-by: Mark Wielaard <mjw@redhat.com>
11 years agocu.c (cudie_offset): Don't use type_sig8, it might not be initialized.
Mark Wielaard [Mon, 1 Oct 2012 14:12:10 +0000 (16:12 +0200)]
cu.c (cudie_offset): Don't use type_sig8, it might not be initialized.

Signed-off-by: Mark Wielaard <mjw@redhat.com>
11 years agoderelocate.c (find_section): Check next section exists before accessing it.
Mark Wielaard [Mon, 1 Oct 2012 14:10:46 +0000 (16:10 +0200)]
derelocate.c (find_section): Check next section exists before accessing it.

Signed-off-by: Mark Wielaard <mjw@redhat.com>
11 years agoTest elfutils output of a mixed core note.
Petr Machata [Mon, 24 Sep 2012 14:46:52 +0000 (16:46 +0200)]
Test elfutils output of a mixed core note.

This is a test for previous commit.  The core file was snipped so that only
headers and note contents are left.  NT_ARM_VFP is the note that exercises
the code.

Signed-off-by: Petr Machata <pmachata@redhat.com>
11 years agoIn mixed core notes, don't let handle_core_item repeat.
Petr Machata [Wed, 19 Sep 2012 14:52:07 +0000 (16:52 +0200)]
In mixed core notes, don't let handle_core_item repeat.

If a core note contains both registers and items, descsz is 0 to express
that we don't wish to repeat the items.  If there is only one item in
such note, a special block of code hits that passes &size to
handle_core_item, which will decrease that size by the amount consumed by
the item.  But because size is 0, it underflows and wraps, and the loop
following this block, which handles the common case, overruns the core
note buffer.

Signed-off-by: Petr Machata <pmachata@redhat.com>
11 years agoAdd back end code for interpreting NT_ARM_VFP core note.
Petr Machata [Mon, 24 Sep 2012 23:37:20 +0000 (01:37 +0200)]
Add back end code for interpreting NT_ARM_VFP core note.

Signed-off-by: Petr Machata <pmachata@redhat.com>
11 years agoTest elfutils output of VMCOREINFO note.
Petr Machata [Mon, 24 Sep 2012 14:16:27 +0000 (16:16 +0200)]
Test elfutils output of VMCOREINFO note.

The test file is partial kdump image, with only headers and notes left in.

Signed-off-by: Petr Machata <pmachata@redhat.com>
11 years agoChange FPREGSET_SIZE in ARM backend to 116 to match sizeof struct user_fp
Petr Machata [Mon, 17 Sep 2012 19:00:21 +0000 (21:00 +0200)]
Change FPREGSET_SIZE in ARM backend to 116 to match sizeof struct user_fp

Signed-off-by: Petr Machata <pmachata@redhat.com>
11 years agoAdd allregs test for ARM back end
Petr Machata [Tue, 18 Sep 2012 19:35:19 +0000 (21:35 +0200)]
Add allregs test for ARM back end

Signed-off-by: Petr Machata <pmachata@redhat.com>
11 years agoHandle new core note types in EBL
Petr Machata [Thu, 30 Aug 2012 14:01:02 +0000 (16:01 +0200)]
Handle new core note types in EBL

Signed-off-by: Petr Machata <pmachata@redhat.com>
11 years agoUpdate elf.h from glibc.
Petr Machata [Mon, 17 Sep 2012 15:22:02 +0000 (17:22 +0200)]
Update elf.h from glibc.

Signed-off-by: Petr Machata <pmachata@redhat.com>
11 years agoUpdated Polish translation.
Piotr Drąg [Sun, 2 Sep 2012 17:13:29 +0000 (19:13 +0200)]
Updated Polish translation.

Signed-off-by: Piotr Drąg <piotrdrag@gmail.com>
11 years agoPrepare 0.155 release. elfutils-0.155
Mark Wielaard [Mon, 27 Aug 2012 13:31:31 +0000 (15:31 +0200)]
Prepare 0.155 release.

Signed-off-by: Mark Wielaard <mjw@redhat.com>
11 years agoreadelf.c (print_debug_macro_section): Print offset as PRIx64.
Mark Wielaard [Mon, 27 Aug 2012 13:21:58 +0000 (15:21 +0200)]
readelf.c (print_debug_macro_section): Print offset as PRIx64.

Signed-off-by: Mark Wielaard <mjw@redhat.com>
11 years agoreadelf.c (register_info): Handle loc == NULL.
Mark Wielaard [Mon, 27 Aug 2012 12:30:05 +0000 (14:30 +0200)]
readelf.c (register_info): Handle loc == NULL.

register_info is called by print_cfa_program with loc being NULL.

Signed-off-by: Mark Wielaard <mjw@redhat.com>
11 years agotests: Add testfile60.bz2 to EXTRA_DIST.
Mark Wielaard [Fri, 24 Aug 2012 12:51:37 +0000 (14:51 +0200)]
tests: Add testfile60.bz2 to EXTRA_DIST.

Signed-off-by: Mark Wielaard <mjw@redhat.com>
11 years agoAdd support for Tilera TILE-Gx processor.
Jeff Kenton [Wed, 22 Aug 2012 13:00:03 +0000 (09:00 -0400)]
Add support for Tilera TILE-Gx processor.

Signed-off-by: Jeff Kenton <jkenton@tilera.com>
11 years agoDon't include dwz support by default.
Mark Wielaard [Fri, 24 Aug 2012 11:54:52 +0000 (13:54 +0200)]
Don't include dwz support by default.

By default the dwz multi file support is not included.  This means any
DW_FORM_GNU_ref_alt or DW_FORM_GNU_strp_alt encountered in libdw will
just produce an error message.  A new configure option --enable-dwz is
needed to include it for those we wish to test it.  The dwz test is also
disabled by default.

Signed-off-by: Mark Wielaard <mjw@redhat.com>
11 years agoUse ELF in NEWS.
Mark Wielaard [Wed, 22 Aug 2012 07:57:36 +0000 (09:57 +0200)]
Use ELF in NEWS.

Signed-off-by: Mark Wielaard <mjw@redhat.com>
11 years agoAdd 0.155 NEWS entries for libelf, libdw and readelf.
Mark Wielaard [Tue, 21 Aug 2012 10:22:08 +0000 (12:22 +0200)]
Add 0.155 NEWS entries for libelf, libdw and readelf.

Signed-off-by: Mark Wielaard <mjw@redhat.com>
11 years agoUpdate Ukrainian translation.
Yuri Chornoivan [Mon, 20 Aug 2012 15:13:10 +0000 (18:13 +0300)]
Update Ukrainian translation.

Signed-off-by: Yuri Chornoivan <yurchor@ukr.net>
11 years agoRewrite DWARF string functions using known-dwarf macros.
Mark Wielaard [Thu, 16 Aug 2012 22:35:03 +0000 (00:35 +0200)]
Rewrite DWARF string functions using known-dwarf macros.

readelf and tests were using hard coded string tables to produce DWARF
string constants. Use the known-dwarf macros to redefine these and
reduce code. Technique comes from dwarf branch dwarfstrings.c.

Signed-off-by: Mark Wielaard <mjw@redhat.com>
11 years agoUpdate elf.h from glibc.
Roland McGrath [Thu, 16 Aug 2012 17:39:52 +0000 (10:39 -0700)]
Update elf.h from glibc.

Signed-off-by: Roland McGrath <roland@hack.frob.com>
11 years agoelf32_checksum.c: Removed unused ebl_debugscn_p define and confusing comment.
Mark Wielaard [Tue, 14 Aug 2012 14:48:50 +0000 (16:48 +0200)]
elf32_checksum.c: Removed unused ebl_debugscn_p define and confusing comment.

Signed-off-by: Mark Wielaard <mjw@redhat.com>
11 years agoUpdate main bugzilla URL
Jan Pokorný [Tue, 14 Aug 2012 12:42:22 +0000 (14:42 +0200)]
Update main bugzilla URL

Signed-off-by: Jan Pokorný <jpokorny@redhat.com>
11 years agolibdw: Add support for DWZ multifile forms DW_FORM_GNU_ref_alt/strp_alt.
Mark Wielaard [Fri, 22 Jun 2012 10:02:45 +0000 (12:02 +0200)]
libdw: Add support for DWZ multifile forms DW_FORM_GNU_ref_alt/strp_alt.

DWZ multifile forms http://www.dwarfstd.org/ShowIssue.php?issue=120604.1
DW_FORM_GNU_ref_alt and DW_FORM_GNU_strp_alt reference an alternative
debuginfo file.  dwarf_begin and dwarf_begin_elf will try to use this
automatically.  There are no user visible changes to the libdw interface.

dwarf_formref_die, dwarf_formstring and dwarf_formudata can now return
a Dwarf_Die which comes from a CU in the alternative Dwarf descriptor.

__libdw_read_offset was adjusted to take an alternative Dwarf descriptor
into account.

Signed-off-by: Mark Wielaard <mjw@redhat.com>
11 years agoFix formatting string in readelf
Petr Machata [Wed, 1 Aug 2012 19:43:58 +0000 (21:43 +0200)]
Fix formatting string in readelf

This caused failures of 32-bit builds.

Signed-off-by: Petr Machata <pmachata@redhat.com>
11 years agoTest case for handling archives with 64-bit symbol table
Petr Machata [Wed, 1 Aug 2012 19:41:36 +0000 (21:41 +0200)]
Test case for handling archives with 64-bit symbol table

Signed-off-by: Petr Machata <pmachata@redhat.com>
11 years agoImplement support for archives with 64-bit symbol table
Petr Machata [Wed, 1 Aug 2012 19:37:52 +0000 (21:37 +0200)]
Implement support for archives with 64-bit symbol table

Signed-off-by: Petr Machata <pmachata@redhat.com>
11 years agotests: Add run-nm-self.sh and run-readelf-self.sh tests.
Mark Wielaard [Wed, 1 Aug 2012 13:39:11 +0000 (15:39 +0200)]
tests: Add run-nm-self.sh and run-readelf-self.sh tests.

Signed-off-by: Mark Wielaard <mjw@redhat.com>
11 years agotests: Introduce testrun_on_self, use it in run-elflint-self.sh
Mark Wielaard [Wed, 1 Aug 2012 13:31:12 +0000 (15:31 +0200)]
tests: Introduce testrun_on_self, use it in run-elflint-self.sh

Signed-off-by: Mark Wielaard <mjw@redhat.com>
11 years agoReorder formatting string arguments so that there are no gaps in references
Petr Machata [Mon, 30 Jul 2012 17:48:28 +0000 (19:48 +0200)]
Reorder formatting string arguments so that there are no gaps in references

It is required that formatting string that uses $-style references lists
all arguments.

Signed-off-by: Petr Machata <pmachata@redhat.com>
11 years agoreadelf: Use DW_LANG_ObjC and known[op].
Mark Wielaard [Sun, 29 Jul 2012 12:05:20 +0000 (14:05 +0200)]
readelf: Use DW_LANG_ObjC and known[op].

Not all patches from the dwarfstrings branch were applied, causing compile
failures.

11 years agoconfig: known-dwarf.awk Fix "Generated by" header.
Mark Wielaard [Thu, 19 Jul 2012 21:31:45 +0000 (23:31 +0200)]
config: known-dwarf.awk Fix "Generated by" header.

Generated header had wrong file names for config/known-dwarf.awk
and libdw/dwarf.h contents.

Signed-off-by: Mark Wielaard <mjw@redhat.com>
11 years agoAdd DW_OP_GNU_parameter_ref to dwarf.h and handle it in readelf.
Mark Wielaard [Thu, 19 Jul 2012 22:09:56 +0000 (00:09 +0200)]
Add DW_OP_GNU_parameter_ref to dwarf.h and handle it in readelf.

DW_OP_GNU_parameter_ref takes as operand a 4 byte CU relative reference
to the abstract optimized away DW_TAG_formal_parameter.

Signed-off-by: Mark Wielaard <mjw@redhat.com>
11 years agoCorrect spelling of DW_LANG_ObjC in dwarf.h.
Mark Wielaard [Tue, 24 Jul 2012 11:20:41 +0000 (13:20 +0200)]
Correct spelling of DW_LANG_ObjC in dwarf.h.

Fix usage in dwarf_aggregate_size.

Signed-off-by: Mark Wielaard <mjw@redhat.com>
11 years agolibdw: Add DWARF4 DW_ATE_UTF.
Mark Wielaard [Tue, 24 Jul 2012 18:00:14 +0000 (20:00 +0200)]
libdw: Add DWARF4 DW_ATE_UTF.

Signed-off-by: Mark Wielaard <mjw@redhat.com>
11 years agoelf_getshdr should work for elf->flags & ELF_F_MALLOCED.
Mark Wielaard [Wed, 18 Jul 2012 11:14:30 +0000 (13:14 +0200)]
elf_getshdr should work for elf->flags & ELF_F_MALLOCED.

Reported-by: Nick Alcock <nix@esperi.org.uk>
Signed-off-by: Mark Wielaard <mjw@redhat.com>
11 years agotest: run-elflint-self.sh ebl shared libraries are under backends now.
Mark Wielaard [Thu, 19 Jul 2012 20:59:18 +0000 (22:59 +0200)]
test: run-elflint-self.sh ebl shared libraries are under backends now.

Signed-off-by: Mark Wielaard <mjw@redhat.com>
11 years agotest_cleanup run-unstrip-n.sh and add testcore-rtlib-ppc.bz2 to EXTRA_DIST.
Mark Wielaard [Thu, 19 Jul 2012 11:07:39 +0000 (13:07 +0200)]
test_cleanup run-unstrip-n.sh and add testcore-rtlib-ppc.bz2 to EXTRA_DIST.

Signed-off-by: Mark Wielaard <mjw@redhat.com>
11 years agoMerge branch 'debug_macro'
Mark Wielaard [Thu, 19 Jul 2012 09:30:48 +0000 (11:30 +0200)]
Merge branch 'debug_macro'

11 years agoMerge branch 'gdb_index7'
Mark Wielaard [Thu, 19 Jul 2012 09:25:07 +0000 (11:25 +0200)]
Merge branch 'gdb_index7'

11 years agoAdd ppc testcase for elf32_xlatetom.c fix.
Mark Wielaard [Tue, 17 Jul 2012 19:12:39 +0000 (21:12 +0200)]
Add ppc testcase for elf32_xlatetom.c fix.

Fails before commit bc0f74 on x86, succeeds after.

Signed-off-by: Mark Wielaard <mjw@redhat.com>
11 years agoelf*_xlatetom: do not check ELF_T_NHDR has integer number of records
Petr Machata [Tue, 17 Jul 2012 14:29:18 +0000 (16:29 +0200)]
elf*_xlatetom: do not check ELF_T_NHDR has integer number of records

See this bug report for more details:
  https://bugzilla.redhat.com/show_bug.cgi?id=835877

Signed-off-by: Petr Machata <pmachata@redhat.com>
11 years agotests: only compile test programs when running test
Mike Frysinger [Tue, 26 Jun 2012 16:07:44 +0000 (12:07 -0400)]
tests: only compile test programs when running test

The test binaries are only needed by make check, so change the PROGRAMS
category from noinst_ to check_ to speed up default `make && make install`.

If people want to run the tests, then the utilities will be compiled
automatically when they run `make check`, so the normal workflow should
be unchanged.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Mark Wielaard <mjw@redhat.com>
12 years agoreadelf: Add .debug_macro parsing support.
Mark Wielaard [Fri, 29 Jun 2012 20:30:15 +0000 (22:30 +0200)]
readelf: Add .debug_macro parsing support.

Signed-off-by: Mark Wielaard <mjw@redhat.com>
12 years agoreadelf: Add .gdb_index version 7 support.
Mark Wielaard [Fri, 29 Jun 2012 21:38:09 +0000 (23:38 +0200)]
readelf: Add .gdb_index version 7 support.

Add version 7 support. Keep track of cu_nr. Print kind and static/global
flag for each symbol. When a symbol is in the TU list add 'T'. Add
testfilegdbindex test files.

Signed-off-by: Mark Wielaard <mjw@redhat.com>
12 years agodwarf.h: Add DW_MACRO_GNU .debug_macro type encodings.
Mark Wielaard [Wed, 27 Jun 2012 08:15:27 +0000 (10:15 +0200)]
dwarf.h: Add DW_MACRO_GNU .debug_macro type encodings.

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