summaryrefslogtreecommitdiffstats
path: root/tests
Commit message (Collapse)AuthorAgeFilesLines
* Split the "selfcontained" configure option in twoHEADQtCreator4.15.1QtCreator4.15.0-rc1QtCreator4.15.0-beta2QtCreator4.15.0-beta1QtCreator4.15.0QtCreator4.14.2QtCreator4.14.1QtCreator4.14.0-rc1QtCreator4.14.0-beta2QtCreator4.14.0-beta1QtCreator4.14.0QtCreator4.13.3QtCreator4.13.2QtCreator4.13.1QtCreator4.13.0-rc1QtCreator4.13.0-beta2QtCreator4.13.0-beta1QtCreator4.13.0QtCreator4.12.4QtCreator4.12.3QtCreator4.12.2QtCreator4.12.1QtCreator4.12.0-rc1QtCreator4.12.0-beta2QtCreator4.12.0-beta1QtCreator4.12.0QtCreator4.11.2QtCreator4.11.0-rc1QtCreator4.11.0-beta2QtCreator4.11.0-beta1QtCreator4.11.0master5.04.154.144.134.124.1112.011.010.0Ulf Hermann2019-08-261-6/+4
| | | | | | | | upstream is growing an option to install elf.h. We want to use that. Change-Id: Ica5bf0cdf281eb17ef29e0e1029662a5a9d875b1 Reviewed-by: Christian Kandeler <[email protected]> Reviewed-by: Ulf Hermann <[email protected]>
* Skip run-readelf-compressed.sh test if built without bzip2Ulf Hermann2019-01-091-0/+5
| | | | | | | | Obviously, we cannot read the compressed ELF file if no bzip2 support is present. Change-Id: Ia85efce5e546b184adb015de42d1a6ec63154e96 Reviewed-by: Christian Kandeler <[email protected]>
* Merge tag 'elfutils-0.175'Ulf Hermann2019-01-0919-18/+864
|\ | | | | | | | | | | elfutils 0.175 release Change-Id: I409f41767af349d0521351dd733879ad31c65aab
| * strip: Also handle gnu compressed debug sections with --reloc-debug-sectionsMark Wielaard2018-11-132-0/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | Check whether a section was gnu compressed and decompress it first before trying to resolve relocations. Recompress it afterwards. This found a bug in elf_compress_gnu which would use the "raw" file contents even if the user had just created the section (copying over the section from the original input file). Add compressed ET_REL tests to run-strip-reloc.sh testcase. Signed-off-by: Mark Wielaard <[email protected]>
| * Handle GNU Build Attribute ELF Notes.Mark Wielaard2018-11-132-0/+59
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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 <[email protected]>
| * Recognize NT_VERSION notes.Mark Wielaard2018-11-132-1/+23
| | | | | | | | | | | | | | | | 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 <[email protected]>
| * libcpu: Recognize bpf jump variants BPF_JLT, BPF_JLE, BPF_JSLT and BPF_JSLEMark Wielaard2018-11-092-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Linux kernel 4.13 introduced 4 more jump class variants. commit 92b31a9af73b3a3fc801899335d6c47966351830 Author: Daniel Borkmann <[email protected]> Date: Thu Aug 10 01:39:55 2017 +0200 bpf: add BPF_J{LT,LE,SLT,SLE} instructions For conditional jumping on unsigned and signed < and <= between a register and another register or immediate. Add these new constants to bpf.h, recognize them in bpf_disasm and update the testfile-bpf-dis1.expect file. Signed-off-by: Mark Wielaard <[email protected]>
| * libdwelf: New function dwelf_elf_begin.Mark Wielaard2018-11-093-0/+42
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This introduces a new function dwelf_elf_begin which creates a (read-only) ELF handle from a possibly compressed file handle or a file that start with a linux kernel header. This can be used in eu-readelf to (re)open a (pure) ELF. eu-readelf uses libdwfl to relocate addresses in the original file in case it is ET_REL. But to show the "raw" data it might need to (re)open the file. Which could fail if the file was compressed. And produced an obscure error message: "cannot create EBL handle". This rewrites __libdw_open_file a little so that the given file handle will never be closed (whether on success or failure) and introduces a new internal function __libdw_open_elf that dwelf_elf_begin wraps. Signed-off-by: Mark Wielaard <[email protected]>
| * libelf: Explicitly update section data after (de)compression.Mark Wielaard2018-11-097-1/+124
| | | | | | | | | | | | | | | | | | | | | | | | | | | | We need to explictly trigger a section data reload after updating the ELF section rawdata to make sure it gets written out to disk on an elf_update. Doing this showed one bug/inefficiently when the underlying file has a different endianness. In that case for debug sections we would convert by allocating a new buffer and just copying over the raw data into a new buffer. This is not really necessary and would hide any relocations done on the rawdata by libdwfl. Added a couple of new ppc64 big endian testfiles that show the issue. Signed-off-by: Mark Wielaard <[email protected]>
| * strip: Add --reloc-debug-sections-only option.Mark Wielaard2018-11-062-0/+15
| | | | | | | | | | | | | | | | | | | | | | This option does the same thing as --reloc-debug-sections without doing any other strip operation. This is useful when you want to remove the debug section relocations in a separate ET_REL debug file that was created without --reloc-debug-sections, or for a file (like the linux debug vmlinux) that you don't want to strip, but for which the debug section relocations can be resolved already. Signed-off-by: Mark Wielaard <[email protected]>
| * Recognize and parse GNU Property notes.Mark Wielaard2018-10-295-0/+67
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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 <[email protected]>
| * readelf: Handle multiple .debug_macro sections and decode header flag.Mark Wielaard2018-10-195-3/+448
| | | | | | | | | | | | | | | | | | | | | | | | | | In object files there could be multiple .debug_macro sections. These are COMDAT sections used as imports. Note that the output for DW_MACRO_import isn't ideal since the offset is printed against the start of the .debug_macro section, but it doesn't show which one. We currently don't have that information and no interface yet for libdw users. Also decode the macro header flag byte for convenience. Signed-off-by: Mark Wielaard <[email protected]>
| * strip, unstrip: Handle SHT_GROUP correctly.Mark Wielaard2018-10-174-0/+40
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The usage of annobin in Fedora showed a couple of bugs when using eu-strip and eu-unstrip on ET_REL files that contain multiple group sections. When stripping we should not remove the SHF_GROUP flag from sections even if the group section itself might be removed. Either the section itself gets removed, and so the flag doesn't matter. Or it gets moved together with the group section into the debug file, and then it still needs to have the flag set. Also we would "renumber" the section group flag field (which isn't a section index, and so shouldn't be changed). Often the group sections have the exact same name (".group"), flags (none) and sometimes the same sizes. Which makes matching them hard. Extract the group signature and compare those when comparing two group sections. Signed-off-by: Mark Wielaard <[email protected]>
| * tests: backtrace-dwarf.c improve error handling in test framework.Mark Wielaard2018-09-212-14/+31
| | | | | | | | | | | | | | | | To debug https://sourceware.org/bugzilla/show_bug.cgi?id=23673 clean up the test framework so we know what exactly failed. Suggested-by: Dmitry V. Levin <[email protected]> Signed-off-by: Mark Wielaard <[email protected]>
* | Merge tag 'elfutils-0.174'Ulf Hermann2018-10-1151-42/+1302
|\| | | | | | | | | | | elfutils 0.174 release Change-Id: Ibcbdfca61cf0b65391ab6d0ad00f18ba61027e07
| * strip,unstrip: Use and set shdrstrndx consistently.Mark Wielaard2018-09-143-2/+74
| | | | | | | | | | | | | | | | | | | | | | In various places in strip we used e_shstrndx instead of shdrstrndx and we didn't setup the shdrstrndx for the debug file. In unstrip we forgot to copy the shdrstrndx in case the -o output option was used. Added a new testcase that adds many sections to a testfile and runs strip, elflint, unstrip and elfcmp. Signed-off-by: Mark Wielaard <[email protected]>
| * libdw: dwarf_begin_elf should use elf_getshdrstrndx to get section names.Mark Wielaard2018-09-143-2/+41
| | | | | | | | | | | | | | | | | | | | | | dwarf_begin_elf used the Ehdr e_shstrndx to get the shdr string table section. This does not work for ELF files with more than SHN_LORESERVE sections. Use elf_getshdrstrndx, and don't pass around the ehdr. Add a simple testcase that fails before the patch because dwarf_begin return an error. Signed-off-by: Mark Wielaard <[email protected]>
| * libelf: Fix shnum and section zero handling.Mark Wielaard2018-09-133-2/+107
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | For ELF files with more than SHN_LOWRESERVE sections we always need section zero to store the section number (it doesn't just fit in the Ehdr e_shnum field). Make sure to create it if it doesn't exist yet in elf_getscn. Also fix handling on shnum in updatefile for the mmap case (we already got this correct for the non-mmap case). This adds a new test run-copymany-sections.sh which is like run-copyadd-sections.sh but tries to add two times 65535 sections. It makes sure libelf can copy the whole file and elfcmp checks they are the same. It doesn't use mmap for addsections since that doesn't work yet. ELF_C_RDWR_MMAP needs mremap which will fail since it needs too much space and the original mmap cannot move. Signed-off-by: Mark Wielaard <[email protected]>
| * libelf: Fix some issues with ELF_C_RDWR_MMAP.Mark Wielaard2018-09-135-3/+678
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When ELF_C_RDWR_MMAP is used libelf might have to write overlapping memory when moving the section data or headers. Make sure to use memmove, not memcpy. Also the size of the underlying file might have to change. That means we will have to also extend the mmap region with mremap. Since we are using direct pointers into the mmapped area we cannot move the mmap, only extend it. This might still fail if there is not enough free memory available to extend the mmap region. Two new test programs have been added. elfcopy which copies a whole elf file (using either ELF_C_WRITE or ELF_C_WRITE_MMAP). And addsections which adds new sections to an existing ELF file (using either ELF_C_RDWR or ELF_C_RDWR_MMAP). The newly added test will fail under valgrind without the fixes. Signed-off-by: Mark Wielaard <[email protected]>
| * tests: Add section attribute to defeat -freorder-blocks-and-partition.Mark Wielaard2018-09-112-0/+5
| | | | | | | | | | | | | | | | GCC could partition main into an cold and hot block causing our symbol lookup to fail in the backtrace-dwarf testcase. Add a section attribute on "main" so that it will be kept together. Signed-off-by: Mark Wielaard <[email protected]>
| * unstrip: Also check sh_size in compare_unalloc_sections.Mark Wielaard2018-07-274-0/+62
| | | | | | | | | | | | | | | | | | | | | | | | compare_unalloc_sections only checked sh_flags and the section names. This would cause stripped/debug section mismatches when there were multiple sections with the same name and flags. Fix this by also checking the size of the section matches. Add a testcase that has two ".group" sections created on i386 with the gcc annobin plugin. Signed-off-by: Mark Wielaard <[email protected]>
| * unstrip: Handle SHT_GROUP sections in ET_REL files.Mark Wielaard2018-07-274-1/+78
| | | | | | | | | | | | | | | | | | SHT_GROUP sections are put in both the stripped and debug file. Handle correcting the symbol table/name entry of the group only once. The testfile was generated with the gcc annobin plugin. Signed-off-by: Mark Wielaard <[email protected]>
| * tests: Add core and strip tests for RISC-VAndreas Schwab2018-07-198-1/+162
| | | | | | | | Signed-off-by: Andreas Schwab <[email protected]>
| * Remove previous test files before running the next roundUlf Hermann2018-07-172-0/+7
| | | | | | | | | | | | | | | | | | | | | | strip explicitly creates the new files. This will not work on windows if the files already exist. Also, if strip fails to create the files for any reason, we would check the previous run's files and succeed. However, the test should fail then. Signed-off-by: Ulf Hermann <[email protected]>
| * tests: Update hello_riscv64.ko test file with debuginfo.Mark Wielaard2018-07-173-1/+8
| | | | | | | | | | | | | | | | Also document CONFIG_DEBUG_INFO=y. Updated test file provided by Andreas Schwab <[email protected]>. Signed-off-by: Mark Wielaard <[email protected]>
| * tests: Handle compressed sections in next_cfi testcase.Mark Wielaard2018-07-102-4/+30
| | | | | | | | | | | | | | | | | | | | Some toolchains use compressed ELF sections by default. This would make run-next-cfi-self.sh fail because it would try to decode the compressed data. Fix by decompressing the section first. https://sourceware.org/bugzilla/show_bug.cgi?id=23370 Signed-off-by: Mark Wielaard <[email protected]>
| * Consolidate error.h inclusion in system.hRoss Burton2018-07-0535-34/+66
| | | | | | | | | | | | | | | | | | 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 <[email protected]>
* | Remove bogus white space in test-subr.shUlf Hermann2018-07-241-2/+2
| | | | | | | | | | | | | | mingw should have complained about this, too ... Change-Id: I03940ba6e93ef04c51418cc507cccf47453d10fa Reviewed-by: Christian Kandeler <[email protected]>
* | Deal with newer libdl on windows requiring psapi.dllUlf Hermann2018-07-231-17/+23
| | | | | | | | | | | | | | We want to link libdl statically, so we need to link psapi ourselves. Change-Id: I001bda009c58cfb39bba0733436f883bbf501b80 Reviewed-by: Christian Kandeler <[email protected]>
* | Ignore trailing CR in readelf-variant testUlf Hermann2018-07-231-1/+1
| | | | | | | | | | Change-Id: Ie9cf00b2e00b84ab736aaefc805a1cacfc9ae408 Reviewed-by: Christian Kandeler <[email protected]>
* | On PE platforms, use PATH instead of LD_LIBRARY_PATHUlf Hermann2018-07-233-8/+40
| | | | | | | | | | | | | | | | | | The windows linker looks for .dll files in PATH. LD_LIBRARY_PATH doesn't work. This reduces the amount of headache to be suffered when running the test suite. Change-Id: I94e73af46bf4a7b185158067db86a9c16f3690dd Reviewed-by: Christian Kandeler <[email protected]>
* | Don't match line endings with grep in linkmap-cut testUlf Hermann2018-07-231-2/+2
| | | | | | | | | | | | | | | | I don't think we can accidentally match these strings in any other place and the line ending matches are brittle. Change-Id: I880e23a89c56851b17e50d804ed949761c9c1955 Reviewed-by: Christian Kandeler <[email protected]>
* | Don't match line ending when using grep to search for error messageUlf Hermann2018-07-231-1/+1
| | | | | | | | | | | | | | | | | | | | We are relying on the version of grep being used to recognize the platform specific line endings. In principle it should, but the reality turns out to be ... complicated. This message is unique enough to not require the additional qualification of "at end of line". Change-Id: I8241b023e759c9b57e050b07995cad0683c4bf35 Reviewed-by: Christian Kandeler <[email protected]>
* | Remove files before regenerating them in run-strip-g testUlf Hermann2018-07-201-0/+2
| | | | | | | | | | | | | | On windows, strip cannot overwrite files. Change-Id: I2cf1384b18daec71f079238cf274bce08bdc209b Reviewed-by: Christian Kandeler <[email protected]>
* | Refine self-test detectionUlf Hermann2018-07-206-48/+56
| | | | | | | | | | | | | | | | There are some convenient new methods for selftests that we can hook into to avoid repeating the same check in every test. Change-Id: Ie12e1f90f86f3bd3f0590fef4fe0157f4bc0f59c Reviewed-by: Christian Kandeler <[email protected]>
* | Add O_BINARY to new open() callsUlf Hermann2018-07-2010-11/+11
| | | | | | | | | | | | | | Windows needs that if you're not reading text. Change-Id: I923782f2c47ef16765f52d6a435f69cb33f50dfd Reviewed-by: Christian Kandeler <[email protected]>
* | tests: Update hello_riscv64.ko test file with debuginfo.Ulf Hermann2018-07-183-1/+8
| | | | | | | | | | | | | | | | | | Also document CONFIG_DEBUG_INFO=y. Updated test file provided by Andreas Schwab <[email protected]>. Change-Id: I1bf3deaf1ec0883f345b232bc4ceb56601f5bf79 Reviewed-by: Christian Kandeler <[email protected]>
* | Merge tag 'elfutils-0.173'Ulf Hermann2018-07-13103-375/+7906
|\| | | | | | | | | | | elfutils 0.173 release Change-Id: I83dc56dd15c26fe7acf4ce73c29df65b8b65e757
| * libdw: Recognize zero terminator to end frame table in dwarf_next_cfi.Mark Wielaard2018-06-295-3/+275
| | | | | | | | | | | | | | | | | | | | | | | | | | When the length is zero this is a the zero terminator that ends the frame table. Return 1 (end of table) instead of -1 (error) in that case. We cannot update next_off and don't want to caller to try again. Add testcase for dwarf_next_cfi to show both .eh_frame and .debug_frame tables and check consistency (FDEs should point to existing CIEs). Also add a self check to make sure we can read the table from the just build elfutils binaries. Signed-off-by: Mark Wielaard <[email protected]>
| * libdw: Allow .debug_frame only Dwarf.Mark Wielaard2018-06-2910-1/+332
| | | | | | | | | | | | | | | | | | .debug_frame is useful independent from the other .debug sections. Add a simplified variant of the addrcfi testcase dwarfcfi. dwarfcfi only uses dwarf_frame calls and no dwfl helpers. Signed-off-by: Mark Wielaard <[email protected]>
| * tests: Limit varlocs print_expr_block recursion depth.Mark Wielaard2018-06-292-13/+24
| | | | | | | | | | | | | | | | This is only useful for bad DWARF where an expression block might have an expression that refers to a DIE that contains the expression block itself. But that might happen with bad DWARF generated by a fuzzer. Signed-off-by: Mark Wielaard <[email protected]>
| * libdw: Add dwarf_next_lines to read .debug_line tables without CUs.Mark Wielaard2018-06-297-1/+538
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | It is sometimes useful to read .debug_line tables on their own without having an associated CU DIE. DWARF5 line tables are self-contained. Adjust dwarf_begin_elf to accept ELF files with just a .debug_line. Add a new function dwarf_next_lines that returns the Dwarf_Files and Dwarf_Lines while iterating over just the .debug_lines section. Since we parse and cache the information it also will try to match the CU a table is associated with. This is only necessary for DWARF4 line tables (we will need at least the compilation dir from the CU) and won't be done for DWARF5 line tables. It also isn't an error if there is no associated CU (but will mean for DWARF4 line tables the dir list and the file paths might not be complete). A typical way to call this new function is: Dwarf_Off off, next_off = 0; Dwarf_CU *cu = NULL; Dwarf_Files *files; size_t nfiles; Dwarf_Lines *lines; size_t nlines; int res; while ((res = dwarf_next_lines (dbg, off = next_off, &next_off, &cu, &files, &nfiles, &lines, &nlines)) == 0) { /* ... handle files and lines ... */ } if (res < 0) printf ("BAD dwarf_next_lines: %s\n", dwarf_errmsg (-1)); See libdw.h for the full documentation. For more examples on how to use the function see the new testcases next-files and next-lines. Also adjust the file paths for line tables missing a comp_dir. They are no longer made "absolute" by prepending a slash '/' in front of them. This really was not useful and didn't happen in any of the testcases. They are now just kept relative. Make eu-readelf --debug-dump=decodedline use dwarf_next_lines instead of iterating over the CUs to show the (decoded) line tables. This allows it to show decoded line tables even if there is no .debug_info section. New tests have been added that mimic the get-files and get-lines tests but use dwarf_next_lines instead of iterating over all CUs. They produce identical output (modulo the CU information). Also add a new test file that contains only a .debug_line section. Signed-off-by: Mark Wielaard <[email protected]>
| * backends,bpf: add proper relocation supportYonghong Song2018-06-215-1/+46
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Due to libdw does not have proper BPF relocation support, the pahole cannot display filenames correctly for objects with default llvm options. So we have to invent a special option "llc -march=bpf -mattr=dwarfris" to prevent llvm from generating cross-section dwarf relocation records (https://reviews.llvm.org/rL326505). The pahole related discussion is in linux netdev mailing list (http://lists.openwall.net/netdev/2018/06/15/38, etc.) We would like to add proper BPF relocation support to libdw so eventually we could retire the special llc bpf flag "-mattr=dwarfris". The bpf relocations are defined in llvm_repo:include/llvm/BinaryFormat/ELFRelocs/BPF.def: ELF_RELOC(R_BPF_NONE, 0) ELF_RELOC(R_BPF_64_64, 1) ELF_RELOC(R_BPF_64_32, 10) Removed the relocation type R_BPF_MAP_FD whoes name does not confirm to llvm definition and replaced it with R_BPF_64_64. The BPF object is just a relocatible object, not an executable or a shared library, so assign ELF type to REL only in bpf_reloc.def. Signed-off-by: Yonghong Song <[email protected]>
| * readelf: Handle signedness of DW_FORM_implicit_const and DW_AT_const_value.Mark Wielaard2018-06-155-1/+242
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We only handles DW_FORM_sdata as a signed form, but DW_FORM_implicit_const is also signed by default. For DW_AT_const_value we can do a little better. GCC encodes some const_values with signed forms, even though the type is unsigned. Lookup the (base) type of the DIE and display the const value as their (signed) type/size (if we can determine that). Add a new testcase run-readelf-const-values.sh that shows that. With the new testcase the const values would come out as follows: name (string) "i" const_value (implicit_const) 18446744073709551615 name (string) "j" const_value (implicit_const) 18446744073709551615 name (string) "sc" const_value (sdata) -2 name (string) "uc" const_value (sdata) -2 name (string) "ss" const_value (sdata) -16 name (string) "us" const_value (sdata) -16 name (string) "si" const_value (sdata) -3 name (string) "ui" const_value (sdata) -94967296 name (string) "sl" const_value (sdata) -1 name (string) "ul" const_value (sdata) -1 With this patch they show up as: name (string) "i" const_value (implicit_const) -1 name (string) "j" const_value (implicit_const) -1 name (string) "sc" const_value (sdata) -2 name (string) "uc" const_value (sdata) 254 (-2) name (string) "ss" const_value (sdata) -16 name (string) "us" const_value (sdata) 65520 (-16) name (string) "si" const_value (sdata) -3 name (string) "ui" const_value (sdata) 4200000000 (-94967296) name (string) "sl" const_value (sdata) -1 name (string) "ul" const_value (sdata) 18446744073709551615 (-1) (for signed/unsigned int char, short and long) Signed-off-by: Mark Wielaard <[email protected]>
| * tests: Don't assert on bad DW_OP_GNU_parameter_ref target in varlocs.Mark Wielaard2018-06-112-1/+7
| | | | | | | | | | | | | | | | If the target of a DW_OP_GNU_parameter_ref isn't a DW_TAG_formal_parameter that is bad data (which varlocs should error on). But it isn't an internal consistency check (for which varlocs should assert). Signed-off-by: Mark Wielaard <[email protected]>
| * libdw: Check validity of dwarf_getabbrev arguments.Mark Wielaard2018-06-113-0/+19
| | | | | | | | | | | | | | When the given Dwarf_Die was invalid we might crash and when the offset was totally bogus we might succeed with a random abbrev. Signed-off-by: Mark Wielaard <[email protected]>
| * tests: Fix cfi_debug_bias assert in varlocs.Mark Wielaard2018-06-102-1/+7
| | | | | | | | | | | | | | | | It is only a consistency issue if we actually have an cfi_debug and the cfi_debug_bias is not zero (because they come from the same file as the other debug data). Signed-off-by: Mark Wielaard <[email protected]>
| * readelf: Turn format_print_dwarf into print_dwarf_addr.Mark Wielaard2018-06-092-26/+30
| | | | | | | | | | | | | | | | | | | | | | We don't really need to setup a buffer, print into it and then print it out to stdout. Simplify the code by directly printing the address (and symbol name). This also showed a small error in the output of DW_LLE_startx_length. It had two unintended trailing dots. Signed-off-by: Mark Wielaard <[email protected]>
| * tests: Use error, not assert, when trying to print a non-base type DIE.Mark Wielaard2018-06-082-1/+7
| | | | | | | | | | | | | | | | | | When using the varlocs test with a fuzzer using assert for internal sanity checks is great to find issues. But when encountering bad data using an assert is wrong. Just use error to show we handle the data correctly (by reporting it is bad, instead of crashing). Signed-off-by: Mark Wielaard <[email protected]>
| * tests: Drop shared libraries from self_test_files_exe.Mark Wielaard2018-06-022-7/+8
| | | | | | | | | | | | | | | | | | Commit 00d89086 "tests: Split self_test_files into an exe, lib and obj list" accidentially left the shared libraries in the self_test_files_exe. Causing all shared libraries to be tested twice. Drop them and keep just four ET_EXE files: addr2line, elfcmp, objdump and readelf. Signed-off-by: Mark Wielaard <[email protected]>