History log of /freebsd-current/contrib/elftoolchain/elfcopy/segments.c
Revision Date Author Comments
# 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


# 30568ad3 15-Dec-2014 Ed Maste <emaste@FreeBSD.org>

Correct elftoolchain strip(1) memory size calculation

Calculate the segment's memory size (p_memsz) using the virtual
addresses, not the file offsets. Otherwise padding preceeding SHT_NOBITS
sections may be excluded from the calculation, resulting in a segment
that is too small.

PR: 195653
Sponsored by: The FreeBSD Foundation


# 50f69bfb 01-Dec-2014 Ed Maste <emaste@FreeBSD.org>

Fix elftoolchain tools in-tree build

* make variables static
* add header for uint*_t typedefs