History log of /freebsd-11-stable/lib/libelf/
Revision Date Author Comments
(<<< Hide modified files)
(Show modified files >>>)
367466 07-Nov-2020 dim

Sync up elftoolchain with head, except for the capsicum-related commits,
which are incompatible with stable/11.

MFC r308465 (by emaste):

c++filt: flush output after newline

Some tools spawn c++filt and pass it a single line at a time for
demangling. This is akin to r276689 for addr2line.

Sponsored by: The FreeBSD Foundation

MFC r317626 (by emaste):

revert r308465: c++filt: flush output after newline

The ELF Tool Chain update to r3520 uses setvbuf to set line buffering.

Sponsored by: The FreeBSD Foundation

MFC r340746 (by oshogbo):

strings: fix style nits

Reviewed by: cem, emaste, Joseph Koshy <jkoshy@users.sourceforge.net>
Differential Revision: https://reviews.freebsd.org/D18036

MFC r340750 (by mjg):

strings: unbreak the build after r340746

Discussed with: oshogbo
Sponsored by: The FreeBSD Foundation

MFC r342918 (by emaste):

Update to ELF Tool Chain r3668

Highlights:
- Make sure that only TLS sections are sorted into TLS segment.
- Fixed multiple errors in "Section to Segment mapping".
- Man page updates
- ar improvements
- elfcopy: avoid filter_reloc uninitialized variable for rela
- elfcopy: avoid stripping relocations from static binaries
- readelf: avoid printing directory in front of absolute path
- readelf: add NT_FREEBSD_FEATURE_CTL FreeBSD note type
- test improvements

NOTES:

Some of these changes originated in FreeBSD and simply reduce diffs
between contrib and vendor.

ELF Tool Chain ar is not (currently) used in FreeBSD, and there are
improvements in both FreeBSD and ELF Tool Chain ar that are not in
the other.

Sponsored by: The FreeBSD Foundation

MFC r343592 (by emaste):

readelf: decode flag bits in DT_FLAGS/DT_FLAGS_1

Decode d_val when the tag is DT_FLAGS or DT_FLAGS_1 based on the
information at:

https://docs.oracle.com/cd/E23824_01/html/819-0690/chapter6-42444.html

PR: 232983
Submitted by: Bora Ozarslan borako.ozarslan@gmail.com
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D18784

MFC r343593 (by emaste):

readelf: fix i386 build

Use %jx and (uintmax_t) cast.

PR: 232983
Sponsored by: The FreeBSD Foundation

MFC r343614 (by emaste):

readelf: dump elf note data

Output format is compatible with GNU readelf's handling of unknown note
types (modulo a GNU char signedness bug); future changes will add type-
specific decoding.

Reviewed by: kib
Relnotes: Yes
Sponsored by: The FreeBSD Foundation

MFC r343665 (by emaste):

readelf: use table-based DT_FLAGS and DT_FLAGS_1 decoding

Fewer lines of code and more maintainable.

Reviewed by: brooks, kib
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D19053

MFC r343669 (by emaste):

readelf: decode FreeBSD note types

Decode NT_FREEBSD_ABI_TAG, NT_FREEBSD_ARCH_TAG, and NT_FREEBSD_FEATURE_CTL.

Reviewed by: brooks, kib (earlier)
Relnotes: Yes
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D19054

MFC r345360 (by oshogbo):

strings: do not depend on stdin

Instead of depending on one stdin FILE structure and use freopen(3), pass to
the functions appropriate FILE structure.

Reviewed by: cem
Discussed with: emaste
Differential Revision: https://reviews.freebsd.org/D18037

MFC r345361 (by oshogbo):

strings: do not continue if getc or getcharacter returns EOF

Reported by: cem

MFC r345362 (by oshogbo):

Fix powerpc and arm builds after r345361.

Reported by: jenkins

MFC r345364 (by oshogbo):

In case of ENCODING_8BIT the EOF code will be pass to putchar.
EOF check should be done before (uint8_t)c > 127 test.

Reported by: cem

MFC r345431 (by oshogbo):

strings: return an error code and the char value separately

If we returning 32 bits value it's hard to distinguish if the returned value
is a valid one or if its an error (in case of EOF). For that reason separate
exit code of the function from the returned character.

Reported by: cem, se

MFC r345593 (by markj):

Prepend DW_AT_comp_dir to relative line number directory table entries.

Relative directories may appear in the line number program for a CPU if
files were included via a relative path, for instance with "-I.".
Previously, dwarf_srclines(3) and dwarf_srcfiles(3) would return the
relative path, so addr2line, for instance, would do the same. However,
we can get an absolute path by prepending the compilation directory, so
change libdwarf to do that to improve compatibility with GNU binutils
and since it is more useful in general.

Reviewed by: jhb
Discussed with: emaste
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D19705

MFC r345646 (by emaste):

readelf: add newline after dumping dynamic FLAGS / FLAGS_1

All three dump_flags() callers need a newline after printing the flags.

Sponsored by: The FreeBSD Foundation

MFC r346323 (by emaste):

readelf: speed up readelf -wo

Use an array instead of STAILQ, and sort at the end instead of while
adding new elements.

PR: 212539
Submitted by: Bora ?zarslan <borako.ozarslan@gmail.com>
Reviewed by: markj
Sponsored by: The FreeBSD Foundation

MFC r346327 (by emaste):

readelf: use size_t for object counts

PR: 212539
Reported by: cem
Sponsored by: The FreeBSD Foundation

MFC r348347 (by jhibbits):

Add missing powerpc64 relocation support to libdwarf

Summary:
Due to missing relocation support in libdwarf for powerpc64, handling of dwarf
info on unlinked objects was bogus.

Examining raw dwarf data on objects compiled on ppc64 with a modern compiler
(in-tree gcc tends to hide the issue, since it only rarely generates relocations
in .debug_info and uses DW_FORM_str instead of DW_FORM_strp for everything), you
will find that the dwarf data appears corrupt, with repeated references to the
compiler version where things like types and function names should appear.

This happens because the 0 offset of .debug_str contains the compiler version,
and without applying the relocations, *all* indirect strings in .dwarf_info will
end up pointing to it.

This corruption then propogates to the CTF data, as ctfconvert relies on
libdwarf to read the dwarf info, for every compiled object (when building a
kernel.)

However, if you examine the dwarf data on a compiled executable, it will appear
correct, because during final link the relocations get applied and baked in by
the linker.

Submitted by: Brandon Bergren
Reviewed By: emaste
Differential Revision: https://reviews.freebsd.org/D20367

MFC r348430 (by markj):

elfcopy: Remove an unneeded memset.

Reviewed by: emaste, trasz
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D20445

MFC r348431 (by markj):

elfcopy: Optimize for insertions at the end of the section list.

This is the common case when strip(1) is creating the output file.
The change provides a significant speedup when running on ELF files with
many sections.

PR: 234949
Reviewed by: emaste
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D20444

MFC r348443 (by markj):

readelf: Make -t imply -S, for compatibility with GNU binutils.

Reported by: jhb
Reviewed by: emaste
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D20475

MFC r348444 (by markj):

libelftc: Add MLINKS.

Reviewed by: emaste
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D20474

MFC r348652 (by markj):

libelf: Use a red-black tree to manage the section list.

The tree is indexed by section number. This speeds up elf_getscn()
and its callers, which previously had to traverse a linked list. In
particular, since .shstrtab is often the last section in a file,
elf_strptr() would have to traverse the entire list.

PR: 234949
Reviewed by: emaste
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D20443

MFC r348654 (by markj):

elfcopy: Use elf_getscn() instead of iterating over all sections.

When removing a section, we would loop over all sections looking for
a corresponding relocation section. With r348652 it is much faster
to just use elf_getscn().

PR: 234949
Reviewed by: emaste
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D20471

MFC r348655 (by markj):

libelftc: Fix some minor style bugs.

Reviewed by: emaste
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D20472

MFC r348657 (by markj):

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.

PR: 234949
Reviewed by: emaste
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D20473

MFC r348776 (by csjp):

Teach readelf about some OpenBSD ELF program headers

- Add constants for OpenBSD wxneeded, bootdata and randomize to the
FreeBSD elf_common.h file. This is the file that gets used by the
elftoolchain library.
- Update readelf and elfdump utilities to decode these program headers
if they are encountered.

Note: FreeBSD has it's own version of elfdump(1), which will be updated
in a subsequent commit. I am adding it here anyway because this diff is
going to be submitted upstream.

Discussed with: emaste
Reviewed by: imp
Differential Revision: https://reviews.freebsd.org/D20548

MFC r349420 (by markj):

libelftc: Micro-optimize string table insertion.

The string's length is already known, so use memcpy() instead of
strcpy() to add it to the string table image.

Reviewed by: emaste
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D20760

MFC r349421 (by markj):

libelftc: Consistently use size_t for string table offsets and sizes.

Reviewed by: emaste
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D20702

MFC r349422 (by markj):

libelftc: Fix the documented prototype for elftc_string_table_destroy().

Sponsored by: The FreeBSD Foundation

MFC r349423 (by markj):

elfcopy: Provide a size hint when creating the section string table.

Use the input file's .shstrtab size as the hint if it exists. This
gives a small performance improvement when processing files with
many sections.

Reviewed by: emaste
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D20544

MFC r349424 (by markj):

libdwarf: Use the cached strtab pointer when reading string attributes.

Previously we would perform a linear search of the DWARF section
list for ".debug_str". However, libdwarf always caches a pointer to
the strtab image in its debug descriptor. Using it gives a modest
performance improvement when iterating over the attributes of each
DIE.

Reviewed by: emaste
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D20759

MFC r349481 (by mhorne):

Add some missing RISC-V ELF defines

This adds defines for the RISC-V specific e_flags values, and some of
the missing static relocations.

Reviewed by: markj
Approved by: markj (mentor)
Differential Revision: https://reviews.freebsd.org/D20766

MFC r349482 (by mhorne):

readelf: Add support for RISC-V specific e_flags

Reviewed by: markj
Approved by: markj (mentor)
Differential Revision: https://reviews.freebsd.org/D20767

MFC r349483 (by mhorne):

libelftc: add RISC-V bfd targets

This adds the following targets: elf32-riscv, elf64-riscv, elf64-riscv-freebsd

Reviewed by: emaste, markj, jkoshy@users.sourceforge.net
Approved by: markj (mentor)
Differential Revision: https://reviews.freebsd.org/D20768

MFC r349510 (by luporl):

[PowerPC64] readelf: print description for 'e_flags' in ELF header (ABI type)

This prints out description text with the meaning of 'Flags' value in PowerPC64.

Example:

$ readelf -h ~/tmp/t1-Flag2
ELF Header:

Magic: 7f 45 4c 46 02 02 01 09 00 00 00 00 00 00 00 00
Class: ELF64
Data: 2's complement, big endian
Version: 1 (current)
OS/ABI: FreeBSD
ABI Version: 0
Type: EXEC (Executable file)
Machine: PowerPC 64-bit
Version: 0x1
Entry point address: 0x10010000
Start of program headers: 64 (bytes into file)
Start of section headers: 209368 (bytes into file)
Flags: 0x2, OpenPOWER ELF V2 ABI
Size of this header: 64 (bytes)
Size of program headers: 56 (bytes)
Number of program headers: 10
Size of section headers: 64 (bytes)
Number of section headers: 34
Section header string table index: 31

Submitted by: alfredo.junior_eldorado.org.br
Reviewed by: luporl
Differential Revision: https://reviews.freebsd.org/D20782

MFC r349562 (by mhorne):

elftoolchain: fix an incorrect e_flags description

r349482 introduced the definitions and descriptions of the RISC-V
specific e_flags values to elftoolchain. However, the description for
the EF_RISCV_RVE flag was incorrectly duplicated from EF_RISCV_RVC. Fix
this by providing the proper description for this flag.

Reported by: jhb
Approved by: markj (mentor)

MFC r349563 (by mhorne):

readelf: Add RISC-V DWARF register aliases

This allows DWARF debugging output to use the common register
mneumonics, such as ra, sp, or t0.

DWARF registers 0-31 are mapped to the 32 general purpose registers,
which are then followed by the 32 floating point registers.

Reviewed by: markj
Approved by: markj (mentor)
Differential Revision: https://reviews.freebsd.org/D20779

MFC r349577 (by arichardson):

Allow bootstrapping elftoolchain on MacOS and Linux

This is required in order to build on non-FreeBSD systems without setting
all the XAR/XSTRINGS/etc. variables

Reviewed By: emaste
Differential Revision: https://reviews.freebsd.org/D16771

MFC r349730 (by markj):

elfcopy: Clear errors after fetching the shstrtab index.

Otherwise a future call to elf_errno() will return a non-zero value.
update_shdr(), for example, treats any errors associated with the ELF
descriptor as fatal. Clear the error per the first example in
elf_errmsg.3.

Convert to elf_getshdrstrndx() while here since elf_getshstrndx() is
apparently deprecated.

Reported by: royger
Reviewed by: emaste
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D20852

MFC r350432 (by markj):

Merge r3778 and r3779 from ELFToolchain.

Modify strip(1) to not accept multiple input files when an output
file is specified. There is no good way to handle this combination,
and the change is compatible with binutils.

Sponsored by: The FreeBSD Foundation

MFC r350511 (by emaste):

readelf: decode NT_GNU_PROPERTY_TYPE_0 / GNU_PROPERTY_X86_FEATURE_1_AND

These bits are used for Intel CET IBT/Shadow Stack.

Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D20516

MFC r350679 (by markj):

Merge r3780 from elftoolchain.

Adjust argc and argv by optind before using them. This slightly
simplifies the code. No functional change intended.

Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D21079

MFC r352875 (by ray):

ections into expected offset in binary format.
Calculate binary file offset using address field, bacause software know only offset to known data, not where to load segment.
With that patch, kernel .data section can have any alignment/offset - kernel boor fine.

PR: 235391
Reviewed by: markj
Differential Revision: D21827

MFC r352878 (by ray):

Initialize baseaddr to suppres warning.

Pointy hat to: ray

MFC r352908 (by markj):

nm: Adjust argc and argv in get_opt().

This refactoring makes it slightly easier to capsicumize nm(1).

Discussed with: emaste
Sponsored by: The FreeBSD Foundation

MFC r354544 (by emaste):

elfcopy/strip: Ensure sections have required alignment on output

Object files may specify insufficient alignment on certain sections, for
example due to a bug in NASM[1]. When we detect that case in elfcopy or
strip, emit a warning and increase the alignment to the minimum
required.

The NASM bug was fixed in 2015[2], but we might as well have this fixup
(and warning) in elfcopy in case we encounter such a file for any other
reason.

This might be reworked somewhat upstream - see ELF Tool Chain
ticket 485[3].

[1] https://bugzilla.nasm.us/show_bug.cgi?id=3392307
[2] https://repo.or.cz/w/nasm.git/commit/1f0cb0f2c1ba632c0fab02424928cfb756a9160c
[3] https://sourceforge.net/p/elftoolchain/tickets/485/

PR: 198611
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D2292

MFC r354842 (by jhibbits):

ELF toolchain: Add PowerPC VMX and VSX note decode to readelf

Summary: A follow-on to r276634, which added the VMX note to userland cores,
and r334538 for VSX notes.

Copied from note_type_linux_core().

Reviewed by: emaste
Differential Revision: https://reviews.freebsd.org/D22404

MFC r355413 (by emaste):

Update ELF Tool Chain to upstream r3769

This contains many small bugfixes and documentation improvements.

Sponsored by: The FreeBSD Foundation

MFC r357450 (by markj):

addr2line: Cache CU DIEs upon a successful address lookup.

Previously, addr2line would sequentially search all CUs for each input
address. For some uses, notably syzkaller's code coverage map generator,
this was extremely slow. Add a CU cache into which entries are added
following a successful lookup, and search the cache before falling back
to a scan. When translating a large number of addresses this yields
slightly better performance than GNU addr2line.

Garbage-collect an unused hash table which appears to have been intended
for the same purpose. A hash table doesn't seem particularly suitable
since each CU spans a range of addresses.

Submitted by: Tiger Gao <tig@freebsdfoundation.org>
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D23418

MFC r357462 (by markj):

addr2line: Avoid a name collision.

The RB_ macros define functions with a parameter named head, and gcc
warns about this.

MFC r357531 (by markj):

libdwarf: Remove unnecessary NULL checks.

All callers of _dwarf_add_expr() and _dwarf_expr_into_block() pass a
non-NULL expr pointer, and these functions assume that expr is non-NULL
anyway.

CID: 1193305, 1193306
Sponsored by: The FreeBSD Foundation

MFC r357532 (by markj):

libdwarf: Fix a possible memory leak in dwarf_add_AT_location_expr().

CID: 1193364
Sponsored by: The FreeBSD Foundation

MFC r357533 (by markj):

libdwarf: Make an out-pointer of _dwarf_abbrev_add() mandatory.

All callers pass a non-NULL pointer, and otherwise it was possible to
leak memory if the abbrev was not added to a CU.

CID: 1193365
Sponsored by: The FreeBSD Foundation

MFC r357534 (by markj):

libdwarf: Fix a memory leak in _dwarf_frame_section_init().

If frame length validation failed we would leak memory.

CID: 1193366
Sponsored by: The FreeBSD Foundation

MFC r357535 (by markj):

libelftc: Fix memory leaks in the C++ demanglers.

CID: 1262518, 1262519, 1262520, 1262529
Sponsored by: The FreeBSD Foundation

MFC r357536 (by markj):

libelftc: Add a missing check for an error from vector_str_init().

While here consistently use the same spelling for such checks.

CID: 1376769
Sponsored by: The FreeBSD Foundation

MFC r357537 (by markj):

elfcopy: Handle multiple data descriptors properly.

The code clearly meant to resize the buffer in the case where a section
was backed by multiple data descriptors.

In practice this shouldn't have been a problem since libelf would return
a single data descriptor for each section in a newly opened file.

CID: 1262522
Sponsored by: The FreeBSD Foundation

MFC r357538 (by markj):

elfcopy: Avoid leaking dst's fd when we fail to copy a file.

We should really create the output file in the same directory as the
destination file so that rename() works. This will be done in a future
change as part of some work to run in capability mode.

CID: 1262523
Sponsored by: The FreeBSD Foundation

MFC r357539 (by markj):

size: Avoid returning a stack pointer from xlatetom().

The callers only check whether the returned pointer is non-NULL, so this
was harmless in practice, but change the return value to guard against
the issue.

CID: 1411597
Sponsored by: The FreeBSD Foundation

MFC r357540 (by markj):

readelf: Fix a double close of the input file.

The caller of dump_object() is responsible for opening the file, let it
be responsible for closing too.

CID: 1411588
Sponsored by: The FreeBSD Foundation

MFC r357541 (by markj):

readelf: Fix the check for an error from realloc().

Use err() instead of errx() while here, since realloc() sets errno.

CID: 1401326
Sponsored by: The FreeBSD Foundation

MFC r357542 (by markj):

readelf: Don't leak memory when dwarf_get_fde_info_for_all_regs() fails.

CID: 1292493
Sponsored by: The FreeBSD Foundation

MFC r357826 (by emaste):

elfcopy: set ELF OS/ABI field when converting from binary

PR: 228934
Submitted by: Tiger Gao <tig@freebsdfoundation.org>
Reviewed by: markj, jkoshy
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D23504

MFC r357844 (by emaste):

addr2line: Handle DW_AT_ranges in compile units

Based on original submission by Marat Radchenko in ELF Tool Chain
ticket #545, rebased and updated by Tiger Gao.

PR: 217736
Submitted by: Marat Radchenko <marat@slonopotamus.org>
Submitted by: Tiger Gao <tig@freebsdfoundation.org>
Reviewed by: markj
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D23501

MFC r357862 (by emaste):

addr2line: use stdbool.h header for bool

Presumably a bool definition is obtained via header contamination on
FreeBSD-CURRENT. Found while trying to upstream FreeBSD addr2line
changes - the FreeBSD 11.2 CI build failed there.

Reported by: Cirrus-CI, upstream ELF Tool Chain
Sponsored by: The FreeBSD Foundation

MFC r358499 (by emaste):

readelf: add PROTMAX_DISABLE and STKGAP_DISABLE

From r349609 (PROTMAX_DISABLE) and r354790 (STKGAP_DISABLE). Commited
upstream (in a slightly different form) as r3831.

Sponsored by: The FreeBSD Foundation

MFC r358631 (by emaste):

Reserve WXNEEDED ELF feature control flag

This will be used to tag binaries that require W+X mappings, in advance
of the ability to prevent W^X in mmap/mprotect.

There is still some discussion about the flag's name, but the ABI won't
change even if the name does (as kib pointed out in the review).

Reviewed by: csjp, kib
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D23909

MFC r358637 (by emaste):

readelf: check note namesz and descsz

Previously corrupt note namesz or descsz (perhaps caused by readelf's
current lack of endian support for notes) resulted in a crash. Check
that namesz and descsz do not extend beyond the end of the buffer before
trying to access name and desc data.

Reported by: jhb
Sponsored by: The FreeBSD Foundation

MFC r358639 (by emaste):

readelf: simplify namesz / descsz checks

Sponsored by: The FreeBSD Foundation

MFC r358685 (by emaste):

libelf: rationalize error handling in ELF note conversion

Previously _libelf_cvt_NOTE_tom (to host) returned false if a note's
namesz + descsz exceeded the buffer size, while _libelf_cvt_NOTE_tof
(to file) silently truncated. Return false in the latter case too.

Sponsored by: The FreeBSD Foundation

MFC r358706 (by emaste):

readelf: add XEN_ELFNOTE_PHYS32_ENTRY note

See r336469 for details.

Sponsored by: The FreeBSD Foundation

MFC r358708 (by emaste):

readelf: decode and print Xen ELF note strings

Sponsored by: The FreeBSD Foundation

MFC r358713 (by emaste):

readelf: print GNU Build-ID

Sponsored by: The FreeBSD Foundation

MFC r358778 (by emaste):

readelf: hoist file opening out of dump_object

Diff reduction with HEAD to facilitate other MFCs.

MFC r359166 (by emaste):

objcopy: add new sections also when there is no .shstrtab

Previously objcopy (elfcopy) --add-sections inserted new sections before
.shstrtab, but omitted them if there was no .shstrtab.

Now, after processing existing sections add new sections if they were
not yet added.

PR: 241437
Reported by: arrowd
Submitted by: Tiger Gao <tig@FreeBSDFoundation.org>
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D23571

MFC r359172 (by markj):

libdwarf: Make an out-pointer assignment unconditional.

There is no reason for diep to ever be NULL, since in that case we would
simply be leaking memory.

CID: 1418801
Sponsored by: The FreeBSD Foundation

MFC r359173 (by markj):

libpe: Avoid a potential use-after-free in pe_update_symtab().

This function appears to be unused within FreeBSD and ELFToolChain.

CID: 1418982
Sponsored by: The FreeBSD Foundation

MFC r359174 (by markj):

readelf: Avoid leaking ELF descriptors for archive entries.

CID: 1292494
Sponsored by: The FreeBSD Foundation

MFC r359175 (by markj):

readelf: Fix another instance of the leak mentioned in r357542.

CID: 1292493
Sponsored by: The FreeBSD Foundation

MFC r359176 (by markj):

libelftc: Fix a memory leak in cpp_demangle_read_type().

CID: 1305425
Sponsored by: The FreeBSD Foundation

MFC r359189 (by emaste):

readelf: simplify Xen string note printing

Reviewed by: markj
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D24140

MFC r361104 (by jhibbits):

elftoolchain: Add powerpc64 definition to elftoolchain config

powerpc is already in place, but powerpc64 is needed separately.

MFC r361662 (by emaste):

readelf: add more DT_FLAGS_1 flags

Reference:
https://docs.oracle.com/cd/E36784_01/html/E36857/chapter6-42444.html

> DF_1_SINGLETON Singleton symbols exist.
> DF_1_STUB Object is a stub.
> DF_1_PIE Object is a position-independent executable.

Sponsored by: The FreeBSD Foundation

MFC r365489 (by bdragon):

[PowerPC64LE] PPC64LE support for libelf.

Fix native detection when building on powerpc64le.

I will be submitting this and r361104 upstream shortly.

Sponsored by: Tag1 Consulting, Inc.

MFC r366977 (by emaste):

libelf: add compression header support

GNU and Oracle libelf implementations added support for section
compression, intended to reduce the size of DWARF debug info (which
might be an order of magnitude larger than the code).

There are two compressed ELF section formats:

1. Old GNU - sections are renmaed to start with 'z'. Section contains
a magic number, uncompressed size, and compressed data.

2. Oracle and New GNU - compressed sections use the SHF_COMPRESSED flag.
The compression header contains the compression type, uncompressed
size, and uncompressed alignment.

The second style is preferred and this change implements only that one.

Submitted by: Tiger Gao <tig@FreeBSDFoundation.org>
Reviewed by: markj
Relnotes: Yes
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D24566

MFC r367209 (by emaste):

readelf: Add -z decompression support

Compatible with GNU readelf, -z decompresses sections displayed by
-x or -p.

ELF Tool Chain ticket #555
https://sourceforge.net/p/elftoolchain/tickets/555/

Submitted by: Tiger Gao <tig@FreeBSDFoundation.org>
Reviewed by: markj
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D26909

MFC r367238 (by bdragon):

Fix 32-bit build after r367209

Fix build on systems with a 32-bit size_t.

Since it's being passed as a pointer, a 64-bit write to it will overflow.

MFC r367322 (by dim):

Merge elftoolchain r3877 (by jkoshy):

Incorporate fixes from Dimitry Andric:

- Use a BUFFER_GROW() macro to avoid rounding errors in capacity
calculations.
- Fix a bug introduced in [r3531].
- Fix handling of nested template parameters.

Ticket: #581

This should fix a number of assertions on elftoolchain's cxxfilt, and
allow it to correctly demangle several names that it could not handle
before.

Obtained from: https://sourceforge.net/p/elftoolchain/code/3877/
PR: 250702


/freebsd-11-stable/contrib/elftoolchain/.cirrus.yml
/freebsd-11-stable/contrib/elftoolchain/README.rst
/freebsd-11-stable/contrib/elftoolchain/addr2line/addr2line.1
/freebsd-11-stable/contrib/elftoolchain/addr2line/addr2line.c
/freebsd-11-stable/contrib/elftoolchain/ar/ar.1
/freebsd-11-stable/contrib/elftoolchain/ar/ar.5
/freebsd-11-stable/contrib/elftoolchain/ar/ar.c
/freebsd-11-stable/contrib/elftoolchain/ar/ar.h
/freebsd-11-stable/contrib/elftoolchain/ar/ranlib.1
/freebsd-11-stable/contrib/elftoolchain/ar/read.c
/freebsd-11-stable/contrib/elftoolchain/ar/write.c
/freebsd-11-stable/contrib/elftoolchain/common/_elftc.h
/freebsd-11-stable/contrib/elftoolchain/common/elfdefinitions.h
/freebsd-11-stable/contrib/elftoolchain/common/native-elf-format
/freebsd-11-stable/contrib/elftoolchain/cxxfilt/c++filt.1
/freebsd-11-stable/contrib/elftoolchain/elfcopy/ascii.c
/freebsd-11-stable/contrib/elftoolchain/elfcopy/binary.c
/freebsd-11-stable/contrib/elftoolchain/elfcopy/elfcopy.1
/freebsd-11-stable/contrib/elftoolchain/elfcopy/elfcopy.h
/freebsd-11-stable/contrib/elftoolchain/elfcopy/main.c
/freebsd-11-stable/contrib/elftoolchain/elfcopy/mcs.1
/freebsd-11-stable/contrib/elftoolchain/elfcopy/sections.c
/freebsd-11-stable/contrib/elftoolchain/elfcopy/segments.c
/freebsd-11-stable/contrib/elftoolchain/elfcopy/strip.1
/freebsd-11-stable/contrib/elftoolchain/elfdump/elfdump.c
/freebsd-11-stable/contrib/elftoolchain/libdwarf/dwarf.3
/freebsd-11-stable/contrib/elftoolchain/libdwarf/dwarf.h
/freebsd-11-stable/contrib/elftoolchain/libdwarf/dwarf_add_AT_comp_dir.3
/freebsd-11-stable/contrib/elftoolchain/libdwarf/dwarf_add_AT_const_value_string.3
/freebsd-11-stable/contrib/elftoolchain/libdwarf/dwarf_add_AT_dataref.3
/freebsd-11-stable/contrib/elftoolchain/libdwarf/dwarf_add_AT_flag.3
/freebsd-11-stable/contrib/elftoolchain/libdwarf/dwarf_add_AT_location_expr.3
/freebsd-11-stable/contrib/elftoolchain/libdwarf/dwarf_add_AT_name.3
/freebsd-11-stable/contrib/elftoolchain/libdwarf/dwarf_add_AT_producer.3
/freebsd-11-stable/contrib/elftoolchain/libdwarf/dwarf_add_AT_ref_address.3
/freebsd-11-stable/contrib/elftoolchain/libdwarf/dwarf_add_AT_reference.3
/freebsd-11-stable/contrib/elftoolchain/libdwarf/dwarf_add_AT_signed_const.3
/freebsd-11-stable/contrib/elftoolchain/libdwarf/dwarf_add_AT_string.3
/freebsd-11-stable/contrib/elftoolchain/libdwarf/dwarf_add_AT_targ_address.3
/freebsd-11-stable/contrib/elftoolchain/libdwarf/dwarf_add_arange.3
/freebsd-11-stable/contrib/elftoolchain/libdwarf/dwarf_add_die_to_debug.3
/freebsd-11-stable/contrib/elftoolchain/libdwarf/dwarf_add_directory_decl.3
/freebsd-11-stable/contrib/elftoolchain/libdwarf/dwarf_add_expr_addr.3
/freebsd-11-stable/contrib/elftoolchain/libdwarf/dwarf_add_expr_gen.3
/freebsd-11-stable/contrib/elftoolchain/libdwarf/dwarf_add_fde_inst.3
/freebsd-11-stable/contrib/elftoolchain/libdwarf/dwarf_add_file_decl.3
/freebsd-11-stable/contrib/elftoolchain/libdwarf/dwarf_add_frame_cie.3
/freebsd-11-stable/contrib/elftoolchain/libdwarf/dwarf_add_frame_fde.3
/freebsd-11-stable/contrib/elftoolchain/libdwarf/dwarf_add_funcname.3
/freebsd-11-stable/contrib/elftoolchain/libdwarf/dwarf_add_line_entry.3
/freebsd-11-stable/contrib/elftoolchain/libdwarf/dwarf_add_pubname.3
/freebsd-11-stable/contrib/elftoolchain/libdwarf/dwarf_add_typename.3
/freebsd-11-stable/contrib/elftoolchain/libdwarf/dwarf_add_varname.3
/freebsd-11-stable/contrib/elftoolchain/libdwarf/dwarf_add_weakname.3
/freebsd-11-stable/contrib/elftoolchain/libdwarf/dwarf_attr.3
/freebsd-11-stable/contrib/elftoolchain/libdwarf/dwarf_attrlist.3
/freebsd-11-stable/contrib/elftoolchain/libdwarf/dwarf_attroffset.3
/freebsd-11-stable/contrib/elftoolchain/libdwarf/dwarf_attrval_signed.3
/freebsd-11-stable/contrib/elftoolchain/libdwarf/dwarf_child.3
/freebsd-11-stable/contrib/elftoolchain/libdwarf/dwarf_dealloc.3
/freebsd-11-stable/contrib/elftoolchain/libdwarf/dwarf_def_macro.3
/freebsd-11-stable/contrib/elftoolchain/libdwarf/dwarf_die_abbrev_code.3
/freebsd-11-stable/contrib/elftoolchain/libdwarf/dwarf_die_link.3
/freebsd-11-stable/contrib/elftoolchain/libdwarf/dwarf_diename.3
/freebsd-11-stable/contrib/elftoolchain/libdwarf/dwarf_dieoffset.3
/freebsd-11-stable/contrib/elftoolchain/libdwarf/dwarf_dump.c
/freebsd-11-stable/contrib/elftoolchain/libdwarf/dwarf_end_macro_file.3
/freebsd-11-stable/contrib/elftoolchain/libdwarf/dwarf_errmsg.3
/freebsd-11-stable/contrib/elftoolchain/libdwarf/dwarf_errno.3
/freebsd-11-stable/contrib/elftoolchain/libdwarf/dwarf_expand_frame_instructions.3
/freebsd-11-stable/contrib/elftoolchain/libdwarf/dwarf_expr_current_offset.3
/freebsd-11-stable/contrib/elftoolchain/libdwarf/dwarf_expr_into_block.3
/freebsd-11-stable/contrib/elftoolchain/libdwarf/dwarf_fde_cfa_offset.3
/freebsd-11-stable/contrib/elftoolchain/libdwarf/dwarf_find_macro_value_start.3
/freebsd-11-stable/contrib/elftoolchain/libdwarf/dwarf_finish.3
/freebsd-11-stable/contrib/elftoolchain/libdwarf/dwarf_formaddr.3
/freebsd-11-stable/contrib/elftoolchain/libdwarf/dwarf_formblock.3
/freebsd-11-stable/contrib/elftoolchain/libdwarf/dwarf_formexprloc.3
/freebsd-11-stable/contrib/elftoolchain/libdwarf/dwarf_formflag.3
/freebsd-11-stable/contrib/elftoolchain/libdwarf/dwarf_formref.3
/freebsd-11-stable/contrib/elftoolchain/libdwarf/dwarf_formsig8.3
/freebsd-11-stable/contrib/elftoolchain/libdwarf/dwarf_formstring.3
/freebsd-11-stable/contrib/elftoolchain/libdwarf/dwarf_formudata.3
/freebsd-11-stable/contrib/elftoolchain/libdwarf/dwarf_get_AT_name.3
/freebsd-11-stable/contrib/elftoolchain/libdwarf/dwarf_get_abbrev.3
/freebsd-11-stable/contrib/elftoolchain/libdwarf/dwarf_get_abbrev_children_flag.3
/freebsd-11-stable/contrib/elftoolchain/libdwarf/dwarf_get_abbrev_code.3
/freebsd-11-stable/contrib/elftoolchain/libdwarf/dwarf_get_abbrev_entry.3
/freebsd-11-stable/contrib/elftoolchain/libdwarf/dwarf_get_abbrev_tag.3
/freebsd-11-stable/contrib/elftoolchain/libdwarf/dwarf_get_address_size.3
/freebsd-11-stable/contrib/elftoolchain/libdwarf/dwarf_get_arange.3
/freebsd-11-stable/contrib/elftoolchain/libdwarf/dwarf_get_arange_info.3
/freebsd-11-stable/contrib/elftoolchain/libdwarf/dwarf_get_aranges.3
/freebsd-11-stable/contrib/elftoolchain/libdwarf/dwarf_get_cie_index.3
/freebsd-11-stable/contrib/elftoolchain/libdwarf/dwarf_get_cie_info.3
/freebsd-11-stable/contrib/elftoolchain/libdwarf/dwarf_get_cie_of_fde.3
/freebsd-11-stable/contrib/elftoolchain/libdwarf/dwarf_get_cu_die_offset.3
/freebsd-11-stable/contrib/elftoolchain/libdwarf/dwarf_get_die_infotypes_flag.3
/freebsd-11-stable/contrib/elftoolchain/libdwarf/dwarf_get_elf.3
/freebsd-11-stable/contrib/elftoolchain/libdwarf/dwarf_get_fde_at_pc.3
/freebsd-11-stable/contrib/elftoolchain/libdwarf/dwarf_get_fde_info_for_all_regs.3
/freebsd-11-stable/contrib/elftoolchain/libdwarf/dwarf_get_fde_info_for_all_regs3.3
/freebsd-11-stable/contrib/elftoolchain/libdwarf/dwarf_get_fde_info_for_cfa_reg3.3
/freebsd-11-stable/contrib/elftoolchain/libdwarf/dwarf_get_fde_info_for_reg.3
/freebsd-11-stable/contrib/elftoolchain/libdwarf/dwarf_get_fde_info_for_reg3.3
/freebsd-11-stable/contrib/elftoolchain/libdwarf/dwarf_get_fde_instr_bytes.3
/freebsd-11-stable/contrib/elftoolchain/libdwarf/dwarf_get_fde_list.3
/freebsd-11-stable/contrib/elftoolchain/libdwarf/dwarf_get_fde_n.3
/freebsd-11-stable/contrib/elftoolchain/libdwarf/dwarf_get_fde_range.3
/freebsd-11-stable/contrib/elftoolchain/libdwarf/dwarf_get_form_class.3
/freebsd-11-stable/contrib/elftoolchain/libdwarf/dwarf_get_funcs.3
/freebsd-11-stable/contrib/elftoolchain/libdwarf/dwarf_get_globals.3
/freebsd-11-stable/contrib/elftoolchain/libdwarf/dwarf_get_loclist_entry.3
/freebsd-11-stable/contrib/elftoolchain/libdwarf/dwarf_get_macro_details.3
/freebsd-11-stable/contrib/elftoolchain/libdwarf/dwarf_get_pubtypes.3
/freebsd-11-stable/contrib/elftoolchain/libdwarf/dwarf_get_ranges.3
/freebsd-11-stable/contrib/elftoolchain/libdwarf/dwarf_get_relocation_info.3
/freebsd-11-stable/contrib/elftoolchain/libdwarf/dwarf_get_relocation_info_count.3
/freebsd-11-stable/contrib/elftoolchain/libdwarf/dwarf_get_section_bytes.3
/freebsd-11-stable/contrib/elftoolchain/libdwarf/dwarf_get_section_max_offsets.3
/freebsd-11-stable/contrib/elftoolchain/libdwarf/dwarf_get_str.3
/freebsd-11-stable/contrib/elftoolchain/libdwarf/dwarf_get_types.3
/freebsd-11-stable/contrib/elftoolchain/libdwarf/dwarf_get_vars.3
/freebsd-11-stable/contrib/elftoolchain/libdwarf/dwarf_get_weaks.3
/freebsd-11-stable/contrib/elftoolchain/libdwarf/dwarf_hasattr.3
/freebsd-11-stable/contrib/elftoolchain/libdwarf/dwarf_hasform.3
/freebsd-11-stable/contrib/elftoolchain/libdwarf/dwarf_highpc.3
/freebsd-11-stable/contrib/elftoolchain/libdwarf/dwarf_init.3
/freebsd-11-stable/contrib/elftoolchain/libdwarf/dwarf_lineno.3
/freebsd-11-stable/contrib/elftoolchain/libdwarf/dwarf_lne_end_sequence.3
/freebsd-11-stable/contrib/elftoolchain/libdwarf/dwarf_lne_set_address.3
/freebsd-11-stable/contrib/elftoolchain/libdwarf/dwarf_loclist.3
/freebsd-11-stable/contrib/elftoolchain/libdwarf/dwarf_loclist_from_expr.3
/freebsd-11-stable/contrib/elftoolchain/libdwarf/dwarf_new_die.3
/freebsd-11-stable/contrib/elftoolchain/libdwarf/dwarf_new_expr.3
/freebsd-11-stable/contrib/elftoolchain/libdwarf/dwarf_new_fde.3
/freebsd-11-stable/contrib/elftoolchain/libdwarf/dwarf_next_cu_header.3
/freebsd-11-stable/contrib/elftoolchain/libdwarf/dwarf_next_types_section.3
/freebsd-11-stable/contrib/elftoolchain/libdwarf/dwarf_object_init.3
/freebsd-11-stable/contrib/elftoolchain/libdwarf/dwarf_pro_attr.c
/freebsd-11-stable/contrib/elftoolchain/libdwarf/dwarf_pro_expr.c
/freebsd-11-stable/contrib/elftoolchain/libdwarf/dwarf_producer_init.3
/freebsd-11-stable/contrib/elftoolchain/libdwarf/dwarf_producer_set_isa.3
/freebsd-11-stable/contrib/elftoolchain/libdwarf/dwarf_reset_section_bytes.3
/freebsd-11-stable/contrib/elftoolchain/libdwarf/dwarf_set_frame_cfa_value.3
/freebsd-11-stable/contrib/elftoolchain/libdwarf/dwarf_set_reloc_application.3
/freebsd-11-stable/contrib/elftoolchain/libdwarf/dwarf_seterrarg.3
/freebsd-11-stable/contrib/elftoolchain/libdwarf/dwarf_srcfiles.3
/freebsd-11-stable/contrib/elftoolchain/libdwarf/dwarf_srclines.3
/freebsd-11-stable/contrib/elftoolchain/libdwarf/dwarf_start_macro_file.3
/freebsd-11-stable/contrib/elftoolchain/libdwarf/dwarf_tag.3
/freebsd-11-stable/contrib/elftoolchain/libdwarf/dwarf_transform_to_disk_form.3
/freebsd-11-stable/contrib/elftoolchain/libdwarf/dwarf_undef_macro.3
/freebsd-11-stable/contrib/elftoolchain/libdwarf/dwarf_vendor_ext.3
/freebsd-11-stable/contrib/elftoolchain/libdwarf/dwarf_whatattr.3
/freebsd-11-stable/contrib/elftoolchain/libdwarf/libdwarf_abbrev.c
/freebsd-11-stable/contrib/elftoolchain/libdwarf/libdwarf_attr.c
/freebsd-11-stable/contrib/elftoolchain/libdwarf/libdwarf_die.c
/freebsd-11-stable/contrib/elftoolchain/libdwarf/libdwarf_frame.c
/freebsd-11-stable/contrib/elftoolchain/libdwarf/libdwarf_lineno.c
/freebsd-11-stable/contrib/elftoolchain/libdwarf/libdwarf_reloc.c
/freebsd-11-stable/contrib/elftoolchain/libelf/Makefile
/freebsd-11-stable/contrib/elftoolchain/libelf/Version.map
/freebsd-11-stable/contrib/elftoolchain/libelf/_libelf.h
/freebsd-11-stable/contrib/elftoolchain/libelf/_libelf_config.h
/freebsd-11-stable/contrib/elftoolchain/libelf/elf.3
/freebsd-11-stable/contrib/elftoolchain/libelf/elf_begin.3
/freebsd-11-stable/contrib/elftoolchain/libelf/elf_cntl.3
/freebsd-11-stable/contrib/elftoolchain/libelf/elf_data.c
/freebsd-11-stable/contrib/elftoolchain/libelf/elf_end.3
/freebsd-11-stable/contrib/elftoolchain/libelf/elf_end.c
/freebsd-11-stable/contrib/elftoolchain/libelf/elf_errmsg.3
/freebsd-11-stable/contrib/elftoolchain/libelf/elf_fill.3
/freebsd-11-stable/contrib/elftoolchain/libelf/elf_flagdata.3
/freebsd-11-stable/contrib/elftoolchain/libelf/elf_getarhdr.3
/freebsd-11-stable/contrib/elftoolchain/libelf/elf_getarsym.3
/freebsd-11-stable/contrib/elftoolchain/libelf/elf_getbase.3
/freebsd-11-stable/contrib/elftoolchain/libelf/elf_getdata.3
/freebsd-11-stable/contrib/elftoolchain/libelf/elf_getident.3
/freebsd-11-stable/contrib/elftoolchain/libelf/elf_getident.c
/freebsd-11-stable/contrib/elftoolchain/libelf/elf_getphdrnum.3
/freebsd-11-stable/contrib/elftoolchain/libelf/elf_getphnum.3
/freebsd-11-stable/contrib/elftoolchain/libelf/elf_getscn.3
/freebsd-11-stable/contrib/elftoolchain/libelf/elf_getshdrnum.3
/freebsd-11-stable/contrib/elftoolchain/libelf/elf_getshdrstrndx.3
/freebsd-11-stable/contrib/elftoolchain/libelf/elf_getshnum.3
/freebsd-11-stable/contrib/elftoolchain/libelf/elf_getshstrndx.3
/freebsd-11-stable/contrib/elftoolchain/libelf/elf_hash.3
/freebsd-11-stable/contrib/elftoolchain/libelf/elf_kind.3
/freebsd-11-stable/contrib/elftoolchain/libelf/elf_memory.3
/freebsd-11-stable/contrib/elftoolchain/libelf/elf_next.3
/freebsd-11-stable/contrib/elftoolchain/libelf/elf_next.c
/freebsd-11-stable/contrib/elftoolchain/libelf/elf_open.3
/freebsd-11-stable/contrib/elftoolchain/libelf/elf_rand.3
/freebsd-11-stable/contrib/elftoolchain/libelf/elf_rand.c
/freebsd-11-stable/contrib/elftoolchain/libelf/elf_rawfile.3
/freebsd-11-stable/contrib/elftoolchain/libelf/elf_rawfile.c
/freebsd-11-stable/contrib/elftoolchain/libelf/elf_scn.c
/freebsd-11-stable/contrib/elftoolchain/libelf/elf_strptr.3
/freebsd-11-stable/contrib/elftoolchain/libelf/elf_update.3
/freebsd-11-stable/contrib/elftoolchain/libelf/elf_update.c
/freebsd-11-stable/contrib/elftoolchain/libelf/elf_version.3
/freebsd-11-stable/contrib/elftoolchain/libelf/gelf.3
/freebsd-11-stable/contrib/elftoolchain/libelf/gelf.h
/freebsd-11-stable/contrib/elftoolchain/libelf/gelf_cap.c
/freebsd-11-stable/contrib/elftoolchain/libelf/gelf_chdr.c
/freebsd-11-stable/contrib/elftoolchain/libelf/gelf_checksum.3
/freebsd-11-stable/contrib/elftoolchain/libelf/gelf_dyn.c
/freebsd-11-stable/contrib/elftoolchain/libelf/gelf_fsize.3
/freebsd-11-stable/contrib/elftoolchain/libelf/gelf_getcap.3
/freebsd-11-stable/contrib/elftoolchain/libelf/gelf_getchdr.3
/freebsd-11-stable/contrib/elftoolchain/libelf/gelf_getclass.3
/freebsd-11-stable/contrib/elftoolchain/libelf/gelf_getdyn.3
/freebsd-11-stable/contrib/elftoolchain/libelf/gelf_getehdr.3
/freebsd-11-stable/contrib/elftoolchain/libelf/gelf_getmove.3
/freebsd-11-stable/contrib/elftoolchain/libelf/gelf_getphdr.3
/freebsd-11-stable/contrib/elftoolchain/libelf/gelf_getrel.3
/freebsd-11-stable/contrib/elftoolchain/libelf/gelf_getrela.3
/freebsd-11-stable/contrib/elftoolchain/libelf/gelf_getshdr.3
/freebsd-11-stable/contrib/elftoolchain/libelf/gelf_getsym.3
/freebsd-11-stable/contrib/elftoolchain/libelf/gelf_getsyminfo.3
/freebsd-11-stable/contrib/elftoolchain/libelf/gelf_getsymshndx.3
/freebsd-11-stable/contrib/elftoolchain/libelf/gelf_move.c
/freebsd-11-stable/contrib/elftoolchain/libelf/gelf_newehdr.3
/freebsd-11-stable/contrib/elftoolchain/libelf/gelf_newphdr.3
/freebsd-11-stable/contrib/elftoolchain/libelf/gelf_rel.c
/freebsd-11-stable/contrib/elftoolchain/libelf/gelf_rela.c
/freebsd-11-stable/contrib/elftoolchain/libelf/gelf_sym.c
/freebsd-11-stable/contrib/elftoolchain/libelf/gelf_syminfo.c
/freebsd-11-stable/contrib/elftoolchain/libelf/gelf_symshndx.c
/freebsd-11-stable/contrib/elftoolchain/libelf/gelf_update_ehdr.3
/freebsd-11-stable/contrib/elftoolchain/libelf/gelf_xlate.c
/freebsd-11-stable/contrib/elftoolchain/libelf/gelf_xlatetof.3
/freebsd-11-stable/contrib/elftoolchain/libelf/libelf.h
/freebsd-11-stable/contrib/elftoolchain/libelf/libelf_allocate.c
/freebsd-11-stable/contrib/elftoolchain/libelf/libelf_ar.c
/freebsd-11-stable/contrib/elftoolchain/libelf/libelf_chdr.c
/freebsd-11-stable/contrib/elftoolchain/libelf/libelf_convert.m4
/freebsd-11-stable/contrib/elftoolchain/libelf/libelf_data.c
/freebsd-11-stable/contrib/elftoolchain/libelf/libelf_ehdr.c
/freebsd-11-stable/contrib/elftoolchain/libelf/libelf_elfmachine.c
/freebsd-11-stable/contrib/elftoolchain/libelf/libelf_extended.c
/freebsd-11-stable/contrib/elftoolchain/libelf/libelf_memory.c
/freebsd-11-stable/contrib/elftoolchain/libelf/libelf_msize.m4
/freebsd-11-stable/contrib/elftoolchain/libelf/libelf_phdr.c
/freebsd-11-stable/contrib/elftoolchain/libelf/libelf_xlate.c
/freebsd-11-stable/contrib/elftoolchain/libelf/os.Linux.mk
/freebsd-11-stable/contrib/elftoolchain/libelftc/_libelftc.h
/freebsd-11-stable/contrib/elftoolchain/libelftc/elftc.3
/freebsd-11-stable/contrib/elftoolchain/libelftc/elftc_bfd_find_target.3
/freebsd-11-stable/contrib/elftoolchain/libelftc/elftc_bfdtarget.c
/freebsd-11-stable/contrib/elftoolchain/libelftc/elftc_copyfile.3
/freebsd-11-stable/contrib/elftoolchain/libelftc/elftc_demangle.3
/freebsd-11-stable/contrib/elftoolchain/libelftc/elftc_reloc_type_str.3
/freebsd-11-stable/contrib/elftoolchain/libelftc/elftc_set_timestamps.3
/freebsd-11-stable/contrib/elftoolchain/libelftc/elftc_set_timestamps.c
/freebsd-11-stable/contrib/elftoolchain/libelftc/elftc_string_table.c
/freebsd-11-stable/contrib/elftoolchain/libelftc/elftc_string_table_create.3
/freebsd-11-stable/contrib/elftoolchain/libelftc/elftc_timestamp.3
/freebsd-11-stable/contrib/elftoolchain/libelftc/elftc_version.3
/freebsd-11-stable/contrib/elftoolchain/libelftc/libelftc.h
/freebsd-11-stable/contrib/elftoolchain/libelftc/libelftc_bfdtarget.c
/freebsd-11-stable/contrib/elftoolchain/libelftc/libelftc_dem_arm.c
/freebsd-11-stable/contrib/elftoolchain/libelftc/libelftc_dem_gnu2.c
/freebsd-11-stable/contrib/elftoolchain/libelftc/libelftc_dem_gnu3.c
/freebsd-11-stable/contrib/elftoolchain/libelftc/libelftc_vstr.c
/freebsd-11-stable/contrib/elftoolchain/libelftc/make-toolchain-version
/freebsd-11-stable/contrib/elftoolchain/libpe/pe_symtab.c
/freebsd-11-stable/contrib/elftoolchain/nm/nm.1
/freebsd-11-stable/contrib/elftoolchain/nm/nm.c
/freebsd-11-stable/contrib/elftoolchain/readelf/readelf.1
/freebsd-11-stable/contrib/elftoolchain/readelf/readelf.c
/freebsd-11-stable/contrib/elftoolchain/size/size.c
/freebsd-11-stable/contrib/elftoolchain/strings/strings.c
Makefile
/freebsd-11-stable/lib/libelftc/Makefile
/freebsd-11-stable/lib/libelftc/elftc_version.c
/freebsd-11-stable/sys/sys/elf_common.h
/freebsd-11-stable/usr.bin/readelf/Makefile
340320 10-Nov-2018 emaste

MFC r338485 (jhb): libelf: Add gelf_mips64el.c to file list

313538 10-Feb-2017 ngie

MFC r312452-r312512:

r312452-r312512:

- Use SRCTOP-relative paths to other directories instead of .CURDIR-relative ones

This simplifies pathing in make/displayed output

- Use .CURDIR:H instead of .CURDIR to simplify pathing in output, etc


/freebsd-11-stable/lib/csu/aarch64/Makefile
/freebsd-11-stable/lib/csu/amd64/Makefile
/freebsd-11-stable/lib/csu/arm/Makefile
/freebsd-11-stable/lib/csu/i386/Makefile
/freebsd-11-stable/lib/csu/mips/Makefile
/freebsd-11-stable/lib/csu/powerpc/Makefile
/freebsd-11-stable/lib/csu/powerpc64/Makefile
/freebsd-11-stable/lib/csu/riscv/Makefile
/freebsd-11-stable/lib/csu/sparc64/Makefile
/freebsd-11-stable/lib/libalias/libalias/Makefile
/freebsd-11-stable/lib/libalias/modules/Makefile
/freebsd-11-stable/lib/libalias/modules/Makefile.inc
/freebsd-11-stable/lib/libarchive/Makefile
/freebsd-11-stable/lib/libauditd/Makefile
/freebsd-11-stable/lib/libbegemot/Makefile
/freebsd-11-stable/lib/libblocksruntime/Makefile
/freebsd-11-stable/lib/libbluetooth/Makefile
/freebsd-11-stable/lib/libbsm/Makefile
/freebsd-11-stable/lib/libbsnmp/libbsnmp/Makefile
/freebsd-11-stable/lib/libbz2/Makefile
/freebsd-11-stable/lib/libc++/Makefile
/freebsd-11-stable/lib/libc_nonshared/Makefile
/freebsd-11-stable/lib/libcam/Makefile
/freebsd-11-stable/lib/libcom_err/Makefile
/freebsd-11-stable/lib/libcompat/Makefile
/freebsd-11-stable/lib/libcrypt/Makefile
/freebsd-11-stable/lib/libcxxrt/Makefile
/freebsd-11-stable/lib/libdevdctl/tests/Makefile
/freebsd-11-stable/lib/libdwarf/Makefile
Makefile
/freebsd-11-stable/lib/libevent/Makefile
/freebsd-11-stable/lib/libexecinfo/Makefile
/freebsd-11-stable/lib/libexpat/Makefile
/freebsd-11-stable/lib/libgssapi/Makefile
/freebsd-11-stable/lib/libiconv_modules/Makefile.inc
/freebsd-11-stable/lib/libiconv_modules/mapper_parallel/Makefile
/freebsd-11-stable/lib/libkiconv/Makefile
/freebsd-11-stable/lib/libldns/Makefile
/freebsd-11-stable/lib/liblzma/Makefile
/freebsd-11-stable/lib/libmagic/Makefile
/freebsd-11-stable/lib/libmd/Makefile
/freebsd-11-stable/lib/libmilter/Makefile
/freebsd-11-stable/lib/libmp/Makefile
/freebsd-11-stable/lib/libngatm/Makefile
/freebsd-11-stable/lib/libnv/Makefile
/freebsd-11-stable/lib/libopie/Makefile
/freebsd-11-stable/lib/libpam/libpam/Makefile
/freebsd-11-stable/lib/libpam/modules/Makefile.inc
/freebsd-11-stable/lib/libpam/modules/pam_passwdqc/Makefile
/freebsd-11-stable/lib/libpam/modules/pam_ssh/Makefile
/freebsd-11-stable/lib/libpam/static_libpam/Makefile
/freebsd-11-stable/lib/libpcap/Makefile
/freebsd-11-stable/lib/libpe/Makefile
/freebsd-11-stable/lib/libproc/Makefile
/freebsd-11-stable/lib/libprocstat/zfs/Makefile
/freebsd-11-stable/lib/librpcsec_gss/Makefile
/freebsd-11-stable/lib/librpcsvc/Makefile
/freebsd-11-stable/lib/librt/Makefile
/freebsd-11-stable/lib/libsbuf/Makefile
/freebsd-11-stable/lib/libsm/Makefile
/freebsd-11-stable/lib/libsmb/Makefile
/freebsd-11-stable/lib/libsmdb/Makefile
/freebsd-11-stable/lib/libsmutil/Makefile
/freebsd-11-stable/lib/libsqlite3/Makefile
/freebsd-11-stable/lib/libstdthreads/Makefile
/freebsd-11-stable/lib/libsysdecode/Makefile
/freebsd-11-stable/lib/libtelnet/Makefile
/freebsd-11-stable/lib/libthr/Makefile
/freebsd-11-stable/lib/libthr/support/Makefile.inc
/freebsd-11-stable/lib/libthread_db/Makefile
/freebsd-11-stable/lib/libufs/Makefile
/freebsd-11-stable/lib/libulog/Makefile
/freebsd-11-stable/lib/libunbound/Makefile
/freebsd-11-stable/lib/libutil/Makefile
/freebsd-11-stable/lib/libypclnt/Makefile
/freebsd-11-stable/lib/ncurses/config.mk
/freebsd-11-stable/lib/ncurses/form/Makefile
/freebsd-11-stable/lib/ncurses/formw/Makefile
/freebsd-11-stable/lib/ncurses/menu/Makefile
/freebsd-11-stable/lib/ncurses/menuw/Makefile
/freebsd-11-stable/lib/ncurses/ncurses/Makefile
/freebsd-11-stable/lib/ncurses/ncursesw/Makefile
/freebsd-11-stable/lib/ncurses/panel/Makefile
/freebsd-11-stable/lib/ncurses/panelw/Makefile
302408 08-Jul-2016 gjb

Copy head@r302406 to stable/11 as part of the 11.0-RELEASE cycle.
Prune svn:mergeinfo from the new branch, as nothing has been merged
here.

Additional commits post-branch will follow.

Approved by: re (implicit)
Sponsored by: The FreeBSD Foundation


/freebsd-11-stable/MAINTAINERS
/freebsd-11-stable/cddl
/freebsd-11-stable/cddl/contrib/opensolaris
/freebsd-11-stable/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/print
/freebsd-11-stable/cddl/contrib/opensolaris/cmd/zfs
/freebsd-11-stable/cddl/contrib/opensolaris/lib/libzfs
/freebsd-11-stable/contrib/amd
/freebsd-11-stable/contrib/apr
/freebsd-11-stable/contrib/apr-util
/freebsd-11-stable/contrib/atf
/freebsd-11-stable/contrib/binutils
/freebsd-11-stable/contrib/bmake
/freebsd-11-stable/contrib/byacc
/freebsd-11-stable/contrib/bzip2
/freebsd-11-stable/contrib/com_err
/freebsd-11-stable/contrib/compiler-rt
/freebsd-11-stable/contrib/dialog
/freebsd-11-stable/contrib/dma
/freebsd-11-stable/contrib/dtc
/freebsd-11-stable/contrib/ee
/freebsd-11-stable/contrib/elftoolchain
/freebsd-11-stable/contrib/elftoolchain/ar
/freebsd-11-stable/contrib/elftoolchain/brandelf
/freebsd-11-stable/contrib/elftoolchain/elfdump
/freebsd-11-stable/contrib/expat
/freebsd-11-stable/contrib/file
/freebsd-11-stable/contrib/gcc
/freebsd-11-stable/contrib/gcclibs/libgomp
/freebsd-11-stable/contrib/gdb
/freebsd-11-stable/contrib/gdtoa
/freebsd-11-stable/contrib/groff
/freebsd-11-stable/contrib/ipfilter
/freebsd-11-stable/contrib/ldns
/freebsd-11-stable/contrib/ldns-host
/freebsd-11-stable/contrib/less
/freebsd-11-stable/contrib/libarchive
/freebsd-11-stable/contrib/libarchive/cpio
/freebsd-11-stable/contrib/libarchive/libarchive
/freebsd-11-stable/contrib/libarchive/libarchive_fe
/freebsd-11-stable/contrib/libarchive/tar
/freebsd-11-stable/contrib/libc++
/freebsd-11-stable/contrib/libc-vis
/freebsd-11-stable/contrib/libcxxrt
/freebsd-11-stable/contrib/libexecinfo
/freebsd-11-stable/contrib/libpcap
/freebsd-11-stable/contrib/libstdc++
/freebsd-11-stable/contrib/libucl
/freebsd-11-stable/contrib/libxo
/freebsd-11-stable/contrib/llvm
/freebsd-11-stable/contrib/llvm/projects/libunwind
/freebsd-11-stable/contrib/llvm/tools/clang
/freebsd-11-stable/contrib/llvm/tools/lldb
/freebsd-11-stable/contrib/llvm/tools/llvm-dwarfdump
/freebsd-11-stable/contrib/llvm/tools/llvm-lto
/freebsd-11-stable/contrib/mdocml
/freebsd-11-stable/contrib/mtree
/freebsd-11-stable/contrib/ncurses
/freebsd-11-stable/contrib/netcat
/freebsd-11-stable/contrib/ntp
/freebsd-11-stable/contrib/nvi
/freebsd-11-stable/contrib/one-true-awk
/freebsd-11-stable/contrib/openbsm
/freebsd-11-stable/contrib/openpam
/freebsd-11-stable/contrib/openresolv
/freebsd-11-stable/contrib/pf
/freebsd-11-stable/contrib/sendmail
/freebsd-11-stable/contrib/serf
/freebsd-11-stable/contrib/sqlite3
/freebsd-11-stable/contrib/subversion
/freebsd-11-stable/contrib/tcpdump
/freebsd-11-stable/contrib/tcsh
/freebsd-11-stable/contrib/tnftp
/freebsd-11-stable/contrib/top
/freebsd-11-stable/contrib/top/install-sh
/freebsd-11-stable/contrib/tzcode/stdtime
/freebsd-11-stable/contrib/tzcode/zic
/freebsd-11-stable/contrib/tzdata
/freebsd-11-stable/contrib/unbound
/freebsd-11-stable/contrib/vis
/freebsd-11-stable/contrib/wpa
/freebsd-11-stable/contrib/xz
/freebsd-11-stable/crypto/heimdal
/freebsd-11-stable/crypto/openssh
/freebsd-11-stable/crypto/openssl
/freebsd-11-stable/gnu/lib
/freebsd-11-stable/gnu/usr.bin/binutils
/freebsd-11-stable/gnu/usr.bin/cc/cc_tools
/freebsd-11-stable/gnu/usr.bin/gdb
/freebsd-11-stable/lib/libc/locale/ascii.c
/freebsd-11-stable/sys/cddl/contrib/opensolaris
/freebsd-11-stable/sys/contrib/dev/acpica
/freebsd-11-stable/sys/contrib/ipfilter
/freebsd-11-stable/sys/contrib/libfdt
/freebsd-11-stable/sys/contrib/octeon-sdk
/freebsd-11-stable/sys/contrib/x86emu
/freebsd-11-stable/sys/contrib/xz-embedded
/freebsd-11-stable/usr.sbin/bhyve/atkbdc.h
/freebsd-11-stable/usr.sbin/bhyve/bhyvegc.c
/freebsd-11-stable/usr.sbin/bhyve/bhyvegc.h
/freebsd-11-stable/usr.sbin/bhyve/console.c
/freebsd-11-stable/usr.sbin/bhyve/console.h
/freebsd-11-stable/usr.sbin/bhyve/pci_fbuf.c
/freebsd-11-stable/usr.sbin/bhyve/pci_xhci.c
/freebsd-11-stable/usr.sbin/bhyve/pci_xhci.h
/freebsd-11-stable/usr.sbin/bhyve/ps2kbd.c
/freebsd-11-stable/usr.sbin/bhyve/ps2kbd.h
/freebsd-11-stable/usr.sbin/bhyve/ps2mouse.c
/freebsd-11-stable/usr.sbin/bhyve/ps2mouse.h
/freebsd-11-stable/usr.sbin/bhyve/rfb.c
/freebsd-11-stable/usr.sbin/bhyve/rfb.h
/freebsd-11-stable/usr.sbin/bhyve/sockstream.c
/freebsd-11-stable/usr.sbin/bhyve/sockstream.h
/freebsd-11-stable/usr.sbin/bhyve/usb_emul.c
/freebsd-11-stable/usr.sbin/bhyve/usb_emul.h
/freebsd-11-stable/usr.sbin/bhyve/usb_mouse.c
/freebsd-11-stable/usr.sbin/bhyve/vga.c
/freebsd-11-stable/usr.sbin/bhyve/vga.h
298401 21-Apr-2016 emaste

elftoolchain: Use ${SRCTOP} for the top of the FreeBSD tree

It's provided by sys.mk so there's no need to derive it from ${.CURDIR}.

Suggested by: ngie
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D5998


298204 18-Apr-2016 emaste

Replace ${CURDIR}/../.. with ${CURDIR:H:H} in elftoolchain

This produces a nicer path in debug info and build logs.

MFC after: 1 week
Sponsored by: The FreeBSD Foundation


298107 16-Apr-2016 gjb

Merge the projects/release-pkg branch to head.

This allows packaging the base system with pkg(8), including
but not limited to providing the ability to provide upstream
binary update possibilities for non-tier-1 architectures.

This merge is a requirement of the 11.0-RELEASE, and as such,
thank you to everyone that has tested the project branch.

Documentation in build(7) etc. is still somewhat sparse, but
updates to those parts will follow.

Sponsored by: The FreeBSD Foundation


295989 24-Feb-2016 bdrewery

DIRDEPS_BUILD: Regenerate without local dependencies.

These are no longer needed after the recent 'beforebuild: depend' changes
and hooking DIRDEPS_BUILD into a subset of FAST_DEPEND which supports
skipping 'make depend'.

Sponsored by: EMC / Isilon Storage Division


291593 01-Dec-2015 bdrewery

Correct r291566 for defining SHLIBDIR.

This must happen before including bsd.own.mk which sets the default to /usr/lib.

X-MFC-With: r291566
Reported by: Max N. Boyarov


291566 01-Dec-2015 ngie

Move libelf.so.2 from /usr/lib to /lib to unbreak libkvm use after r291406

Tested with the following commands as root:
- yes | make delete-old
- service ldconfig restart
- netstat -nr

X-MFC with: r291406
Reviewed by: jhb, kib
Sponsored by: EMC / Isilon Storage Division


291321 25-Nov-2015 bdrewery

META MODE: Fix 'make bootstrap-tools'.

The main problem was bitrot after elftoolchain being swapped in for the
GNU toolchain.

This also reworks how the list of 'host allowed' libraries is determined
to only allow INTERNALLIBs, which is needed for libelftc to come in.

For usr.bin/readelf use the same hack, as libelf and libdward, to bring in
the needed sys/ headers for host builds. This has not yet been a problem due
to readelf not being built as a host tool in buildworld. This is possible
in the meta build though when building the toolchain.

Sponsored by: EMC / Isilon Storage Division


291320 25-Nov-2015 bdrewery

META MODE: Don't create .meta files when symlinking sources into the obj directory.

Tracking these leads to situations where meta mode will consider the
file to be out of date if /bin/sh or /bin/ln are newer than the source
file. There's no reason for meta mode to do this as make is already
handling the rebuild dependency fine.

Sponsored by: EMC / Isilon Storage Division


291307 25-Nov-2015 bdrewery

META MODE: Prefer INSTALL=tools/install.sh to lessen the need for xinstall.host.

This both avoids some dependencies on xinstall.host and allows
bootstrapping on older releases to work due to lack of at least 'install -l'
support.

Sponsored by: EMC / Isilon Storage Division


284345 13-Jun-2015 sjg

Add META_MODE support.

Off by default, build behaves normally.
WITH_META_MODE we get auto objdir creation, the ability to
start build from anywhere in the tree.

Still need to add real targets under targets/ to build packages.

Differential Revision: D2796
Reviewed by: brooks imp


261246 28-Jan-2014 kaiw

Merge from projects/elftoolchain: Upgrade libelf and libdwarf to newer
versions from elftoolchain upstream (r2974). Convert ctfconvert to
use the APIs from the new libdwarf and make ctfconvert work with Clang
3.4.

__FreeBSD_version is bumped to 1100006.

A list of notable changes:

[libelf]

* The old libelf source code in lib/libelf has been removed.
Instead, the new libelf is built from contrib/elftoolchain/libelf.
* Manual pages are largely improved.
* Internal implementation was refactored and improved for better
correctness and portability.
* Fixed a few memory leaks.
* Extended with extension APIs `elf_open()` and `elf_openmemory()`.
These APIs are similar to `elf_begin()` and `elf_memory()`
respectively, except that they return an ELF descriptor of kind
`ELF_K_NONE` instead of an error if the object being opened could
not be parsed.
* Implement support for translating sections of type ELF_T_VDEF and
ELF_T_VNEED.
* Improve `elf_update()` to check that the executable header, the
program header table, section contents and the section header table
do not overlap, and to ensure that gaps between extents are
filled with the fill character specified by `elf_fill()`.
* Allow `Elf_Data` descriptors to have types and alignments differing
from their containing section.
* Remove functionality controlled by `LIBELF_TEST_HOOKS`.
* Support processing of BSD-flavor archives.
* Add knowledge of section types `SHT_GNU_ATTRIBUTES` and
`SHT_GNU_LIBLIST`.
* Use elftoolchain style symbol versioning.
* Shared library version is bumped.

[libdwarf]

* The old libdwarf source code in lib/libdwarf has been removed.
Instead, the new libdwarf is built from contrib/elftoolchain/libdwarf.
* Support full DWARF3 and partial DWARF4 parsing.
* Support DWARF2 generation.
* Support for DWARF line number, call frame, location expression,
macro info and address ranges, among other things.
* The APIs for the new libdwarf are mostly compatible with the widely
used LGPL libdwarf. Some of the incompatible APIs from the old
libdwarf are kept as its own extensions. All the APIs are documented.
* Use elftoolchain style symbol versioning.
* Shared library version is bumped.

[ctfconvert]

* Switch to the APIs from the new libdwarf.
* Improve die_mem_offset() so that DW_AT_data_member_location attributes
generated by Clang 3.4 can be handled properly.
* Make use of DW_AT_byte_size attribute of the member DIE to calculate
the bits occupied by the member's type, without actually resolving
the type. This way ctfconvert can deal with the case that Clang 3.4
sometimes emits DIE for struct/union member before emitting the DIE
for the type of that member.

Obtained from: elftoolchain
No objection: -toolchain mailing list


255105 31-Aug-2013 andrew

Add support to the ARM platform specific section types.


247221 24-Feb-2013 markj

Merge part of r1712 from elftoolchain, making it possible to resize ELF
sections and indirectly change the layout of an ELF file when
ELF_F_LAYOUT is not set.

PR: bin/167103
Approved by: rstone (co-mentor)
Obtained from: elftoolchain
MFC after: 2 weeks


246978 19-Feb-2013 markj

- Make sure to set an error code when trying to obtain a data descriptor for
a section of type SHT_NULL.
- Update the man page to reflect the fact that elf_getdata() and
elf_rawdata() may return with an error of ELF_E_SECTION.

PR: bin/175491
Approved by: emaste (co-mentor)
MFC after: 1 week


241720 19-Oct-2012 ed

Fix warnings found by -Wmising-variable-declarations.

This self-written compiler warning, which is hopefully going to be
committed into LLVM sources soon, warns about potentially missing
`static' keywords, similar to -Wmissing-prototypes.

- bin/pax: Move external declaration of chdname and s_mask into extern.h.
- bin/setfacl: Move setfacl.c-specific stuff out of setfacl.h.
- sbin/mount_fusefs: Remove char *progname; use getprogname().
- others: add `static' where possible.


238741 24-Jul-2012 ache

Don't ever build files depending on the directory where they are placed in.
It is obvious that its modification time will change with each such file
builded.
This bug cause whole libelf to rebuild itself each second make run
(and relink that files on each first make run) in the loop.


237531 24-Jun-2012 andrew

Add the sys directory we create to the list of items to clean.


237528 24-Jun-2012 andrew

Create a symlink to sys/elf32.h, sys/elf64.h, and sys/elf_common.h.

When building libelf in the bootstrap stage this would include the tree
versions of, for example, sys/_types.h. This would work as long as the
tree's version of this file was close enough to the system's version of
the file. If, however, there was a change in the tree such that the location
of a typedef was moved this would cause problems. In this case the version
of sys/_types.h in the tree no longer defines __wchar_t and expects it to
to be defined in machine/_types.h, however we pick up machine/_types.h from
the system and find it is not defined there. The solution is to restrict the
parts of sys er include from the tree to those that are needed.

This fixes the recent Tinderbox failure.

Pointy Hat to: andrew


236626 05-Jun-2012 joel

Remove repeated words.


236438 02-Jun-2012 joel

mdoc: minor Bl improvements.


235286 11-May-2012 gjb

General mdoc(7) and typo fixes.

PR: 167734
Submitted by: Nobuyuki Koganemaru (kogane!jp.freebsd.org)
MFC after: 3 days


233648 29-Mar-2012 eadler

Remove trailing whitespace per mdoc lint warning

Disussed with: gavin
No objection from: doc
Approved by: joel
MFC after: 3 days


233524 26-Mar-2012 gonzo

Handle MIPS .reginfo section as ELF_T_BYTE


233520 26-Mar-2012 joel

mdoc: sort prologue macros.


233462 25-Mar-2012 joel

Remove superfluous paragraph macro.


233401 23-Mar-2012 gonzo

Add handler for MIPS.options section


226436 16-Oct-2011 eadler

- change "is is" to "is" or "it is"
- change "the the" to "the"

Approved by: lstewart
Approved by: sahil (mentor)
MFC after: 3 days


221598 07-May-2011 kaiw

Document the behavior of `elf_getdata()` and `elf_rawdata()` with
zero-sized ELF sections.

Obtained from: elftoolchain


221595 07-May-2011 kaiw

For zero-sized sections, set the `d_buf` field of the `Elf_Data`
descriptor returned by `elf_rawdata()` to NULL.

Obtained from: elftoolchain


221569 07-May-2011 obrien

Add the ability to search for all the inlined instances of a given function.

Reviewed by: jb
Obtained from: Juniper Networks


219210 02-Mar-2011 uqs

Fix some duplicate-word typos in manpages.

Submitted by: arundel
MFC after: 1 week


219126 01-Mar-2011 brucec

Remove duplicate "in".

Suggested by: Rob Farmer <rfarmer at predatorlabs.net>
MFC after: 3 days


219096 28-Feb-2011 brucec

Revert some of r177626. "in in" is valid in certain sentences.

PR: 121490
MFC after: 3 days


217833 25-Jan-2011 kan

Do not allocate buffer to hold data for zero-sized sections.


213573 08-Oct-2010 uqs

mdoc: drop redundant .Pp and .LP calls

They have no effect when coming in pairs, or before .Bl/.Bd


212373 09-Sep-2010 kaiw

libelf is overly strict about the type and alignment of Elf_Data
objects inside one ELF section, which prevents the creation of a ELF
section with mixed data types. For example, gcc LTO use libelf to
create a .gnu_lto_XXX section that contains integers and a string
table, which doesn't work with our libelf implementation.

The changes made in this commit include:
* Allow Elf_Data type to be different than section type.
* Relax Elf_Data alignment check.
* Align each Elf_Data by their own alignment instead of section alignment.

MFC after: 1 month


211577 21-Aug-2010 rpaulo

Don't link drti.o with libelf_pic.a. This means that all software with
userland SDT probes must be linked with libelf explicitly.

Requested by: kib
Sponsored by: The FreeBSD Foundation


211540 21-Aug-2010 rpaulo

Install a PIC libelf. This will be needed by the DTrace runtime
instrumentation object (dtri.o).

Sponsored by: The FreeBSD Foundation


211397 16-Aug-2010 joel

Fix typos, spelling, formatting and mdoc mistakes found by Nobuyuki while
translating these manual pages. Minor corrections by me.

Submitted by: Nobuyuki Koganemaru <n-kogane@syd.odn.ne.jp>


211192 11-Aug-2010 kaiw

Add translation support for section type SHT_SUNW_dof.

Submitted by: rpaulo
MFC after: 2 weeks


210823 03-Aug-2010 joel

Spelling fixes.


210559 28-Jul-2010 kaiw

Protect GNUHASH translation functions with #ifdef; unbreak cross
toolchain build.

Reported by: jchandra
MFC after: 1 month


210353 21-Jul-2010 kaiw

* Remove a superfluous error description.
* Document an additional error that may be returned: `ELF_E_ARCHIVE`.

Obtained from: elftoolchain
MFC after: 1 month


210352 21-Jul-2010 kaiw

Add a cross-reference to `elf_rawfile(3)`.

Obtained from: elftoolchain
MFC after: 1 month


210351 21-Jul-2010 kaiw

* Note that ar(1) archives may also be opened using `elf_memory(3)`.
* Ignore the passed in value of the `fd` argument for ar(1) archives
opened with elf_memory(3).

Obtained from: elftoolchain
MFC after: 1 month


210349 21-Jul-2010 kaiw

Remove a redundant word.

Obtained from: elftoolchain
MFC after: 1 month


210348 21-Jul-2010 kaiw

Move helper functions `_libelf_ar_get_{name,number,string}()` and
`_libelf_ar_open()` to a new compilation unit "libelf_ar_util.c"
to break the circular dependency between "elf_memory.o" and
"libelf_ar.o".

Obtained from: elftoolchain
MFC after: 1 month


210347 21-Jul-2010 kaiw

Fix a memory leak.

Obtained from: elftoolchain
MFC after: 1 month


210345 21-Jul-2010 kaiw

* Deprecate `elf_getshnum()`, `elf_getphnum()` and `elf_getshstrndx()` in
favour of `elf_getshdrnum()`, `elf_getphdrnum()` and `elf_getshdrstrndx()`
respectively.
* Add new manual pages for `elf_getshdrstrndx()`, `elf_getphdrnum()` and
`elf_getshdrnum()`.
* Add a deprecation warning for `elf_getshstrndx()`, `elf_getphnum()` and
`elf_getshnum()`.

Obtained from: elftoolchain
MFC after: 1 month


210344 21-Jul-2010 kaiw

Avoid switching between "unsigned char" and "char" in the C code
generated from "libelf_convert.m4".

Obtained from: elftoolchain
MFC after: 1 month


210341 21-Jul-2010 kaiw

Add support for translating sections of type ELF_T_GNUHASH.

Obtained from: elftoolchain
MFC after: 1 month


210340 21-Jul-2010 kaiw

- Document that the *fsize() functions return a size of 1 for Elf
types that don't have a fixed size.
- The *fsize() functions should return a size of 1, for variable length
types.
- Redefine symbol ELF_T_LAST to match the current end of the list.

Obtained from: elftoolchain
MFC after: 1 month


210338 21-Jul-2010 kaiw

Perform additional checks when translating between file and memory
representations of ELF types.

The ELF(3) API allows applications to request a conversion that is
`in-place', i.e., with source and destinations data buffers being
the same. However, the file and memory sizes of ELF sections that
have additional internal structure, such as those of type `Elf_Note',
or `Elf_GNU_Hash_Header', can be determined only known after the
type-specific headers that comprise the first few words in these
sections are read and translated.

Pass in the size of destination buffer to type translation routines
in "libelf_convert.m4" and have these routines return an error code
if the translated data would not fit inside the destination buffer.

Obtained from: elftoolchain
MFC after: 1 month


210336 21-Jul-2010 kaiw

Reduce verbosity.

Obtained from: elftoolchain
MFC after: 1 month


210335 21-Jul-2010 kaiw

- Return zero for file sizes of ELF types that have a variable size.
- Neaten a few comments.

Obtained from: elftoolchain
MFC after: 1 month


210333 21-Jul-2010 kaiw

Note that the *_fsize() functions are only defined for ELF types that
have a fixed size.

Obtained from: elftoolchain
MFC after: 1 month


210332 21-Jul-2010 kaiw

Changes for supporting GNU Hash sections.

Obtained from: elftoolchain
MFC after: 1 month


210331 21-Jul-2010 kaiw

Add a new ELF type denoting GNU style hash tables.

Obtained from: elftoolchain
MFC after: 1 month


210330 21-Jul-2010 kaiw

Allow an application that updates only the ELF Ehdr to work.

Obtained from: elftoolchain
MFC after: 1 month


210329 21-Jul-2010 kaiw

Use <unistd.h> to declare the prototype for ftruncate().

Obtained from: elftoolchain
MFC after: 1 month


210328 21-Jul-2010 kaiw

Bug fix: permit the creation of zero-sized sections.

Obtained from: elftoolchain
MFC after: 1 month


210326 21-Jul-2010 kaiw

Improve compatibility with other implementations of the ELF(3) API:
when an output file has no program headers, set the 'e_phentsize'
field of the ELF executable header to zero.

Obtained from: elftoolchain
MFC after: 1 month


210325 21-Jul-2010 kaiw

Bug fix: when updating headers using the gelf_update_*() functions,
the appropriate `dirty' bit needs to be set for both the Elf32 and
Elf64 case.

Obtained from: elftoolchain
MFC after: 1 month


210324 21-Jul-2010 kaiw

- Correctly handle sections of type SHT_NOBITS. For these sections:
- elf_getdata() and elf_rawdata() should return an "Elf_Data" structure
that has its "d_buf" member set to NULL and "d_size" member set to
the nominal 'size' of the section. [1]
- Update the manual page for these functions.
- Fix a memory leak in an error handling path inside elf_getdata().
- Use _libelf_allocate_data() in elf_newdata() for consistency.

Obtained from: elftoolchain
MFC after: 1 month


210321 21-Jul-2010 kaiw

Remove a superfluous comment.

Obtained from: elftoolchain
MFC after: 1 month


209122 13-Jun-2010 kaiw

* Improve compatibility with existing application code by permitting the
use of `elf_getbase()` on non-archive members. This change is needed
for gcc LTO (-flto) to work properly.
* Style fix: paranthesize returned values.
* Document the current behaviour of `elf_getbase()`.

Tested by: gerald, Steve Kargl (original patch)
Obtained from: elftoolchain
MFC after: 3 days


207942 11-May-2010 uqs

mdoc: fix parenthesis

Reviewed by: brueffer


206622 14-Apr-2010 uqs

mdoc: order prologue macros consistently by Dd/Dt/Os

Although groff_mdoc(7) gives another impression, this is the ordering
most widely used and also required by mdocml/mandoc.

Reviewed by: ru
Approved by: philip, ed (mentors)


202159 12-Jan-2010 brueffer

Remove useless .TE groff macro.

Submitted by: Joerg Sonnenberger
MFC after: 3 days


201381 02-Jan-2010 ed

Build lib/ with WARNS=6 by default.

Similar to libexec/, do the same with lib/. Make WARNS=6 the norm and
lower it when needed.

I'm setting WARNS?=0 for secure/. It seems secure/ includes the
Makefile.inc provided by lib/. I'm not going to touch that directory.
Most of the code there is contributed anyway.


189721 12-Mar-2009 obrien

Don't need to set symbol, default value is OK.


186758 05-Jan-2009 jkoshy

Add a README.


179241 23-May-2008 jb

Relax the strict type check because gcc as distributed doesn't create
debug strtabs with type SHT_STRTAB. Although we could change FreeBSD's
gcc, we really need to play nicely with gcc as distributed by the FSF.


179240 23-May-2008 jb

Change the alignment of the NOTE to match what gcc does.


179239 23-May-2008 jb

Add the case for SHT_AMD64_UNWIND.


177626 26-Mar-2008 brueffer

Fix some "in in" typos in comments.

PR: 121490
Submitted by: Anatoly Borodin <anatoly.borodin@gmail.com>
Approved by: rwatson (mentor), jkoshy
MFC after: 3 days


177367 19-Mar-2008 jkoshy

Ensure that the section header table is written out in an order
consistent with the section indices returned to the application by
elf_ndxscn().

Submitted by: kaiw


177366 19-Mar-2008 jkoshy

Clarify that the ELF library only sets the sh_entsize field of a
section header entry if the application is not taking charge of ELF
object layout.

Update (c) years, and bump the manual page's date.

Submitted by: kaiw


176758 03-Mar-2008 jkoshy

- Fix an off-by-one bug in _libelf_insert_section(). [1]
- Update (c) years.

Submitted by: kaiw [1]


176727 02-Mar-2008 jkoshy

Translate the r_info field of ELF relocation records when converting
between 64 and 32 bit variants.

Submitted by: kaiw


175973 04-Feb-2008 jkoshy

Document the return type for gelf_fsize(3).

Submitted by: kaiw


173924 26-Nov-2007 jkoshy

- Allow source descriptors with no data to be used as arguments to the
elf{32,64}_xlateto[fm]() translation functions. This change makes our
libelf compatible with other ELF(3) implementations. [1]
- Update manual page to reflect this change.
- Style fixes: wrap a long line.

Submitted by: jb [1]


173869 23-Nov-2007 jkoshy

Sections of type SHT_GNU_versym use ELF type ELF_T_HALF. Update manual
page and code to match.

Submitted by: jb
MFC After: 1 day


172861 22-Oct-2007 jkoshy

Consistently use the word 'flag' to refer to ELF_F_* constants.

MFC after: 1 day


172848 21-Oct-2007 jkoshy

Remove references to the 'e_phnum' field of the ELF header. Instead,
point the reader to the elf_getphnum() function.

MFC after: 1 day


172846 21-Oct-2007 jkoshy

Refer the reader to the elf_update(3) manual page for more information
on application control of ELF object layout.

MFC after: 1 day


172099 09-Sep-2007 jkoshy

Do not generate unneeded initializers.

Approved by: re (bmah)


172088 08-Sep-2007 jkoshy

Fix a bug that prevented applications from laying out ELF objects
with section header tables residing in between other sections.

Introduce additional checks for overlaps between section data and
the section header table when the application is performing section
layout.

Document additional error returns.

Reported by: Kai Wang <kaiw27 at gmail dot com>
Approved by: re (rwatson)


171641 28-Jul-2007 jkoshy

Cross-reference the correct manual page.

Approved by: re (bmah)


169092 29-Apr-2007 deischen

Use C comments since we now preprocess these files with CPP.


167932 27-Mar-2007 jkoshy

Describe the contents of the "ar_name" and "ar_rawname" fields of
Elf_Arhdr structures better.


167930 27-Mar-2007 jkoshy

Bug fixes to ar(1) archive handling:
- Correctly retrieve the initial (special) members of an archive after
an archive descriptor is rewound using elf_rand(SARMAG).
- Do not strip trailing white space from the 'raw' names retrieved
using elf_getarhdr().

Reported by: "Hyo geol, Lee" <hyogeollee at gmail dot com>


167901 26-Mar-2007 jkoshy

Document the return type of elf_rand(3) correctly.


167687 19-Mar-2007 jkoshy

Correct a typo.

Submitted by: Kai Wang <kaiw27 at gmail dot com>


167315 08-Mar-2007 jkoshy

Add GELF_* accessor macros.

Prodded by: Sam Arun Raj <samarunraj at gmail dot com>


167183 03-Mar-2007 jkoshy

Fix a typo.

Submitted by: Kai Wang <kaiw27 at gmail dot com>


166863 21-Feb-2007 dumbbell

Fix a bug with the release of section's raw data. Both release loops
were using translated data linked list, leading to a memory leak.

Jkoshy's testsuite was used to check for non-regression.


165536 25-Dec-2006 jkoshy

Document the additional error returns possible when handling ELF objects
that require extended numbering.


165535 25-Dec-2006 jkoshy

Keep shadow copies of the `e_shnum', `e_phnum' and `e_shstrndx'
members of the ELF Executable Header inside the library-private
`struct _Elf' descriptor and only update the underlying Elf{32,64}_Ehdr
structure on an elf_update(3) call. These fields of the Ehdr
structure are technically `out of bounds' for an application program
per the ELF(3) API, but we've seen applications that initialize
a new Ehdr structure using memcpy(), messing up the library's
invariants. [1]

Implement elf_getphnum() and handle ELF objects with more than
64K program header table entries.

Reported by: jb [1]


165534 25-Dec-2006 jkoshy

Use strncpy() instead of strlcpy() when copying members of
a `struct ar_hdr'. These members do not use NUL-termination
while strlcpy() expects its source buffer to be NUL-terminated.


165523 24-Dec-2006 jkoshy

Correct a logic error.


165317 18-Dec-2006 jkoshy

Use <osreldate.h> rather than the OS version reported by the kernel
to determine which Elf Types are to be handled. Change the M4
templates to wrap an `#if __FreeBSD_version >= NNN'/`#endif' pair
around the generated code for each ELF data type, where `NNN' is
the OS version where the ELF type was added to the source tree.

This change allows cross-builds of old sources on newer FreeBSD
systems to work correctly.

Problem reported by: ru


165316 18-Dec-2006 jkoshy

Use the correct value of __FreeBSD_version.


165283 16-Dec-2006 jkoshy

Fix a typo.


165178 13-Dec-2006 jkoshy

Name the functions documented by this manual page correctly.


165093 11-Dec-2006 jkoshy

Document the ELF types supported by libelf.

Document the relationship between section types (SHT_*) and the
types known to the libelf.


165032 09-Dec-2006 jkoshy

Make the generated message from `elf_errmsg(-1)' a little more readable.


164577 24-Nov-2006 ru

- style: use `=' instead of `+=' for initial assignments.

- don't add generated sources' objects to OBJS explicitly;
GENSRCS is part of SRCS so they were already in OBJS.


164253 13-Nov-2006 ru

Fix minor formatting issues:

- make document title match filename;
- remove hard sentence breaks, whitespace at EOL, and double whitespace;
- sort SEE ALSO xrefs, adding missing section numbers;
- fix a misspelled macro name.


164225 12-Nov-2006 jkoshy

- Replace the use of DPSRCS with something more appropriate. DPSRCS
is for when you need something in ".depend", but not compiled in.
- Style fixes: Spell ${.OBJDIR} as ".".
- Neaten a comment.

Submitted by: ru


164190 11-Nov-2006 jkoshy

MFP4: Add an implementation of the ELF(3) and GELF(3) API set.

Bump __FreeBSD_version.

Reviewed by: jb