Bug 20531 - [Regression/2.27]: Not enough room for program headers, try linking with -N
Summary: [Regression/2.27]: Not enough room for program headers, try linking with -N
Status: RESOLVED FIXED
Alias: None
Product: binutils
Classification: Unclassified
Component: ld (show other bugs)
Version: 2.27
: P2 normal
Target Milestone: ---
Assignee: Alan Modra
URL: https://buildd.debian.org/status/fetc...
Keywords:
Depends on:
Blocks:
 
Reported: 2016-08-29 06:06 UTC by John Paul Adrian Glaubitz
Modified: 2016-08-30 11:44 UTC (History)
2 users (show)

See Also:
Host:
Target: powerpc-linux-gnuspe
Build:
Last reconfirmed: 2016-08-30 00:00:00


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description John Paul Adrian Glaubitz 2016-08-29 06:06:51 UTC
After upgrading binutils to 2.27 on the powerpcspe buildds in Debian, running the strip command fails with:

(sid2-powerpcspe-sbuild)root@atlantis:/build/tcpdump-t4oxHH/tcpdump-4.7.4# strip --remove-section=.comment --remove-section=.note debian/tcpdump/usr/sbin/tcpdump
strip: debian/tcpdump/usr/sbin/stMmiNLY: Not enough room for program headers, try linking with -N
strip:debian/tcpdump/usr/sbin/stMmiNLY[.interp]: Bad value
(sid2-powerpcspe-sbuild)root@atlantis:/build/tcpdump-t4oxHH/tcpdump-4.7.4

This problem is immediately resolved by downgrading binutils to 2.26.1 and rebuilding the package.

The full build root for the test package tcpdump can be found in [1]. The full build log in [2].

Adrian

> [1] https://people.debian.org/~glaubitz/tcpdump_ppcspe_debug.tgz
> [2] https://buildd.debian.org/status/fetch.php?pkg=tcpdump&arch=powerpcspe&ver=4.7.4-2&stamp=1472415288
Comment 1 John Paul Adrian Glaubitz 2016-08-29 06:08:50 UTC
James Clarke (CC'ed) suggested this might be related to the following change [1]:

> Use size_t rather than bfd_size_type
> 
> I noticed when writing _bfd_elf_strtab_save/restore that size_t would
> be better than bfd_size_type for a number of things in elf-strtab.c.
> Using a 64-bit bfd_size_type on a 32-bit host doesn't make much sense
> for array sizes and indices.

> [1] https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;a=commit;h=ef53be89160126f2fa5dec8f1ec3bd6d99fb0681
Comment 2 Alan Modra 2016-08-30 10:00:11 UTC
I could not reproduce this problem using FSF binutils-2.27 or current git master source.  I built both 32-bit and 64-bit binutils binaries to test the assertion that the size_t change was at fault.  strip ran fine on tcpdump-t4oxHH/tcpdump-4.7.4/tcpdump from [1], producing the same binary as tcpdump-t4oxHH/tcpdump-4.7.4/debian/tcpdump/usr/sbin/tcpdump without reporting any errors.
Comment 3 John Paul Adrian Glaubitz 2016-08-30 10:20:47 UTC
(In reply to Alan Modra from comment #2)
> strip ran fine on tcpdump-t4oxHH/tcpdump-4.7.4/tcpdump from [1], producing the
> same binary as tcpdump-t4oxHH/tcpdump-4.7.4/debian/tcpdump/usr/sbin/tcpdump
> without reporting any errors.

Can you try running strip on debian/tcpdump/usr/sbin/tcpdump?

From the output of Debian's dh_strip:

(sid2-powerpcspe-sbuild)root@atlantis:/build/tcpdump-t4oxHH/tcpdump-4.7.4# dh_strip
strip: debian/tcpdump/usr/sbin/stefyAvQ: Not enough room for program headers, try linking with -N
strip:debian/tcpdump/usr/sbin/stefyAvQ[.interp]: Bad value
dh_strip: strip --remove-section=.comment --remove-section=.note debian/tcpdump/usr/sbin/tcpdump returned exit code 1
(sid2-powerpcspe-sbuild)root@atlantis:/build/tcpdump-t4oxHH/tcpdump-4.7.4#
Comment 4 Alan Modra 2016-08-30 10:36:05 UTC
Confirmed.  Running strip again on the already-stripped binary reports an error.
Comment 5 Alan Modra 2016-08-30 11:26:02 UTC
It's a missing "break".
Comment 6 John Paul Adrian Glaubitz 2016-08-30 11:27:22 UTC
(In reply to Alan Modra from comment #5)
> It's a missing "break".

Awesome, that was quick. Thanks a lot!

When fixing it, please don't forget the backport to the 2.27 branch so it will be picked up by Debian with the next update of the binutils package.
Comment 7 Sourceware Commits 2016-08-30 11:37:52 UTC
The master branch has been updated by Alan Modra <amodra@sourceware.org>:

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=8941017bc0226b60ce306d5271df15820ce66a53

commit 8941017bc0226b60ce306d5271df15820ce66a53
Author: Alan Modra <amodra@gmail.com>
Date:   Tue Aug 30 20:57:32 2016 +0930

    ppc apuinfo for spe parsed incorrectly
    
    apuinfo saying SPE resulted in mach = bfd_mach_ppc_vle due to a
    missing break.
    
    	PR 20531
    	* elf32-ppc.c (_bfd_elf_ppc_set_arch): Add missing "break".
Comment 8 Sourceware Commits 2016-08-30 11:42:37 UTC
The binutils-2_27-branch branch has been updated by Alan Modra <amodra@sourceware.org>:

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=2a0b8eb7a7974ff7605cb3ba5dffa5abef286ffa

commit 2a0b8eb7a7974ff7605cb3ba5dffa5abef286ffa
Author: Alan Modra <amodra@gmail.com>
Date:   Tue Aug 30 20:57:32 2016 +0930

    ppc apuinfo for spe parsed incorrectly
    
    apuinfo saying SPE resulted in mach = bfd_mach_ppc_vle due to a
    missing break.
    
    	PR 20531
    	* elf32-ppc.c (_bfd_elf_ppc_set_arch): Add missing "break".
Comment 9 Alan Modra 2016-08-30 11:44:50 UTC
Fixed.  Note that the output of the first strip is broken, with SHF_PPC_VLE incorrectly being added to executable sections.