Committed to FreeBSD as https://svnweb.freebsd.org/changeset/base/367809
Committed to FreeBSD in r366977 https://reviews.freebsd.org/rS366977
Committed to FreeBSD in r367209 https://reviews.freebsd.org/rS367209
FreeBSD patch is in review at https://reviews.freebsd.org/D23782
elfcopy: set ELF OS/ABI field when converting from binary
Sync RISC-V relocations
Further, I imagine that with SHF_COMPRESSED support in libelf we would just handle it transparently, and -z/--decompress would be a no-op.
Blog post on the support in Solaris libelf: https://blogs.oracle.com/solaris/elf_section_compression-v2
readelf: add RISC-V DWARF register aliases
readelf: add PowerPC VMX and VSX notes
readelf: hoist file opening out of dump_object
Do you have a possible API in mind?
readelf: add an XXX comment for cross-endian core file ELF notes
readelf: check note namesz and descsz
For the readelf the best approach is probably to teach libelf how to translate the ELF notes used by various operating sytems, @jkoshy do you agree?
First two are now fixed (2nd by [r3832]). The 3rd group (MIPS) are also related to ticket [#559]. I need to figure out what the right way to handle [r3766] is.
elfcopy: copy raw (untranslated) contents to binary output
And this first issue is already fixed by [r3158]
Yes, I pasted the wrong rev; FreeBSD r273443 correctly identified the issue but the commit was incorrect; I reverted it and applied the correct fix in https://reviews.freebsd.org/rS275430
readelf: add FreeBSD PROTMAX_DISABLE and STKGAP_DISABLE
It seems I had this unsubmitted in a forgotten browser tab, from shortly after [r3766] was committed (i.e., just after 2019-06-29). It's possible that there have been changes that affect these issues or introduce new ones since.
Our demangler(s) have a great number of issues; a couple of hours of fuzzing with afl turned up several hundred crashes/aborts. american fuzzy lop 2.52b (c++filt) ┌─ process timing ─────────────────────────────────────┬─ overall results ─────┐ │ run time : 0 days, 1 hrs, 43 min, 28 sec │ cycles done : 2 │ │ last new path : 0 days, 0 hrs, 0 min, 25 sec │ total paths : 3333 │ │ last uniq crash : 0 days, 0 hrs, 1 min, 57 sec │ uniq crashes : 425 │ │ last uniq hang : 0 days, 0 hrs, 56 min, 7 sec │ uniq...
As mark points out the benefit from merging within .shstrtab is likely small, generally a handful of .rel or .rela sections. The real benefit would come from merging .shstrtab and .strtab but there are a limited number of cases where it's possible to do so.
ELF Tool Chain endianness issues
elfcopy test suite failures
Fixed with two commits referenced above; ticket [#582] open to track restoring suffix merging.
Consider implementing strtab suffix merging in libelftc
Early source control systems used to have problems with binary objects - this might be why the test inputs are stored uuencoded. I'm not sure why shar is required. We could perhaps check with @kaiwang27 and simplify the test harness. Ok, sounds good. Both parts of Mark's change are now committed in [r3827] and [r3828].
elfcopy: Regenerate output files for failing test cases.
https://github.com/emaste/elftoolchain/pull/10
Ah, I had the diff backwards it seems, [r3827] contains the fix for the \0\0.
elfcopy: Avoid emitting an extra empty string in .shstrtab.
Checked with Mark and we believe is actually a bug fixed by r3757. Diffoscope results from Mark: 2020-02-27 14:03:25 W: diffoscope.main: Fuzzy-matching is currently disabled as the "tlsh" module is unavailable. --- ./sym.o.1 +++ ../out/sym.o.1 ├── readelf --wide --sections {} │ @@ -3,12 +3,12 @@ │ Section Headers: │ [Nr] Name Type Addr Off Size ES Flg Lk Inf Al │ [ 0] NULL 00000000 000000 000000 00 0 0 0 │ [ 1] .text PROGBITS 00000000 000040 00003a 00 AX 0 0 16 │ [ 2] .data PROGBITS 00000000 00007c...
Case-insensitivity breaks GETATTR on cached filehandle
readelf: Add support for RISC-V specific e_flags
No point in adding more FreeBSD branches until ticket 575 is addressed.
CI: use bmake on Ubuntu
We're also using sys/tree.h for addr2line, thread at https://sourceforge.net/p/elftoolchain/mailman/message/36923333/
INSTALL: List Ubuntu 18.04 in supported OS table
CI: add Ubuntu 18.04 task
Finally committed to FreeBSD, will be upstreamed soon. Author: emaste Date: Wed Feb 12 21:52:10 UTC 2020 New revision: 357844 URL: https://svnweb.freebsd.org/changeset/base/357844
Reportedly fixed by https://reviews.freebsd.org/D23501
Discussed with markj (who does not have a SourceForge account AFAIK) and he will take a look.
Anything else still needed here?
Indeed, CI is now red due to #575 https://cirrus-ci.com/task/4873950589091840
git bisect reports 01aa270c34f05f5bb0c080d4e5a2bd92294251eb is the first bad commit commit 01aa270c34f05f5bb0c080d4e5a2bd92294251eb Author: emaste <emaste@95820547-d848-0410-985e-9ae8fe0fa350> Date: Fri Jun 28 01:15:28 2019 +0000 elfcopy: Use libelftc's string table routines to build .shstrtab. This replaces some hand-rolled routines and is substantially faster since libelftc uses a hash table for lookups and insertions, whereas elfcopy would perform a linear scan of the table. Obtained from FreeBSD...
Case-insensitivity breaks GETATTR on cached filehandle
Case-insensitivity breaks GETATTR on cached filehandle
Cirrus-CI: run tests on FreeBSD 11 and 12
Cirrus-CI: run tests on FreeBSD
top-level `make run-tests` target does not indicate pass/fail
python 2 is EOL, we need to migrate ELF Tool Chain to use python 3
Another alternative is LLVM's test infrastructure. I find it to be very developer-friendly.
INSTALL: update FreeBSD reference to 11.3
Example Cirrus-CI run https://cirrus-ci.com/task/5643634364121088 make run-tests does not return error if any tests fail, unfortunately
Appears all tests pass for me on FreeBSD, example Cirrus-CI run https://cirrus-ci.com/task/5643634364121088
Oh, I didn't see that @lwhsu submitted a patch with this ticket, I just added 12.1 to the existing 11.2.
In my local tree, result at https://cirrus-ci.com/task/4671894406299648
It seems tests are not connected to CI yet, I will do that ASAP so that we don't end up with another case of this in the future. In the git mirror [r3780] is bce9ba83a8e3cccdd183672848091f978b863aa0, we can git bisct between that rev and the last known good version (presumably the last release)
replace strncpy with memcpy when copying full string
readelf: Don't leak memory when dwarf_get_fde_info_for_all_regs() fails.
readelf: Fix a double close of the input file.
size: Avoid returning a stack pointer from xlatetom().
elfcopy: Avoid leaking dst's fd when we fail to copy a file.
elfcopy: Handle multiple data descriptors properly.
libelftc: Add a missing check for an error from vector_str_init().
libelftc: Fix memory leaks in the C++ demanglers.
libdwarf: Fix a memory leak in _dwarf_frame_section_init().
libdwarf: Make an out-pointer of _dwarf_abbrev_add() mandatory.
libdwarf: Fix a possible memory leak in dwarf_add_AT_location_expr().
libdwarf: Remove unnecessary NULL checks.
Cirrus-CI: temporarily comment out Debian task
elfcopy: Clear errors after fetching the shstrtab index.
Add FreeBSD note types missed in r3766
Add DF_1 flags missed in r3765
readelf: display NT_GNU_PROPERTY_TYPE_0 note name
Tests failing on FreeBSD
Copied here to keep details in one place: I also noticed that when elf_update recomputes the section layout, it leaves the section offset of SHT_NOBITS and SHT_NULL sections alone while the others are updated. elfutils sets the offset of the section based on the ending of the previous section. Does this offset have any meaning, or is it just arbitrary? Either way, maybe it makes sense to set it to the end of the previous section to avoid inheriting the value from the original section layout.
See FreeBSD commit: elfcopy: fix little-endian MIPS64 objects https://reviews.freebsd.org/D15734 https://reviews.freebsd.org/rS344855 https://reviews.freebsd.org/rS339083 https://reviews.freebsd.org/rS339473
readelf: decode FreeBSD note types
readelf: decode flag bits in DT_FLAGS/DT_FLAGS_1
libelf: add config for RISC-V ISA
libelf: assert that msz is non-zero
elfdump: add OpenBSD ELF program header types
readelf: print description for 'e_flags' in ELF header (ABI type)
readelf: report byte size for DT_PREINIT_ARRAYSZ
readelf: dump ELF note data
elfcopy: Provide a size hint when creating the section string table.
elfcopy: Use libelftc's string table routines to build .shstrtab.
elfcopy: Use elf_getscn() instead of iterating over all sections
elfcopy: Optimize for insertions at the end of the section list
elfcopy: Pass the right sizes to malloc() and realloc()
readelf: Make -t imply -S, for compatibility with GNU binutils
libelftc: add RISC-V bfd targets
libelftc: readelf: decode R_MIPS_HIGHER and R_MIPS_HIGHEST relocation types
libelftc: Fix some minor style bugs
libdwarf: add DW_LANG_* definitions from DWARF 4 and 5
libdwarf: Use the cached strtab pointer when reading string attributes.
libelftc: Micro-optimize string table insertion