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]$
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.
Fixed for 2.26 by: https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=6c1aca3e2d408ef4874bd882a7f0e2cd944bbf09
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.
The master branch has been updated by Alan Modra <amodra@sourceware.org>: https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=31b4d3a16f200bf04db8439a63b72bba7af4e1be commit 31b4d3a16f200bf04db8439a63b72bba7af4e1be Author: Alan Modra <amodra@gmail.com> Date: Thu Feb 3 08:57:47 2022 +1030 PR28824, relro security issues, x86 keep COMMONPAGESIZE relro x86 treats MAXPAGESIZE as a memory optimisation parameter, actual hardware paging is always COMMPAGESIZE of 4k. Use COMMONPAGESIZE for the end of the relro segment alignment. The previous patch regresses pr18176, increasing the testcase file size from 322208 to 2099872 bytes. Fixing this on x86 will require introducing a gap after the end of the relro segment (of up to relropagesize-1 bytes). PR 28824 PR 18176 * ld.h (ld_config_type): Add relro_use_commonpagesize field. * ldexp.c (fold_segment_align): Set relropagesize depending on relro_use_commonpagesize. * emultempl/elf-x86.em (elf_x86_create_output_section_statements): Set relro_use_commonpagesize. * testsuite/ld-x86-64/pr18176.d: xfail.