summaryrefslogtreecommitdiffstats
path: root/contrib/elftoolchain
Commit message (Collapse)AuthorAgeFilesLines
* Update to ELF Tool Chain r3477emaste2016-05-251-11/+9
| | | | | | | | | | | | | This fixes a EFI/PE header issue that prevented elfcopy-produced .efi files from working with Secure Boot: Make sure section raw size is always padded to multiple of FileAlignment from the optional header, as requested by the PE specification. This change should reduce the diff between PE image generated by Binutils objcopy and elftoolchain elfcopy. Submitted by: kaiw Reported by: ambrisko
* Add relocation support for RISC-V.br2016-05-252-0/+9
| | | | | | | Reviewed by: emaste Sponsored by: DARPA, AFRL Sponsored by: HEIF5 Differential Revision: https://reviews.freebsd.org/D6559
* elftoolchain: backwards compatability for ELFOSABI_CLOUDABI definitionemaste2016-05-213-0/+13
| | | | | | | It is not provided by sys/elf_common.h on older releases or -current before March 2015. Reported by: Jenkins
* elftoolchain: backwards compatability for EM_RISCV definitionemaste2016-05-203-0/+9
| | | | | | It is not provided by sys/elf_common.h on older releases Reported by: Jenkins
* elftoolchain: backwards compatability for EM_IAMCU definitionemaste2016-05-204-0/+18
| | | | It is not provided by sys/elf_common.h on older stable/10.
* Update to ELF Tool Chain r3475emaste2016-05-2034-1238/+1288
| | | | | | | | | | | | | | | | | | | | | Improvements include: * Add support for reporting and handling a number of new constants in various tools, including: * CloudABI OSABI * DT_TLSDESC_* * i386, MIPS, SPARC and amd64 relocations * C++ demangler bug fixes * Man page updates * Improved input validation in several tools This update also reduces diffs against upstream as a number of fixes included in upstream were previously cherry-picked into FreeBSD. Sponsored by: The FreeBSD Foundation
* elfcopy: map all !alnum characters to '_' in binary input symbol namesemaste2016-04-201-3/+4
| | | | | | | This matches bfd and gold. Obtained from: ELF Tool Chain r3445 Sponsored by: The FreeBSD Foundation
* elfcopy: fix symbol table handling when sections come after symtab/strtabemaste2016-04-151-2/+15
| | | | | | | | | | | | | | | | Fix a symbol table handling bug in elfcopy: elfcopy puts .symtab, .strtab and .shstrtab sections in the end of the output object. If the input objects have more sections after any of these 3 sections, the section table will be reordered, and in that case the section symbols should be regenerated for relocations. The bug is triggered since newer clang puts .strtab section in the beginning of the object produced. Ticket: #525 Reported by: royger Obtained from: ELF Tool Chain r3443
* elfcopy: overhaul of LMA handlingemaste2016-03-242-89/+184
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Merge ELF Tool Chain r3434: Previously, elfcopy defines: VMA: section virtual address LMA: PHDR(p_vaddr) While binutils(libbfd) defines: VMA: section virtual address and PHDR(p_vaddr). LMA: PHDR(p_paddr) For elfcopy, p_paddr is considered not meaningful and is always set to the same value as p_vaddr. elfcopy was implemented that way because I thought p_paddr is not used/meaningful according to the ELF ABI. However it turned out p_paddr is at least used in some ELF files, e.g. the FreeBSD kernel. This change made elfcopy treat p_paddr as LMA, same as libbfd. (However, some VMA/LMA related command line option still need tweaking to make them compatible with binutils objcopy. This will be improved later) Ticket: #524 And typo fixes in r3435 and r3436. This fixes the Xen kernel build. Submitted by: kaiw Tested by: royger
* libelf: correct byte count in cross-endian note translationemaste2016-03-111-0/+1
| | | | | MFC after: 1 month Sponsored by: The FreeBSD Foundation
* libdwarf: fix SHT_REL relocation processingemaste2016-03-111-3/+12
| | | | | | | Relocation of type SHT_REL must use the current value as addend. PR: 204084 Obtained from: NetBSD libdwarf_elf_init.c v1.4
* elfcopy: fail if debug link target is emptyemaste2016-03-041-0/+3
| | | | | | | | | | | | | An empty debug link target previously returned a confusing and incorrect error like "objcopy: fread failed: No error: 0". Now, return an explicit error. GNU objcopy allows an empty file as the debug link target. However, that case is nonsensical so diverging from GNU behaviour is fine. Reviewed by: bdrewery Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D5541
* Allow elfcopy to convert between two non-ELF formatsemaste2016-02-161-0/+12
| | | | | | | | | | | | If the output object is not an ELF file, choose an arbitrary ELF format for the intermediate file. srec, ihex and binary formats are independent of class, endianness and machine type so these choices do not affect the output. ELF Tool Chain ticket #517 Reviewed by: kai Obtained from: ELF Tool Chain r3411
* Update ELF Tool Chain to upstream rev 3400emaste2016-02-1265-873/+4894
| | | | | | | | | | | | | | | | | | | | | | | | | Some notable improvements include: readelf: - Add AArch64 relocation definitions. - Report value of unknown relocation types. elfcopy: - Consider symbols with STB_GNU_UNIQUE binding as global symbols. - Fixed support for VMA adjustment for loadable sections found in relocatable objects. - Handle nameless global symbols. - Improve wildcard matching for !-prefixed symbols. - Add PE/COFF support. elfdump: - Improve section type reporting. - Add MIPS-specific section types. This update also includes a significant number of bug fixes. PR: 207091 [exp-run] Sponsored by: The FreeBSD Foundation
* readelf: decode AArch64 TLS descriptor relocationsemaste2016-02-051-0/+10
| | | | | | | From ELF for the ARM(R) 64-bit Architecture, table 4-19. Obtained from: ELF Tool Chain r3386 Sponsored by: The FreeBSD Foundation
* readelf: report value of unknown relocation typesemaste2016-02-051-12/+14
| | | | | Obtained from: ELF Tool Chain r3387 Sponsored by: The FreeBSD Foundation
* readelf: avoid accidental fallthrough in RISC-V relocationsemaste2016-02-051-0/+1
| | | | | | | | | This would have printed an unknown RISC-V relocation type as a SPARC relocation. CID: 1331398 Obtained from: ELF Tool Chain r3283 Sponsored by: The FreeBSD Foundation
* Add config for RISC-V ISA.br2016-01-241-0/+6
| | | | | | | Reviewed by: emaste Sponsored by: DARPA, AFRL Sponsored by: HEIF5 Differential Revision: https://reviews.freebsd.org/D5046
* Fixed uninitialized variable warnings.kaiw2015-12-131-2/+2
|
* Update to ELF Tool Chain r3272emaste2015-12-1110-180/+484
| | | | | | | | | | | Highlights (not already in the FreeBSD tree): - addr2line: Speed up and support searching inlined functions - addr2line: Support -i, -a, -p options - readelf: Add some ARM relocation types - readelf, libelf: Avoid reading beyond end of buffer/file Relnotes: Yes Sponsored by: The FreeBSD Foundation
* elfcopy: include extension but replace . when converting from binaryemaste2015-12-111-12/+8
| | | | | | | | | | | The change in r291958 was not consistent with GNU objcopy. The start, end and size symbols created for ELF objects converted from binary need to include the full filename including the extension, but with the periods replaced with underscores. Reviewed by: imp Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D4474
* elfcopy: exclude extension when converting from binaryemaste2015-12-071-1/+12
| | | | | | | | | | | When converting from binary to ELF, elfcopy creates symbols _binary_<filename>_start_, _binary_<filename>_end, and _binary_<filename>_size. For compatibility with GNU objcopy (and to produce sensible symbol names) the extension must be stripped off. Reviewed by: imp Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D4238
* readelf: add Xen ELF notesemaste2015-12-031-0/+29
| | | | | | Reviewed by: kib Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D4356
* Add missing commasemaste2015-10-121-13/+13
| | | | | Pointy hat to: kan Obtained from: ELF Tool Chain r3253
* Add definitions for MIPS TLS relocations to elftoolchain.kan2015-10-092-19/+46
| | | | | This makes our readelf more useful when looking for TLS-related issues.
* addr2line: initialize die to NULLemaste2015-10-091-0/+1
| | | | | | | | GCC on MIPS produced a 'may be used uninitialized' warning after r289071. Reported by: sbruno Pointy hat to: emaste
* Update to ELF Tool Chain r3250emaste2015-10-0913-99/+311
| | | | | | | | | Highlights (not already in the FreeBSD tree): - addr2line: Fixed multiple memory leaks related to DIE allocation - readelf: improve sh_link validation - various man page improvements Sponsored by: The FreeBSD Foundation
* Rename ELFOSABI_SYSV to ELFOSABI_NONE to match current specemaste2015-09-242-2/+2
| | | | | | | | Source: http://www.sco.com/developers/gabi/latest/ch4.eheader.html Reviewed by: kib Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D3731
* readelf: Correct typo HPUS -> HPUXemaste2015-09-241-1/+1
| | | | Submitted by: kib
* addr2line: skip CUs lacking debug info instead of bailing outemaste2015-09-221-1/+7
| | | | | | | | | | | | Some binaries (such as the FreeBSD kernel) contain a mixture of CUs with and without debug information. Previously translate() exited upon encountering a CU without debug information. Instead, just move on to the next CU. Reported by: royger Reviewed by: royger Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D3712
* Add ELF Tool Chain's brandelf(1) to contribemaste2015-07-313-0/+471
| | | | Noticed by pfg after r286070 (ar and elfdump)
* Add ELF Tool Chain's ar(1) and elfdump(1) to contribemaste2015-07-3016-0/+6788
| | | | | | ELF Tool Chain built on FreeBSD's ar and elfdump, but has a number of improvements and enhancements. Bring them into contrib in order to start integrating into our build.
* readelf: avoid division by zero on section entry sizeemaste2015-07-241-15/+47
| | | | | | | | | | | ELF Tool Chain tickets #439, #444, #445, #467 Reported by: Alexander Cherepanov <cherepan@mccme.ru> (#467) Reported by: antiAgainst (others) Reviewed by: brooks MFC after: 1 month Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D2338
* Add RISC-V ELF machine type definitionemaste2015-07-242-1/+3
| | | | | | | EM_RISCV is now officially registered as e_machine 243. MFC after: 1 month Sponsored by: The FreeBSD Foundation
* Fix endless recursion in dwarf_get_section_max_offsets(), found by clangdim2015-06-231-2/+2
| | | | | | 3.7.0. Reviewed by: emaste
* elfcopy: Handle objects without a ".shstrtab" section string tableemaste2015-06-131-0/+8
| | | | | | | | | | | | As of LLVM revision 238073, LLVM stores symbols and section names in the same string table. From the upstream commit mesage: With the scheme of naming sections like ".text.foo" where foo is a symbol, there is a big potential saving in using a single one. This is a cherry-pick of ELF Tool Chain revision 3225. Sponsored by: The FreeBSD Foundation
* Update to ELF Tool Chain r3223emaste2015-05-2711-73/+687
| | | | | | | | | | | | | | | | | | | | | | Highlights (upstream revisions): - Fix SHT_GROUP handling in elfcopy/strip (3206 3220 3221) - Misc elfcopy / strip bug fixes (3215 3216 3217) - Many C++ demangler improvements (3199 3200 3201 3202 3203 3204 3205 3208 3210 3211 3212) - Improve GNU binutils compatibility in elfcopy / strip (3213 3214) - Add -g option to readelf(1): dump contents of section groups (3219) - Add EM_IAMCU 32-bit Intel MCU (3198) Also add a compat #define for building with older FreeBSD ELF headers. The GRP_COMDAT flag was added to elf_common.h in r283110, but it's not available during the bootstrap build. It is also convenient to be able to build on older hosts. Thanks to antoine@ for tracking down issues through multiple exp-runs and to kaiw@ for fixing. PR: 198611 (exp-run), 200350 Sponsored by: The FreeBSD Foundation
* Update to ELF Tool Chain r3197emaste2015-05-1440-98/+161
| | | | | | | | | | Highlights: - Fix man page markup, whitespace, and typos - Fix sh_info of SHT_GROUP section to point to the correct string - Improve validation in readelf and elfcopy/strip - Handle DWARF 4's DW_AT_high_pc in addr2line Sponsored by: The FreeBSD Foundation
* Update elftoolchain to upstream revision 3179emaste2015-04-0178-240/+255
| | | | | | | | | | | | | Some notable changes: - libdwarf: Fixed DWARF4 line section - elfcopy: Implement --localize-hidden - nm: handle object name referenced by DW_AT_specification - elfcopy: Add --strip-dwo and --extract-dwo options for split DWARF - readelf: add remaining arm64 dynamic relocation names - nm: Avoid integer overflow in value comparison Relnotes: Yes Sponsored by: The FreeBSD Foundation
* nm: avoid crash in print_lineno if func->name is NULLemaste2015-02-251-1/+2
| | | | | | | | | | | | | | | | | This can occur when DW_AT_specification is used to refer to another DIE that provides the actual DW_AT_name string. For example: < 3><0x00000086> DW_TAG_subprogram DW_AT_name PrettyStackTraceEntry ... < 1><0x00002cf4> DW_TAG_subprogram DW_AT_specification <0x00000086> We will need to add support for DW_AT_specification, but in the interim we should not segfault. Obtained from: Elftoolchain (r3170) Sponsored by: The FreeBSD Foundation
* Update elftoolchain to upstream revision 3163emaste2015-02-1726-40/+83
| | | | | | | Most of our changes have now been committed upstream, so this change is largely bookkeeping. Sponsored by: The FreeBSD Foundation
* libdwarf: Handle .rel relocationsemaste2015-02-125-33/+50
| | | | | | | | | | | | | Some architectures use .rel relocations (for debug data), so they must be handled. This was discovered from ctfconvert on ARM object files. The lack of relocation handling caused all string lookups to return the string at offset 0 in .debug_str, typically "FreeBSD clang version ..." Reviewed by: gnn, imp, rpaulo (earlier version) Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D1819
* libdwarf: Add symbol value when processing .rela relocationsemaste2015-02-111-2/+6
| | | | | | Reviewed by: kib, rpaulo Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D1826
* libdwarf: Add aarch64 relocation supportemaste2015-02-112-0/+9
| | | | | | Reviewed by: andrew, rpaulo Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D1817
* Preserve hard & symbolic links when modifying source fileemaste2015-01-281-21/+33
| | | | | | | | | | | Strip is often used to modify existing files, rather than creating new files. If the existing file has hard links or is a symbolic link, act as if editing the file in place and preserve the links. Reported by: luigi Reviewed by: imp, rpaulo Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D1682
* redelf: Add missing R_X86_64_ relocation typesemaste2015-01-212-1/+21
| | | | | | | PR: 196918 Reviewed by: dim Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D1570
* Verify that section header offset is not past EOFemaste2015-01-161-1/+2
| | | | | MFC After: 1 week Sponsored by: The FreeBSD Foundation
* elfcopy: Avoid divide-by-0 on section alignment 0emaste2015-01-141-0/+2
| | | | | | | | According to ELF ABI, alignment 0 and 1 has the same meaning: the section has no alignment constraints. PR: 196715 Sponsored by: The FreeBSD Foundation
* libdwarf: add missing breakemaste2015-01-131-0/+1
| | | | | | | Reported by: Coverity CID: 1193315 MFC after: 1 week Sponsored by: The FreeBSD Foundation
* nm: Accept long option --extern-only for -gemaste2015-01-082-3/+8
| | | | Submitted by: jkim
OpenPOWER on IntegriCloud