History log of /freebsd-current/contrib/elftoolchain/elfcopy/elfcopy.h
Revision Date Author Comments
# 5ac70383 15-Feb-2021 Chris Rees <crees@FreeBSD.org>

elftoolchain: stop leaving tempfiles on error

Temporary files were not cleaned up, resulting in $TMPDIR or even
the current directory becoming littered with ecp.* files.

This happened with error and even sometimes on success!

Approved by: dim
MFC after: 4 weeks
Accepted upstream: https://sourceforge.net/p/elftoolchain/code/3918/
Differential Revision: https://reviews.freebsd.org/D28651


# 1e4896b1 18-Nov-2020 Dimitry Andric <dim@FreeBSD.org>

When elftoolchain's objcopy (or strip) is rewriting a file in-place,
make it create the temporary file in the same directory as the source
file by default, instead of always using $TMPDIR or /tmp. If creating
that file fails because the directory is not writable, also fallback to
$TMPDIR or /tmp.

This has also been submitted upstream as:
https://sourceforge.net/p/elftoolchain/tickets/597/

Reported by: cem
PR: 250872
MFC after: 2 weeks


# bc589b72 04-Jun-2019 Mark Johnston <markj@FreeBSD.org>

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
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D20473


# 02816870 30-May-2019 Mark Johnston <markj@FreeBSD.org>

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
MFC after: 1 week
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D20444


# 48d41ef0 13-May-2018 Phil Shafer <phil@FreeBSD.org>

Handle thread-local storage (TLS) segments correctly when
copying (objcopy) and displaying (readelf) them.

PR: 227552
Submitted by: kaiw (maintainer)
Reported by: jachmann@unitix.org
Reviewed by: phil
MFC after: 1 day


# 676e25ab 24-Mar-2016 Ed Maste <emaste@FreeBSD.org>

elfcopy: overhaul of LMA handling

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