summaryrefslogtreecommitdiffstats
path: root/libebl
Commit message (Collapse)AuthorAgeFilesLines
* Stop build of unused libraries.Chih-Hung Hsieh2016-04-191-127/+0
| | | | | | | Only libelf.a is needed by Android now. Bug: 17281788 Change-Id: I4ae340884c8d19a42bece72f31edb59c193746b1
* Merge upstream 0.165 SHA '203f0a3'Chih-Hung Hsieh2016-01-253-181/+194
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * git merge 203f0a3 * See all upstream changes since the previous merge in branch aosp/upstream-master: git diff 9d1e236..203f0a3 * Android relevant upstream changes: * Version number changed from 0.164 to 0.165 * libelf now depends on zlib * Changed version number in generated files: version.h, config.h * No change to generated files: libdw/known-dwarf.h * Updated libelf/Android.mk: * added new source files: gelf_getchdr.c elf{32,64}_getchdr.c elf_compress.c * added LOCAL_STATIC_LIBRARIES := libz Change-Id: Ieb306d84ffcaf680ad6e74da28fcc8efbf00592a
| * libebl: Fix missing brackets around if statement body.Mark Wielaard2016-01-092-180/+187
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
| * libdwfl: Use elf_compress[_gnu] to decompress string, symbol and reloc data.Mark Wielaard2016-01-062-1/+7
| | | | | | | | | | | | | | | | | | 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>
* | Merge upstream SHA '9d1e236'Chih-Hung Hsieh2016-01-044-0/+24
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * git merge 9d1e236 * See all upstream changes since the previous merge in branch aosp/upstream-master: git diff b47fb23..9d1e236 * Android relevant upstream changes: Move nested functions to file scope to compile with clang/llvm: libdw/dwarf_entry_breakpoints.c libdw/libdw_visit_scopes.c libdwfl/core-file.c libdwfl/dwfl_module_addrsym.c libdwfl/dwfl_module_getdwarf.c libdwfl/link_map.c libdwfl/linux-proc-maps.c * Other upstream changes: backends: sparc: support for live backtraces elfcmp: Fix leaking Ebl handles. libdw: Don't leak fake_loc_cu. libdw: Don't leak duplicate FDEs. libdw: Don't use a FDE if it doesn't actually cover a real code range. libdw: Make sure Ebl is always freed from cfi frame cache. libdwfl: Don't leak core Elf and core file descriptor from argp-std. libdwfl: Fix memory leak in link_map.c dwfl_link_map_report. libdwfl: make the unwinder aware of the backend defined ra_offset. libebl: new backend attribute ra_offset. nm: Don't leak duplicate Dwarf local names. nm: If the file is ET_REL and we need Dwarf use libdwfl to get it relocated. tests: Fix some memory leaks in testcases. tests: Use valgrind --leak-check=full. unstrip: Don't leak new section data. * No changes to the following generated files: version.h, config.h, libdw/known-dwarf.h * Post merge change: Enable clang compilation in the libdw directory. Change-Id: Ifa9e60b1d5ab1c70da69410509cc9f3abdf58661
| * libebl: new backend attribute ra_offset.Jose E. Marchesi2016-01-034-0/+24
| | | | | | | | | | | | | | | | 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>
* | Enable clang compiler for some modules.Chih-Hung Hsieh2015-11-161-8/+0
| | | | | | | | | | | | | | * libdwelf, libebl, libelf can compile cleanly with clang now. * libdw and libdwfl still have some nested functions only compiled by gcc. Change-Id: Id43585c6d11f521ef0ccebe9cae4db9de436cdc0
* | Merge upstream commit '86ed7f7'.Chih-Hung Hsieh2015-10-082-1/+6
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | git merge 86ed7f7 Include upstream changes up to Thu Oct 8 00:16:03 2015. Previous clang compilation errors about union of VLA should be fixed with this merge. * Allocate exact amount of bytes for phdrs and shdrs. * Do without union of variable length arrays. * Other changes from upstream, not all used for Android: AM_SILENT_RULES coverage, sparc check_object_attribute ebl hook, Use -fPIC in PIC code. * No change of generated files such as: ./config.h, libdw/known-dwarf.h, ./version.h Change-Id: Iac63519112c4a92b57344f4a43bf0e9a6c4baa13
| * Use -fPIC instead of -fpic when generating PIC code.Jose E. Marchesi2015-10-062-1/+6
| | | | | | | | | | | | | | This avoids relocation overflows in sparc/sparc64 targets while linking, where the reachable data using -fpic is only 4kb. Signed-off-by: Jose E. Marchesi <jose.marchesi@oracle.com>
* | Merge in latest aosp/upstream-master d8698e55.Chih-Hung Hsieh2015-09-2949-200/+155
|\| | | | | | | | | | | | | | | | | | | | | | | git merge d8698e55cbe95e56c3a4cbd67c320048ea4f087a Include upstream changes up to Wed Sep 23 20:44:06 2015. Update generated files: ./config.h ./libdw/known-dwarf.h ./version.h Change-Id: Ica2510edda846659a0c89703aeafe85bd62abab8
| * Remove old-style function definitions.Mark Wielaard2015-09-2342-180/+60
| | | | | | | | | | | | | | We already require -std=gnu99 and old-style function definitions might hide some compiler warnings. Signed-off-by: Mark Wielaard <mjw@redhat.com>
| * Remove redundant NULL tests.Chih-Hung Hsieh2015-09-145-5/+15
| | | | | | | | | | | | | | | | GCC6 and Clang give warnings on redundant NULL tests of parameters that are declared with __nonnull_attribute__. Signed-off-by: Chih-Hung Hsieh <chh@google.com> Signed-off-by: Mark Wielaard <mjw@redhat.com>
| * Replace some K&R function definitions with ansi-C definitions.Chih-Hung Hsieh2015-09-073-5/+8
| | | | | | | | | | Signed-off-by: Chih-Hung Hsieh <chh@google.com> Signed-off-by: Mark Wielaard <mjw@redhat.com>
| * libebl: SHT_(INIT|FINI|PREINIT)_ARRAY are valid targets for relocation.Mark Wielaard2015-06-142-5/+18
| | | | | | | | | | | | | | Seen in run-elflint-self.sh for size.o when build with --enable-gcov. https://bugzilla.redhat.com/show_bug.cgi?id=1230798 Signed-off-by: Mark Wielaard <mjw@redhat.com>
| * libebl: Don't blow up stack when processing large NT_GNU_ABI_TAG.Mark Wielaard2015-05-272-2/+22
| | | | | | | | | | | | | | Normally an NT_GNU_ABI_TAG is large, just 4 words (16 bytes). Only use stack allocated conversion buf for small (max 16 words) notes. Signed-off-by: Mark Wielaard <mjw@redhat.com>
| * libebl: Use static number for array stack allocation in openbackend.Mark Wielaard2015-05-272-2/+13
| | | | | | | | | | | | | | | | | | Help the compiler see we stack allocate a small array. Add assert to check no machine prefix is ever larger than 16. Current maximum number is 7. This prevents gcc warning about possible unbounded stack usage with -Wstack-usage. Signed-off-by: Mark Wielaard <mjw@redhat.com>
| * s/Really, not guarantee/Really, no guarantee/gMark Wielaard2015-01-271-1/+1
| | | | | | | | Signed-off-by: Mark Wielaard <mjw@redhat.com>
| * libebl.h: Add comment from README that this is completely UNSUPPORTED.Mark Wielaard2015-01-272-1/+19
| | | | | | | | | | | | | | Make it really, really clear that the libebl interface is NOT source and NOT abi compatible and we will break any users. Signed-off-by: Mark Wielaard <mjw@redhat.com>
| * Use elf_getphdrnum instead of accessing ehdr->e_phnum directly.Mark Wielaard2014-11-265-9/+14
| | | | | | | | | | | | | | Using elf_getphdrnum lets us handle ELF files that use more than PN_XNUM phdrs. And guards against some corrupt files. Signed-off-by: Mark Wielaard <mjw@redhat.com>
| * Check elf_strptr didn't fail getting section name.Mark Wielaard2014-11-172-2/+6
| | | | | | | | | | | | | | | | Since elf_strptr can fail and return NULL we should always check the result before usage. Debug sections are only handled by section name, so make sure the name actually exists. Signed-off-by: Mark Wielaard <mjw@redhat.com>
| * libebl: Add ebl_func_addr_mask plus ARM backend implementation.Mark Wielaard2014-06-225-4/+34
| | | | | | | | | | | | | | | | | | | | | | | | | | | | The ARM EABI says that the zero bit of function symbol st_value indicates whether the symbol points to a THUMB or ARM function. Also the return value address in an unwind will contain the same extra bit to indicate whether to return to a regular ARM or THUMB function. Add a new ebl function to mask off such bits and turn a function value into a function address so that we get the actual value that a function symbol or return address points to. It isn't easily possible to reuse the existing ebl_resolve_sym_value for this purpose, so we end up with another hook that can be used from dwfl_module_getsym, handle_cfi and elflint. Signed-off-by: Mark Wielaard <mjw@redhat.com>
| * backends: Add ebl_check_reloc_target_type.Mark Wielaard2014-05-196-3/+74
| | | | | | | | | | | | | | | | | | And implement for arm and ia64. Both have special section types that are valid targets for a reloc. Both refer to unwind data. elflint now just calls ebl_check_reloc_target_type instead of hard coding the expected section types. Signed-off-by: Mark Wielaard <mjw@redhat.com>
| * libdwfl: Introduce dwfl_module_getsym_info and dwfl_module_addrinfo.Mark Wielaard2013-12-206-1/+69
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Some arches like ppc64 use function descriptor values instead of function addresses causing matching of names and addresses to fail when using dwfl_module_getsym or dwfl_module_addrsym. Add ebl hook to resolve any function descriptor values found in non-ET_REL modules. The new function dwfl_module_getsym_info doesn't adjust the symbol value in any way, but returns the adjusted and/or resolved address associated with the symbol separately. The new function dwfl_module_addrinfo resolves against both the address associated with the symbol (which could be the function entry address) value and the adjusted st_value. So that it is easy to resolve and match either function descriptors and/or function entry addresses. Since these new functions also return more information they replace the dwfl_module_getsym_elf and dwfl_module_addrsym_elf functions that never made it into a released elfutils version. addr2line and readelf now use the new functions when looking up functions names. addr2line will now also display the section the address was found in when given -x. Extra testcases were added for both addr2line and the dwflsyms testscase. Signed-off-by: Mark Wielaard <mjw@redhat.com>
| * unwinder: s390 and s390xJan Kratochvil2013-12-186-1/+143
| | | | | | | | Signed-off-by: Jan Kratochvil <jan.kratochvil@redhat.com>
| * unwinder: ppc and ppc64Jan Kratochvil2013-12-155-2/+65
| | | | | | | | Signed-off-by: Jan Kratochvil <jan.kratochvil@redhat.com>
| * Support AArch64 architecturePetr Machata2013-11-262-1/+6
| | | | | | | | Signed-off-by: Petr Machata <pmachata@redhat.com>
| * Code cleanup: Remove const in prototypeJan Kratochvil2013-11-142-4/+7
| | | | | | | | Signed-off-by: Jan Kratochvil <jan.kratochvil@redhat.com>
| * Unwinder for x86*.Jan Kratochvil2013-11-076-5/+97
| | | | | | | | | | Signed-off-by: Jan Kratochvil <jan.kratochvil@redhat.com> Signed-off-by: Mark Wielaard <mjw@redhat.com>
| * backends: ppc_abi_cfi reg1 use DW_CFA_val_offset not DW_CFA_val_expression.Mark Wielaard2013-10-072-0/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Register rules using expressions are stored using an offset from the start of the .eh_frame or .debug_frame ELF section data. Since abi_cfi rules aren't stored in those ELF sections they should use neither DW_CFA_expression nor DW_CFA_val_expression. The only backend that used DW_CFA_val_expression was ppc_cfi.c. It was easier to express the same rule using DW_CFA_val_offset than to change the code to handle register rules using expressions. On most architectures this did work by accident. See the definition of struct dwarf_frame_register value in libdw/cfi.h to see why. But on ia64 the abi_cfi data and actual frame data were placed too far apart and caused a crash in tests/run-addrcfi.sh for ppc32. Signed-off-by: Mark Wielaard <mjw@redhat.com>
| * Recognize names of some new core note types in ebl_core_note_type_namePetr Machata2013-09-272-1/+11
| | | | | | | | Signed-off-by: Petr Machata <pmachata@redhat.com>
| * eblsectionstripp.c (ebl_section_strip_p): Check shdr_l is not NULL.Mark Wielaard2013-09-252-2/+6
| | | | | | | | Signed-off-by: Mark Wielaard <mjw@redhat.com>
| * Updates for Automake 1.13.Mark Wielaard2013-04-262-1/+5
| | | | | | | | | | | | | | autoreconf will install config/test-driver, ignore it. Update gettext m4 and po files to version 0.18.2. Use AM_CPPFLAGS instead of INCLUDES. All changes are backward compatible with Automake 1.11.
| * libebl/Jan Kratochvil2012-10-124-3/+13
| | | | | | | | | | | | | | | | | | | | 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>
| * Handle new core note types in EBLPetr Machata2012-09-172-1/+18
| | | | | | | | Signed-off-by: Petr Machata <pmachata@redhat.com>
| * Add support for Tilera TILE-Gx processor.Jeff Kenton2012-08-242-0/+5
| | | | | | | | Signed-off-by: Jeff Kenton <jkenton@tilera.com>
| * Add low-level support for .debug_macro.Mark Wielaard2012-06-272-0/+6
| | | | | | | | Signed-off-by: Mark Wielaard <mjw@redhat.com>
| * Update name, license and contributor policy.Mark Wielaard2012-06-0551-2016/+969
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Change name from "Red Hat elfutils" to "elfutils". * Update license of standalone tools and test from GPLv2 to GPLv3+. * Change license of libraries from GPLv2+exception to GPLv2/LGPLv3+. * Add Developer Certificate of Origin based contributor policy. top-level: - COPYING: Upgraded from GPLv2 to GPLv3. - CONTRIBUTING, COPYING-GPLv2, COPYING-LGPLv3: New files. - NEWS: Added note about new contribution and license policy. - Makefile.am: Updated to GPLv3, added new files to EXTRA_DIST. - configure.ac: Update to GPLv3, changed AC_INIT name to 'elfutils'. backends, lib, libasm, libcpu, libdw, libdwfl, libebl, libelf: - All files updated to GPLv2/LGPLv3+. Except some very small files (<5 lines) which didn't have any headers at all before, the linker .maps files and the libcpu/defs files which only contain data and libelf/elf.h which comes from glibc and is under LGPLv2+. config: - elfutils.spec.in: Add new License: headers and new %doc files. - Update all license headers to GPLv2/LGPLv3+ for files used by libs. src, tests: - All files updated to GPLv3+. Except for the test bz2 data files, the linker maps and script files and some very small files (<5 lines) that don't have any headers. Signed-off-by: Richard Fontana <rfontana@redhat.com> Signed-off-by: Mark Wielaard <mjw@redhat.com>
| * Remove .mtn-ignore and .cvsignore files.Mark Wielaard2012-06-051-1/+0
| | | | | | | | We use .gitignore these days.
| * Add support for printing SDT elf notes.Mark Wielaard2011-04-266-10/+118
| | | | | | | | | | | | | | | | | | | | | | | | | | libebl/ * libebl.h (ebl_object_note_type_name): Add const char *name arg. * eblhooks.h (object_note_type_name): Likewise. * eblopenbackend.c (default_object_note_type_name): Likewise. * eblobjnotetypename.c (ebl_object_note_type_name): Likewise. And print version if name is "stapsdt". * eblobjnote.c (ebl_object_note): Add output for "stapsdt" notes. src/ * readelf.c (handle_notes_data): Call ebl_object_note_type_name with note name.
| * Fix doubled words.Marek Polacek2011-04-161-1/+1
| |
| * Fix typo in TLSDESC_GOT.Marek Polacek2011-03-212-1/+5
| |
| * Add new ebl_check_st_other_bits function.Mark Wielaard2011-03-116-3/+93
| |
| * Consider .gdb_index as a debugging section.Roland McGrath2010-07-072-0/+6
| |
| * Clean up and consolidate automake magic to reduce duplication and to work ↵Roland McGrath2010-02-152-23/+9
| | | | | | | | with --disable-dependency-tracking.
| * Make readelf -n check note name strings, handle "VMCOREINFO" flavor.Roland McGrath2010-01-045-19/+27
| |
| * Clean up NT_GNU_GOLD_VERSION printing.Roland McGrath2009-10-142-2/+6
| |
| * Match .debug_pubtypes and .debug_types as known DWARF section names.Roland McGrath2009-10-052-0/+8
| |
| * libebl: Fix allocation of memory for long stringsPetr Machata2009-09-022-7/+17
| |
| * ebl_strtabfinalize: Don't SEGV when no strings are presentPetr Machata2009-08-062-1/+7
| | | | | | | | (cherry picked from commit a3a81e8352571f8aa9721a8940fbe54543029958)
| * Handle text output for NT_GNU_GOLD_VERSION.Mark Wielaard2009-07-262-1/+10
| |