elfcopy: overhaul of LMA handling
commitd86d00c49d0664a44979e01041bef7bdf5624fd6
authoremaste <emaste@FreeBSD.org>
Thu, 24 Mar 2016 20:13:17 +0000 (24 20:13 +0000)
committeremaste <emaste@FreeBSD.org>
Thu, 24 Mar 2016 20:13:17 +0000 (24 20:13 +0000)
tree7b796341741062251d396eff2194558bd9ffdd7c
parentfa5cb70a2d7e615f386e5cd26d5e0de7cd9740ae
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
contrib/elftoolchain/elfcopy/elfcopy.h
contrib/elftoolchain/elfcopy/segments.c