Bug 18176 - Large file size due to padding for PT_GNU_RELRO segment
Summary: Large file size due to padding for PT_GNU_RELRO segment
Status: RESOLVED FIXED
Alias: None
Product: binutils
Classification: Unclassified
Component: ld (show other bugs)
Version: 2.26
: P2 normal
Target Milestone: 2.26
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-03-29 03:17 UTC by H.J. Lu
Modified: 2015-04-07 13:53 UTC (History)
0 users

See Also:
Host:
Target: x86_64-pc-linux-gnu
Build:
Last reconfirmed:


Attachments
A testcase (1.55 KB, application/x-xz)
2015-03-29 03:17 UTC, H.J. Lu
Details

Note You need to log in before you can comment on or make changes to this bug.
Description H.J. Lu 2015-03-29 03:17:41 UTC
Created attachment 8215 [details]
A testcase

When a padding in file is used to align PT_GNU_RELRO segment, the maximum
padding size is maximum page size minus 1, which may lead to large file
size:

[hjl@gnu-tools-1 relro]$ make
as   -o x.o x.s
./ld -z relro -T ld.t -z max-page-size=0x200000 -z common-page-size=0x1000 -shared -o x.so x.o
ls -l x.so
-rwxrwxr-x 1 hjl hjl 2419808 Mar 28 20:17 x.so
[hjl@gnu-tools-1 relro]$
Comment 1 cvs-commit@gcc.gnu.org 2015-04-01 11:25:49 UTC
The master branch has been updated by H.J. Lu <hjl@sourceware.org>:

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

commit 875b5b9d147d37c99a189aa95354f9bebdd64ef5
Author: H.J. Lu <hjl.tools@gmail.com>
Date:   Wed Apr 1 04:24:05 2015 -0700

    Add a testcase for PR ld/18176
    
    	PR ld/18176
    	* ld-x86-64/pr18176.d: New file.
    	* ld-x86-64/pr18176.s: Likewise.
    	* ld-x86-64/pr18176.t: Likewise.
    	* ld-x86-64/x86-64.exp: Run pr18176.
Comment 3 cvs-commit@gcc.gnu.org 2015-04-07 13:53:21 UTC
The master branch has been updated by Alan Modra <amodra@sourceware.org>:

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

commit 0fad6e4b94e754e26e904bab074bf6c94d825711
Author: Alan Modra <amodra@gmail.com>
Date:   Tue Apr 7 10:39:59 2015 +0930

    Cast shift expression
    
    	PR ld/18176
    	* ldlang.c (lang_size_sections): Cast shift expression.