Bug 21294 - Binary size regression on PPC embedded (COMMONPAGESIZE 64k)
Summary: Binary size regression on PPC embedded (COMMONPAGESIZE 64k)
Status: RESOLVED WONTFIX
Alias: None
Product: binutils
Classification: Unclassified
Component: ld (show other bugs)
Version: 2.27
: P2 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-03-23 08:14 UTC by Floessie
Modified: 2017-10-20 00:59 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Floessie 2017-03-23 08:14:36 UTC
Hello,

Since updating our toolchains for PPC 405, e300c3, and e500v2 we experience a massive size increase for small binaries. Our 405 target has very small storage, and as the rootfs contains a lot of small binaries, we can't supply images linked with binutils 2.27 or 2.28 anymore.

I filed a bug over at crosstool-ng [1] to get some help, and Alexey Neyman was kind enough to give me a hint to COMMONPAGESIZE. Doing some research, I found out that it was raised from 4k to 64k in 2014 [2]. You discussed about the impact on embedded, but it wasn't considered as an obstacle. Maybe that should be reconsidered.

Is it possible to treat embedded, size constrained targets differently than servers? There's a special 4k COMMONPAGESIZE for __QNXTARGET__. Or would it be possible to add a configure option for this? Or is there already another mechanism to alter COMMONPAGESIZE?

Kind regards,
Flössie

[1] https://github.com/crosstool-ng/crosstool-ng/issues/656
[2] https://sourceware.org/ml/binutils/2014-12/msg00165.html
Comment 1 Alan Modra 2017-10-03 04:10:17 UTC
I think the size change is because ld 2.27 and later defaults to -z relro for linux targets.  Making COMMONPAGESIZE equal to MAXPAGESIZE usually *decreases* disk size (at the expense of memory size).

Try configuring with --disable-relro
Comment 2 Sourceware Commits 2017-10-03 04:43:15 UTC
The master branch has been updated by Alan Modra <amodra@sourceware.org>:

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

commit 9194f82dc372d5045ae06c617a49a5a9b17c1d24
Author: Alan Modra <amodra@gmail.com>
Date:   Tue Oct 3 15:10:28 2017 +1030

    PR21294, Binary size regression on PPC embedded
    
    	PR 21294
    	* NEWS: Note that defaulting to -z relro results in increased
    	memory and disk size.
Comment 3 Alan Modra 2017-10-20 00:59:02 UTC
I should note here for future reference that a common-page-size configure option has a difficulty:  What exactly would it mean when ld supports multiple targets?  Should *all* targets use the given page size, or just the default target?  It's likely that neither of those two possible implementations would please everybody..