summaryrefslogtreecommitdiff
path: root/libebl
Commit message (Collapse)AuthorAgeFilesLines
* Add support for Synopsys ARCv2 processorsShahab Vahedi2022-12-222-0/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | There is no regression in tests for an x86_64 build, while the new hello_arc_hs4.ko is added as well. This is the only meaningful test that I could add at the moment, given the features supported by this port. $ cat tests/test-suite.log ========================================== elfutils 0.188: tests/test-suite.log ========================================== # TOTAL: 236 # PASS: 235 # SKIP: 1 # XFAIL: 0 # FAIL: 0 # XPASS: 0 # ERROR: 0 .. contents:: :depth: 2 SKIP: run-lfs-symbols.sh ======================== LFS testing is irrelevant on this system SKIP run-lfs-symbols.sh (exit status: 77) $ cat tests/run-strip-reloc.sh.log runtest hello_i386.ko runtest hello_x86_64.ko runtest hello_ppc64.ko runtest hello_s390.ko runtest hello_aarch64.ko runtest hello_m68k.ko runtest hello_riscv64.ko runtest hello_csky.ko runtest hello_arc_hs4.ko <-- [ new ARC HS4 test ] runtest /home/shahab/pahole_pkg/elfutils-git/bld_arc/src/strip runtest /home/shahab/pahole_pkg/elfutils-git/bld_arc/src/strip.o runtest strip-uncompressed.o runtest strip-compressed.o runtest testfile-debug-rel-ppc64.o runtest testfile-debug-rel-ppc64-z.o runtest testfile-debug-rel-ppc64-g.o PASS run-strip-reloc.sh (exit status: 0) Signed-off-by: Shahab Vahedi <shahab@synopsys.email>
* Add support for LoongArchHengqi Chen2022-12-192-0/+6
| | | | | | This implements initial support for the LoongArch architecture. Signed-off-by: Hengqi Chen <hengqi.chen@gmail.com>
* libebl: Don't #include <dlfcn.h> in eblclosebackend.c and eblopenbackend.cYonggang Luo2022-10-273-2/+5
| | | | | | | It's not accessed symbols in dlfcn.h in eblclosebackend.c and eblopenbackend.c Signed-off-by: Yonggang Luo <luoyonggang@gmail.com>
* Move the #include <libintl.h> into eu-config.hYonggang Luo2022-10-161-1/+0
| | | | | | | | | | So we do not need include in each file. And indeed the macro #define _(Str) dgettext ("elfutils", Str) access libintl function dgettext, so it's make more sense #include <libintl.h> in file eu-config.h Signed-off-by: Yonggang Luo <luoyonggang@gmail.com>
* libelf: Sync elf.h from glibcAndreas Schwab2022-08-082-1/+6
| | | | | | | | | | Adds PT_RISCV_ATTRIBUTES, SHT_RISCV_ATTRIBUTES, PT_AARCH64_MEMTAG_MTE, RELR definitions, LoongArch relocations. dwelf_elf_e_machine_string was updated to handle EM_LOONGARCH, and ebl_dynamic_tag_name was updated to handle the new RELR dynamic tags. Signed-off-by: Andreas Schwab <schwab@suse.de>
* Arm Ehdr flag printingUlrich Drepper2022-06-064-7/+21
| | | | | | | | | | | | | | | | | | Arm needs to decode flags and I modeled it after the binutils code. The same messages are printed. Given the requirement of the interface and the ABIs the current version of the callback function isn't sufficient unless one wants to create a stateful interface. The problem is that most flags need to be interpreted in the context of the ABI version. So I changed the API to also pass the original flag value. This shouldn't be a problem because there are no users yet. There is also a bug in ebl_machine_flag_name. When copying the string provided by the callback cp is moved past the NUL byte. It should move to the NUL byte. Otherwise one cannot anything but the first added flag description. Finally some cosmetic changes (space after each comma in the output). Signed-off-by: Mark Wielaard <mark@klomp.org>
* libebl: recognize FDO Packaging Metadata ELF noteLuca Boccassi2022-03-243-0/+12
| | | | | | | | | | | | | As defined on: https://systemd.io/COREDUMP_PACKAGE_METADATA/ this note will be used starting from Fedora 36. Allow readelf --notes to pretty print it: Note section [ 3] '.note.package' of 76 bytes at offset 0x2e8: Owner Data size Type FDO 57 FDO_PACKAGING_METADATA Packaging Metadata: {"type":"deb","name":"fsverity-utils","version":"1.3-1"} Signed-off-by: Luca Boccassi <luca.boccassi@microsoft.com>
* Remove redundant casts of memory allocating functions returning void *Dmitry V. Levin2021-09-092-1/+5
| | | | | | | Return values of functions returning "void *", e.g. calloc, malloc, realloc, xcalloc, xmalloc, and xrealloc, do not need explicit casts. Signed-off-by: Dmitry V. Levin <ldv@altlinux.org>
* Come up with startswith function.Martin Liska2021-05-123-4/+10
| | | | | | | New function in system.h that returns true if a string has a given prefix, false otherwise. Use it in place of strncmp. Signed-off-by: Martin Liška <mliska@suse.cz>
* Consistently define _(Str) using dgettext ("elfutils", Str)Dmitry V. Levin2020-12-162-5/+4
| | | | | | | | | | | | | | Move the definition of _(Str) macro to lib/eu-config.h which already provides a definition of N_(Str) macro. Since lib/eu-config.h is appended to config.h, it is included into every compilation unit and therefore both macros are now universally available. Remove all other definitions of N_(Str) and _(Str) macros from other files to avoid conflicts and redundancies. The next step is to replace all uses of gettext(Str) with _(Str). Signed-off-by: Dmitry V. Levin <ldv@altlinux.org>
* libebl: consistently use _(Str) instead of gettext(Str)Dmitry V. Levin2020-12-1612-24/+38
| | | | | | | | | | | | libeblP.h defines _(Str) to dgettext ("elfutils", Str) instead of a simple gettext (Str) for a reason: the library might be indirectly used by clients that called bindtextdomain with a domain different from "elfutils". The change was made automatically using the following command: $ git grep -l '\<gettext *(' libebl |xargs sed -i 's/\<gettext *(/_(/g' Signed-off-by: Dmitry V. Levin <ldv@altlinux.org>
* Fix spelling typos in NEWS, NOTES, TODO, and in comments of configure.acDmitry V. Levin2020-12-121-1/+1
| | | | | | | | | | | | | | | | | | | accidently -> accidentally approriate -> appropriate depencies -> dependencies endianess -> endianness funtions -> functions indeces -> indices indentified -> identified ist -> is mutliple -> multiple nessesary -> necessary optimze -> optimize severly -> severely suport -> support tranformation -> transformation Signed-off-by: Dmitry V. Levin <ldv@altlinux.org>
* backends: Remove tilegx backend.Mark Wielaard2020-10-262-2/+6
| | | | | | | | Support for the Tilera TILE-Gx processor has been removed or deprecated in gcc and binutils already. There are no users and there is no way to test it. Signed-off-by: Mark Wielaard <mark@klomp.org>
* libebl: Remove unused ebl_syscall_abi.Mark Wielaard2020-10-266-70/+10
| | | | | | | | | 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>
* libebl: Handle aarch64 bti, pac bits in gnu property noteMark Wielaard2020-09-072-0/+72
| | | | | | | | | | | When building with gcc -mbranch-protection= we might get a gnu property note indicating BTI (Branch Target Identification) and/or PAC (Pointer Authentication Code) is being used. Add a small testcase to show eu-readelf -n now properly lists those bits in the gnu property note. Signed-off-by: Mark Wielaard <mark@klomp.org>
* Only typedef Ebl once.Mark Wielaard2020-07-232-1/+7
| | | | | | | | | | | | | | | | 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>
* libebl: Remove Ebl struct size check and MODVERSION string.Mark Wielaard2020-06-103-19/+30
| | | | | | | | | | | | | | | | We used to do several sanity checks when the ebl backend libraries were loaded to make sure there was no version mismatch. When initializing the backend we passed the current Ebl struct size so the library could check it supported the given Ebl struct and we checked that the init method returned the correct build time module version string. Neither are necessary now that the backends are builtin. Remove both the struct size check and the MODVERSION string (which wasn't actually checked anymore). Make the init function return the given Ebl handle or NULL on error (no init function currently indicates any error). Signed-off-by: Mark Wielaard <mark@klomp.org>
* libelf: Sync elf.h from glibc.Mark Wielaard2020-06-042-4/+5
| | | | | | | There is now finally a PT_GNU_PROPERTY define. Also EM_ARC_COMPACT2 got renamed to EM_ARCV2. Signed-off-by: Mark Wielaard <mark@klomp.org>
* libdw, readelf: Handle GCC LTO .gnu.debuglto_ prefix.Mark Wielaard2020-04-222-1/+8
| | | | | | | | | GCC puts (partial) DWARF debuginfo into sections prefixed with .gnu.debuglto_. Handle those sections as if they are normal .debug sections (which they are). This allows showing the DWARF that gcc puts into ET_REL files compiled with -flto. Signed-off-by: Mark Wielaard <mark@klomp.org>
* readelf, elflint: Handle PT_GNU_PROPERTY.Mark Wielaard2020-02-182-0/+11
| | | | | | | | | binutils 2.32 ld emits a new PT_GNU_PROPERTY segment that overlaps with the PT_NOTE segment covering the .note.gnu.property section data. https://sourceware.org/bugzilla/show_bug.cgi?id=25511 Signed-off-by: Mark Wielaard <mark@klomp.org>
* libebl: Don't install libebl.a, libebl.h and remove backends from spec.Mark Wielaard2019-09-102-5/+7
| | | | | | | | All archive members from libebl.a are now in libdw.a. We don't generate separate backend shared libraries anymore. So remove them from the elfutils.spec file. Signed-off-by: Mark Wielaard <mark@klomp.org>
* Don't use dlopen() for libebl modulesOmar Sandoval2019-08-296-177/+111
| | | | | | | | | | | | 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>
* Add PIC and non-PIC variants of libcpu and libeblOmar Sandoval2019-08-282-2/+10
| | | | | | | | | Currently, libcpu and libebl are always compiled as PIC. An upcoming change will add the objects from libcpu.a and libebl.a to libdw.a, which should not be PIC unless configured that way. So, make libcpu.a and libebl.a non-PIC and add libcpu_pic.a and libebl_pic.a. Signed-off-by: Omar Sandoval <osandov@fb.com>
* libebl: remove unnecessary variable in Makefile.amOmar Sandoval2019-08-282-20/+23
| | | | | | | gen_SOURCES is assigned to libebl_a_SOURCES and never used again. Get rid of it. Signed-off-by: Omar Sandoval <osandov@fb.com>
* Add backend support for C-SKYMao Han2019-07-172-0/+5
| | | | | | | | | C-SKY V2 ABI manual: https://github.com/c-sky/csky-doc/blob/master/C-SKY_V2_CPU_Applications_Binary_Interface_Standards_Manual.pdf C-SKY architecture user guide: https://github.com/c-sky/csky-doc/blob/master/CSKY%20Architecture%20user_guide.pdf Signed-off-by: Mao Han <han_mao@c-sky.com>
* libdwelf: Add dwelf_elf_e_machine_string and use it in readelf.Mark Wielaard2019-07-103-6/+6
| | | | | | | | | | | | | | | | To print eh human readable description of the ELF e_machine header field we used the ebl name. But this is not set for most EM constants. Introduce a new function dwelf_elf_e_machine_string that does work for all known EM values. Use that in eu-readelf to print a string representation of the e_machine value. Since this was the only usage of ebl->name, remove that from struct ebl. Also add a testcase that makes sure dwelf_elf_e_machine_string works for all EM values in the libelf/elf.h header so we will immediately notice when a new value appears. Signed-off-by: Mark Wielaard <mark@klomp.org>
* libebl: Try harder to find backend library in bin and lib origin paths.Mark Wielaard2019-05-302-47/+78
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | eblopenbackend tries to find libraries based on the $ORIGIN/../$LIB/ path. But depending on whether the system is multilib or multiarch this doesn't always work. On multilib systems $LIB is always just one directory deep (it is either .../lib or .../lib64) but on multiarch systems it can be multiple directories deep (.../lib/x86_64-linux-gnu). This means that on multiarch systems $ORIGIN/../$LIB only works for binaries (where origin is .../bin/), but not for libraries. Most of the time it still works because of RPATH which is tried afterwards. But RPATH processing does not always work reliable. So try multiple paths first. The first time using the $ORIGIN as if it came from an executable (in bin/) and then using the $ORIGIN as if it came from an library (in lib[64]/ or lib/<arch>/). So first time using ../$LIB and second time just with the elfutils EBL_SUBDIR. The first is what we do now and always work on multilib systems. The second try works when loading relative to a library whether on a multilib or multiarch system. Then we use the same fallback (not using any path) we used already (to take advantage of any RPATH or LD_LIBRARY_PATH setting). https://sourceware.org/bugzilla/show_bug.cgi?id=24488 Signed-off-by: Mark Wielaard <mark@klomp.org>
* libebl: Check ebl is not NULL in ebl_symbol_[binding|type]_name.Mark Wielaard2019-04-283-0/+9
| | | | | | | For STB_GNU_UNIQUE and STT_GNU_IFUNC we need to check the elf of the given ebl. Make sure the ebl given isn't NULL. Signed-off-by: Mark Wielaard <mark@klomp.org>
* libebl: Check GNU property note data padding fits inside note.Mark Wielaard2019-01-302-8/+14
| | | | | | | | | The GNU property note data is padded. Make sure the extra padding still fits in the note description. https://sourceware.org/bugzilla/show_bug.cgi?id=24075 Signed-off-by: Mark Wielaard <mark@klomp.org>
* libebl: Check NT_PLATFORM core notes contain a zero terminated string.Mark Wielaard2019-01-163-21/+27
| | | | | | | | | | 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>
* libebl: Check GNU property note pr_datasz fits inside note description.Mark Wielaard2019-01-162-0/+11
| | | | | | | | | Before printing the data values, make sure pr_datasz doesn't go beyond the end of the note description data. https://sourceware.org/bugzilla/show_bug.cgi?id=24075 Signed-off-by: Mark Wielaard <mark@klomp.org>
* libebl: Fix reading GNU_PROPERTY_STACK_SIZE reading from 32bit notes.Mark Wielaard2018-12-032-5/+20
| | | | | | | | | | | When reading a GNU_PROPERTY_STACK_SIZE we need to use the proper data type. GElf_Addr is 64bit always and when reading a 32bit size part of it would not be initialized. Use either Elf32_Addr or Elf64_Addr to read and print the data. Add 32bit and 64bit, little and big endian testcases. Signed-off-by: Mark Wielaard <mark@klomp.org>
* libebl: Don't update w, t and len unnecessarily in ebl_object_note_type_name.Mark Wielaard2018-11-152-5/+8
| | | | | | Harmless, but useless. Signed-off-by: Mark Wielaard <mark@klomp.org>
* Handle GNU Build Attribute ELF Notes.Mark Wielaard2018-11-134-4/+184
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-134-4/+27
| | | | | | | | 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>
* Recognize and parse GNU Property notes.Mark Wielaard2018-10-293-1/+191
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | GNU Property notes are different from normal notes because they use variable alignment/padding of their fields. They are 8 byte aligned, but use 4 byte fields. The name is aligned at 4 bytes and padded so that, the desc is aligned at 8 bytes. The whole note is padded to 8 bytes again. For normal notes all fields are both 4 bytes wide and 4 bytes aligned. To recognize these new kind of ELF Notes a new Elf_Type is introduced, ELF_T_NHDR8. This type is used in the xlate functions to determine how to align and pad the various fields. Since the fields themselves can now have different alignments we will have to keep track of the current alignement and use either NOTE_ALIGN4 or NOTE_ALIGN8 to determine the padding. To set the correct Elf_Type on the Elf_Data we use either the section sh_addralign or the segment p_align values. Assuming 8 means the section or segment contains the new style notes, otherwise normal notes. When we cannot determine the "alignment" directly, like when parsing special kernel sys files, we check the name "GNU" and type "GNU_PROPERTY_TYPE_0" fields. ebl_object_note now parses the new NT_GNU_PROPERTY_TYPE_0 and can extract the GNU_PROPERTY_STACK_SIZE, GNU_PROPERTY_NO_COPY_ON_PROTECTED and GNU_PROPERTY_X86_FEATURE_1_AND types GNU_PROPERTY_X86_FEATURE_1_IBT and GNU_PROPERTY_X86_FEATURE_1_SHSTK. Tests are added for extracting the note from sections or segments as set by gcc -fcf-protection. Signed-off-by: Mark Wielaard <mark@klomp.org>
* Handle ADD/SUB relocationsAndreas Schwab2018-10-135-7/+17
| | | | | | 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-133-3/+12
| | | | | | | | | | 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-135-6/+12
| | | | | | | | | | 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>
* Consolidate error.h inclusion in system.hRoss Burton2018-07-052-1/+4
| | | | | | | | | error.h isn't standard and so isn't part of the musl C library. To easy future porting, consolidate the inclusion of error.h into system.h. https://sourceware.org/bugzilla/show_bug.cgi?id=21008 Signed-off-by: Ross Burton <ross.burton@intel.com>
* libebl: Add new DWARF5 debug section names to default_debugscn_p.Mark Wielaard2018-05-062-0/+13
| | | | | | | | | | | | This adds the new DWARF5 debug section names .debug_addr, .debug_line_str, .debug_loclists, .debug_names, .debug_rnglists and .debug_str_offsets. This makes sure eu-strip knows to strip them away. Note that it doesn't add the .dwo variants, nor the .dwp only section names .debug_cu_index and .debug_tu_index, nor the .debug_sup section for supplemental DWARF files. Signed-off-by: Mark Wielaard <mark@klomp.org>
* Add support for RISC-VAndreas Schwab2018-04-232-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This implements initial support for the RISC-V architecture. It has been tested with qemu linux-user emulation <https://build.opensuse.org/package/live_build_log/openSUSE:Factory:RISCV/elfutils/standard/riscv64>, with the following unresolved issues FAIL: run-strip-strmerge.sh =========================== elflint /home/abuild/rpmbuild/BUILD/elfutils-0.170/tests/elfstrmerge section [32] '.symtab': _GLOBAL_OFFSET_TABLE_ symbol value 0x51c0 does not match .got section address 0x5010 section [32] '.symtab': symbol 119: st_value out of bounds FAIL run-strip-strmerge.sh (exit status: 1) FAIL: run-elflint-self.sh ========================= section [33] '.symtab': _GLOBAL_OFFSET_TABLE_ symbol value 0x6220 does not match .got section address 0x6008 section [33] '.symtab': symbol 135: st_value out of bounds *** failure in /home/abuild/rpmbuild/BUILD/elfutils-0.170/src/elflint --quiet --gnu-ld /home/abuild/rpmbuild/BUILD/elfutils-0.170/src/addr2line section [33] '.symtab': _GLOBAL_OFFSET_TABLE_ symbol value 0x91d8 does not match .got section address 0x9040 section [33] '.symtab': symbol 163: st_value out of bounds *** failure in /home/abuild/rpmbuild/BUILD/elfutils-0.170/src/elflint --quiet --gnu-ld /home/abuild/rpmbuild/BUILD/elfutils-0.170/src/elfcmp section [33] '.symtab': _GLOBAL_OFFSET_TABLE_ symbol value 0x1a2a0 does not match .got section address 0x1a040 section [33] '.symtab': symbol 267: st_value out of bounds *** failure in /home/abuild/rpmbuild/BUILD/elfutils-0.170/src/elflint --quiet --gnu-ld /home/abuild/rpmbuild/BUILD/elfutils-0.170/src/elflint section [33] '.symtab': _GLOBAL_OFFSET_TABLE_ symbol value 0xd418 does not match .got section address 0xd0f0 section [33] '.symtab': symbol 238: st_value out of bounds *** failure in /home/abuild/rpmbuild/BUILD/elfutils-0.170/src/elflint --quiet --gnu-ld /home/abuild/rpmbuild/BUILD/elfutils-0.170/src/nm section [33] '.symtab': _GLOBAL_OFFSET_TABLE_ symbol value 0xa2d0 does not match .got section address 0xa0b0 section [33] '.symtab': symbol 193: st_value out of bounds *** failure in /home/abuild/rpmbuild/BUILD/elfutils-0.170/src/elflint --quiet --gnu-ld /home/abuild/rpmbuild/BUILD/elfutils-0.170/src/objdump section [33] '.symtab': _GLOBAL_OFFSET_TABLE_ symbol value 0x2e5b8 does not match .got section address 0x2e058 section [33] '.symtab': symbol 410: st_value out of bounds *** failure in /home/abuild/rpmbuild/BUILD/elfutils-0.170/src/elflint --quiet --gnu-ld /home/abuild/rpmbuild/BUILD/elfutils-0.170/src/readelf section [32] '.symtab': _GLOBAL_OFFSET_TABLE_ symbol value 0x171b8 does not match .got section address 0x17010 *** failure in /home/abuild/rpmbuild/BUILD/elfutils-0.170/src/elflint --quiet --gnu-ld /home/abuild/rpmbuild/BUILD/elfutils-0.170/libelf/libelf.so section [32] '.symtab': _GLOBAL_OFFSET_TABLE_ symbol value 0x3a5b0 does not match .got section address 0x3a0d8 *** failure in /home/abuild/rpmbuild/BUILD/elfutils-0.170/src/elflint --quiet --gnu-ld /home/abuild/rpmbuild/BUILD/elfutils-0.170/libdw/libdw.so section [31] '.symtab': _GLOBAL_OFFSET_TABLE_ symbol value 0xd0c8 does not match .got section address 0xd008 *** failure in /home/abuild/rpmbuild/BUILD/elfutils-0.170/src/elflint --quiet --gnu-ld /home/abuild/rpmbuild/BUILD/elfutils-0.170/backends/libebl_i386.so section [31] '.symtab': _GLOBAL_OFFSET_TABLE_ symbol value 0xf0c8 does not match .got section address 0xf008 *** failure in /home/abuild/rpmbuild/BUILD/elfutils-0.170/src/elflint --quiet --gnu-ld /home/abuild/rpmbuild/BUILD/elfutils-0.170/backends/libebl_x86_64.so FAIL run-elflint-self.sh (exit status: 1) FAIL: run-native-test.sh ======================== /home/abuild/rpmbuild/BUILD/elfutils-0.170/tests/allregs: dwfl_module_register_names: no backend registers known FAIL run-native-test.sh (exit status: 1) FAIL: run-backtrace-native-core.sh ================================== backtrace: backtrace.c:111: callback_verify: Assertion `symname && strcmp (symname, "raise") == 0' failed. ./test-subr.sh: line 84: 26040 Aborted (core dumped) LD_LIBRARY_PATH="${built_library_path}${LD_LIBRARY_PATH:+:}$LD_LIBRARY_PATH" $VALGRIND_CMD "$@" backtrace-child-core.26027: no main rmdir: failed to remove 'test-26016': Directory not empty FAIL run-backtrace-native-core.sh (exit status: 1) In addition, all tests that use ptrace are failing as linux-user emulation does not implement it. There are no regressions for a x86_64 build. Signed-off-by: Andreas Schwab <schwab@suse.de>
* libebl: Handle SYMTAB_SHNDX in ebl_dynamic_tag_name.Mark Wielaard2018-03-162-1/+9
| | | | | | | | | | SYMTAB_SHNDX was introduced when elf.h was imported, but not yet handled in ebl_dynamic_tag_name. Handle it and add an eu_static_assert to make sure stdtags always contains DT_NUM entries. https://sourceware.org/bugzilla/show_bug.cgi?id=22976 Signed-off-by: Mark Wielaard <mark@klomp.org>
* libebl: Allow SHT_NOTE as relocation target type.Mark Wielaard2018-02-222-0/+6
| | | | | | | | | | | eu-elflint uses ebl_check_reloc_target_type to determine whether a section is a valid relocation target. In Fedora rawhide there are new ELF notes (annobin) which have relocations against them in ET_REL files. eu-elflint currently flags these as invalid. It looks like that is not correct. I cannot find any reason an SHT_NOTE section cannot have relocations against it. So this patch allows them. Signed-off-by: Mark Wielaard <mark@klomp.org>
* Use fallthrough attribute.Joshua Watt2018-02-102-1/+6
| | | | | | | | | | | | | | | Use __attribute__ ((fallthrough)) to indicate switch case fall through instead of a comment. This ensures that the fallthrough warning is not triggered even if the file is pre-processed (hence stripping the comments) before it is compiled. The actual fallback implementation is hidden behind a FALLBACK macro in case the compiler doesn't support it. Finally, the -Wimplict-fallthrough warning was upgraded to only allow the attribute to satisfy it; a comment alone is no longer sufficient. Signed-off-by: Joshua Watt <JPEWhacker@gmail.com>
* Check for -z,defs, -z,relro, -fPIC, -fPIE before using themUlf Hermann2017-08-182-1/+5
| | | | | | | | | | | | | | | | | | | | | | | | Those flags are not available on all platforms, and omitting them when not available will not cause any harm. In particular: -z,defs disallows undefined symbols in object files. This option is unsupported if the target binary format enforces the same condition already. Furthermore it is only a compile time sanity check. When it is omitted, the same binary is produced. -z,relro instructs the loader to mark sections read-only after loading the library, where possible. This is a hardening mechanism. If it is unavailable, the functionality of the code is not affected in any way. -fPIC instructs the compiler to produce position independent code. While this is preferable to relocatable code, relocatable code also works and may even be faster. Relocatable code might just be loaded into memory multiple times for different processes. -fPIE is the same thing as -fPIC for executables rather than shared libraries. Signed-off-by: Ulf Hermann <ulf.hermann@qt.io>
* ppc64: Add HTM SPRs support to readelfGustavo Romero2017-07-252-0/+5
| | | | | | | | | | 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 <gromero@linux.vnet.ibm.com>
* strip: Deal with ARM data marker symbols pointing to debug sections.Mark Wielaard2017-07-246-5/+75
| | | | | | | | | | | | | | | | | | | 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-022-3/+7
| | | | | | | | | | __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>
* Check for existence of mempcpyUlf Hermann2017-02-173-0/+7
| | | | | | If it doesn't exist, provide a definition based on memcpy. Signed-off-by: Ulf Hermann <ulf.hermann@qt.io>