Created attachment 8708 [details] use file_ptr for seek position in elf files Build of chrome fails on arm-linux-gnueabi plaftorm with error from strip: strip:debian/chromium/usr/lib/chromium/chromium: File truncated objcopy, objdump etc all fail same way. This is because the binary is over 2GB and libbfd uses a signed 32bit variable for passing seek locations: bfd_signed_vma where = i_ehdrp->e_shoff; The minimal fix is s/bfd_signed_vma/bfd_vma/ but considering "where" is only ever used as input for bfd_seek, and bfd_seek is defined as: bfd_seek (bfd *abfd, file_ptr position, int direction) Using file_ptr directly saves from some casts and makes some checks pointless. Attached patch that fixes that does it, and fixes chrome build for me. objdump, strip and objcopy handle the +2GB binary now fine. Patch is against 2.25.1 from Debian
The master branch has been updated by Nick Clifton <nickc@sourceware.org>: https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=b32a5c16f100c53fd9c0c22464f863eeeec6087a commit b32a5c16f100c53fd9c0c22464f863eeeec6087a Author: Riku Voipio <riku.voipio@iki.fi> Date: Thu Oct 15 12:56:55 2015 +0100 Use the file_ptr type when calling bfd_seek. PR ld/19123 * elfcore.h (elf_core_file_p): Use the file_ptr type to hold the offset for bfd_seek. * elfcode.h (elf_object_p): Likewise.
Hi Riku, > use file_ptr for seek position in elf files Thanks very much for this patch. I have checked it in along with this changelog entry. Please let us know if you encounter any other problems like this. Cheers Nick bfd/ChangeLog 2015-10-15 Riku Voipio <riku.voipio@iki.fi> PR ld/19123 * elfcore.h (elf_core_file_p): Use the file_ptr type to hold the offset for bfd_seek. * elfcode.h (elf_object_p): Likewise.