summaryrefslogtreecommitdiff
path: root/libebl/libebl.h
Commit message (Collapse)AuthorAgeFilesLines
* libebl: Remove unused ebl_syscall_abi.Mark Wielaard2020-10-261-8/+0
| | | | | | | | | GCC11 -Warray-parameter warned about ebl_syscall_abi being inconsistently declared (once with a pointer to int, once with an array of 6 int elements). Since ebl_syscall_abi isn't actually used and was only implemented for 3 backends without any tests just remove it. Signed-off-by: Mark Wielaard <mark@klomp.org>
* Only typedef Ebl once.Mark Wielaard2020-07-231-1/+3
| | | | | | | | | | | | | | | | Since commit 287a18452 libasm.h defines an opague Ebl handle. This is fine, except for (internal) code that also includes libebl.h. Since C11 having multiple typedefs for the same thing is fine, but we do build using GNU/C99. This also allows multiple same typedefs, except for (very) old GCCs. This only affects internal code, since libebl.h isn't a public header. For internal code, only add the typedef in libebl.h when libasm.h hasn't been included. Make sure all code that includes both headers includes libasm.h first. Signed-off-by: Mark Wielaard <mark@klomp.org>
* Don't use dlopen() for libebl modulesOmar Sandoval2019-08-291-7/+1
| | | | | | | | | | | | Currently, architecture-specific code for libebl exists in separate libebl_$ARCH.so libraries which libebl loads with dlopen() at runtime. This makes it impossible to have standalone, statically-linked binaries which use libdwfl if they depend on any architecture-specific functionality. Additionally, when these libraries cannot be found, the failure modes are non-obvious. So, let's get rid of libebl_$arch.so and move it all into libdw.so/libdw.a, which simplifies things considerably. Signed-off-by: Omar Sandoval <osandov@fb.com>
* libebl: Check NT_PLATFORM core notes contain a zero terminated string.Mark Wielaard2019-01-161-1/+2
| | | | | | | | | | Most strings in core notes are fixed size. But NT_PLATFORM contains just a variable length string. Check that it is actually zero terminated before passing to readelf to print. https://sourceware.org/bugzilla/show_bug.cgi?id=24089 Signed-off-by: Mark Wielaard <mark@klomp.org>
* Handle GNU Build Attribute ELF Notes.Mark Wielaard2018-11-131-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | GNU Build Attribute ELF Notes are generated by the GCC annobin plugin and described at https://fedoraproject.org/wiki/Toolchain/Watermark Unfortunately the constants aren't yet described in the standard glibc elf.h so they have been added to the elfutils specific elf-knowledge.h. The notes abuse the name owner field to encode some data not in the description. This makes it a bit hard to parse. We have to match the note owner name prefix (to "GA") to be sure the type is valid. We also cannot rely on the owner name being a valid C string since the attribute name and value can contain zero (terminators). So pass around namesz to the ebl note parsing functions. eu-elflint will recognize and eu-readelf -n will now show the notes: Note section [27] '.gnu.build.attributes' of 56080 bytes at offset 0x114564: Owner Data size Type GA 16 GNU Build Attribute OPEN Address Range: 0x2f30f - 0x2f30f VERSION: "3p8" GA 0 GNU Build Attribute OPEN TOOL: "gcc 8.2.1 20180801" GA 0 GNU Build Attribute OPEN "GOW": 45 GA 0 GNU Build Attribute OPEN STACK_PROT: 0 GA 0 GNU Build Attribute OPEN "stack_clash": TRUE GA 0 GNU Build Attribute OPEN "cf_protection": 0 GA 0 GNU Build Attribute OPEN "GLIBCXX_ASSERTIONS": TRUE GA 0 GNU Build Attribute OPEN "FORTIFY": 0 GA 0 GNU Build Attribute OPEN PIC: 3 GA 0 GNU Build Attribute OPEN SHORT_ENUM: FALSE GA 0 GNU Build Attribute OPEN ABI: c001100000012 GA 0 GNU Build Attribute OPEN "stack_realign": FALSE A new test was added to run-readelf -n for the existing annobin file. Signed-off-by: Mark Wielaard <mark@klomp.org>
* Recognize NT_VERSION notes.Mark Wielaard2018-11-131-2/+2
| | | | | | | | NT_VERSION notes are emitted by the gas .version directive. They have an empty description and (ab)use the owner name to store the version data string. Signed-off-by: Mark Wielaard <mark@klomp.org>
* Handle ADD/SUB relocationsAndreas Schwab2018-10-131-2/+4
| | | | | | This adds support for ADD and SUB relocations as seen on RISC-V. Signed-off-by: Andreas Schwab <schwab@suse.de>
* libebl: Use elf_getshdrstrndx in ebl_section_strip_p.Mark Wielaard2018-09-131-1/+1
| | | | | | | | | | The ebl_section_strip_p function used the Ehdr e_shstrndx field to get at the name of the (debug) sections. This is not correct if there are more than SHN_LORESERVE sections. Use elf_getshdrstrndx to get at the shstrtab section. And drop the Ehdr argument that isn't necessary anymore. Signed-off-by: Mark Wielaard <mark@klomp.org>
* backends: Always use elf_getshdrstrndx in check_special_symbol.Mark Wielaard2018-09-131-1/+1
| | | | | | | | | | The check_special_symbol backend functions used the Ehdr e_shstrndx field to get at the name of sections. This is not correct if there are more than SHN_LORESERVE sections. Always use elf_getshdrstrndx to get the shstrtab section. And drop the Ehdr argument that isn't necessary anymore. Signed-off-by: Mark Wielaard <mark@klomp.org>
* strip: Deal with ARM data marker symbols pointing to debug sections.Mark Wielaard2017-07-241-1/+5
| | | | | | | | | | | | | | | | | | | 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 <mark@klomp.org>
* Make __attribute__ conditional in all installed headersUlf Hermann2017-05-021-3/+3
| | | | | | | | | | __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 <ulf.hermann@qt.io>
* dwelf: Add string table functions from ebl.Mark Wielaard2016-08-031-25/+0
| | | | | | | | | | | | | | | | 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 <mjw@redhat.com>
* Remove eu-ld and unused code.Mark Wielaard2016-08-031-53/+1
| | | | | | | | 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 <mjw@redhat.com>
* libebl: new backend attribute ra_offset.Jose E. Marchesi2016-01-031-0/+6
| | | | | | | | 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>
* 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-271-1/+14
| | | | | | | 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-261-1/+1
| | | | | | | 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>
* libebl: Add ebl_func_addr_mask plus ARM backend implementation.Mark Wielaard2014-06-221-1/+12
| | | | | | | | | | | | | | 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-191-0/+3
| | | | | | | | | 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-201-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-181-0/+29
| | | | Signed-off-by: Jan Kratochvil <jan.kratochvil@redhat.com>
* unwinder: ppc and ppc64Jan Kratochvil2013-12-151-1/+9
| | | | Signed-off-by: Jan Kratochvil <jan.kratochvil@redhat.com>
* Code cleanup: Remove const in prototypeJan Kratochvil2013-11-141-4/+2
| | | | Signed-off-by: Jan Kratochvil <jan.kratochvil@redhat.com>
* Unwinder for x86*.Jan Kratochvil2013-11-071-1/+21
| | | | | 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-071-0/+5
| | | | | | | | | | | | | | | 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>
* libebl/Jan Kratochvil2012-10-121-1/+4
| | | | | | | | | | 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>
* Update name, license and contributor policy.Mark Wielaard2012-06-051-40/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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>
* Add support for printing SDT elf notes.Mark Wielaard2011-04-261-2/+3
| | | | | | | | | | | | | 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.
* Add new ebl_check_st_other_bits function.mpolacek/autotestMark Wielaard2011-03-111-0/+3
|
* Make readelf -n check note name strings, handle "VMCOREINFO" flavor.Roland McGrath2010-01-041-5/+5
|
* CFI support: lookup by PC and translate into DWARF location per registerRoland McGrath2009-07-081-1/+33
|
* src/Roland McGrath2008-08-071-0/+7
| | | | | | (find_symbol): Likewise. Convert plain number, or handle strings like "(section)+offset" or "symbol+offset".
* backends/Roland McGrath2008-04-011-0/+6
| | | | | | | | | | | * sparc_symbol.c (sparc_symbol_type_name): New function. (sparc_dynamic_tag_name): New function. (sparc_dynamic_tag_check): New function. * sparc_init.c (sparc_init): Initialize those hooks. libebl/ * ebldynamictagname.c (ebl_dynamic_tag_name): Use hex for unknown tag.
* Finish elflint .gnu.attributes checkingRoland McGrath2008-02-211-1/+10
|
* readelf register printing sort order tweakRoland McGrath2007-08-231-4/+37
|
* propagate from branch 'com.redhat.elfutils.roland.pending' (head ↵Ulrich Drepper2007-02-051-1/+4
| | | | | | c44dcfac5b545aecb173fede31f34cb003be0173) to branch 'com.redhat.elfutils' (head 4196d4e01486bdeb0c0632291881d1c6d7163fab)
* 2006-10-09 Roland McGrath <roland@redhat.com>Roland McGrath2006-10-101-3/+4
| | | | | * ia64_symbol.c (ia64_reloc_simple_type): Treat SECREL types as simple.
* merge of 2d5572f10b65f0ac7fdf54361b4dae41ebbd51d0Ulrich Drepper2006-07-071-0/+6
| | | | and fda3a25581b7bfac581504e9e887e9b97f234f86
* New spec file.elfutils-0.121Ulrich Drepper2006-06-151-6/+0
|
* Linker work.Ulrich Drepper2006-07-051-0/+6
| | | | | GNU hash support. 64-bit SysV hash support.
* Don't create INTERP and PHDR program header entry if a DSO is created withoutUlrich Drepper2006-06-121-0/+3
| | | | | | | | | | a specific interpreter. Ignore duplicate COMDAT group sections. elflint should not complain about anything about *_NONE relocations. Add support to libebl to determine whether given relocation is *_NONE relocation.
* Add extern "C" for libdwfl.h and libebl.h.Ulrich Drepper2006-05-271-1/+9
|
* Fix FSF address. No exception for libdwarf.Ulrich Drepper2006-04-041-1/+1
|
* propagate from branch 'com.redhat.elfutils.roland.pending' (head ↵Ulrich Drepper2006-04-041-10/+46
| | | | | | 4f8fc821345feef58624f0aa5b470d4827577d8c) to branch 'com.redhat.elfutils' (head 76e26cb54695fd3b21ee8fb5be3036bd68200633)
* merge of 2cc527e6d8c8ff19dab478f7d12e58f1cfa6d6f5Roland McGrath2005-12-051-0/+14
| | | | and 7b542932f3e2947183b45bdbf39d448f457da9fd
* Update new test after merge.Roland McGrath2005-11-171-0/+14
|
* 2005-11-16 Roland McGrath <roland@redhat.com>Roland McGrath2005-11-161-1/+1
| | | | | * libebl.h: Use "" for elf-knowledge.h, not <>.
* Minor cleanups of last changes to elflint and libebl to supportUlrich Drepper2005-08-131-2/+2
| | | | clean ppc/ppc64 handling.
* libebl/Roland McGrath2005-08-131-2/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 2005-08-12 Roland McGrath <roland@redhat.com> * libeblP.h (struct ebl): Add bss_plt_p hook. * eblopenbackend.c (default_bss_plt_p): New function. (fill_defaults): Use it. * eblbsspltp.c: New file. * Makefile.am (gen_SOURCES): Add it. * libebl.h: Declare ebl_bss_plt_p. * ppc_symbol.c (ppc_bss_plt_p): New function. * libebl_ppc.h: Declare it. * ppc_init.c (ppc_init): Use it. * ppc64_symbol.c (ppc64_bss_plt_p): New function. * libebl_ppc64.h: Declare it. * ppc64_init.c (ppc64_init): Use it. * ebl_check_special_symbol.c: New file. * Makefile.am (gen_SOURCES): Add it. * libebl.h: Declare ebl_check_special_symbol. * libeblP.h (struct ebl): Add check_special_symbol hook. * eblopenbackend.c (default_check_special_symbol): New function. (fill_defaults): Use it. * ppc_symbol.c (ppc_check_special_symbol): New function. * libebl_ppc.h: Add prototype. * ppc_init.c (ppc_init): Use it. * ppc64_symbol.c (ppc64_check_special_symbol): New function. * libebl_ppc64.h: Add prototype. * ppc64_init.c (ppc64_init): Use it. src/ 2005-08-12 Roland McGrath <roland@redhat.com> * elflint.c (check_symtab): Check that _GLOBAL_OFFSET_TABLE_ st_shndx refers to the right section if it's not SHN_ABS. Let ebl_check_special_symbol override _G_O_T_ value and size checks. * elflint.c (check_sections): Don't complain about a non-NOBITS section taking no segment space, if it's sh_size is 0. * elflint.c (check_sections): Use ebl_bss_plt_p to see if .plt should be PROGBITS or NOBITS. * elflint.c (check_symtab): Use ebl_check_special_symbol to override standard st_value and st_size checks.
* Add some patches from the disasm-branch branch.Ulrich Drepper2005-08-031-0/+12
| | | | | The asm_begin interface changed. In text mode output is really written to the file.