mirror of
https://sourceware.org/git/binutils-gdb.git
synced 2024-12-21 04:42:53 +08:00
702d167134
max-page-size only matters for demand paged executables or shared
libraries, and the ideal size is the largest value used by your
operating system. Values larger than necessary just waste file space
and memory. common-page-size also affects file and memory size,
trading a possible small increase in file size for a decrease in
memory size when the operating system is using a common-page-size
page. With a powerpc max-page-size of 64k and common-page-size of 4k
many executables will use no more memory pages when the system page
size is 4k than an executable linked with -z max-page-size=0x1000,
yet will still run on a system using 64k pages. However, when running
on a system using 64k pages relro protection will not be completely
effective.
Due to the relro problem, powerpc binutils has been using a default
common-page-size of 64k since 2014-12-18 (git commit 04c6a44c7
),
leading to complaints about increased file and memory sizes. People
not using relro do have a valid reason to complain..
So this patch introduces an extra back-end value to use as the default
for common-page-size when generating relro executables, and enables
the support for powerpc. Non relro executables will now be generated
with a default common-page-size of 4k.
bfd/
* elf-bfd.h (struct elf_backend_data): Add relropagesize.
* elfxx-target.h (ELF_RELROPAGESIZE): Provide default and
sanity test.
(elfNN_bed): Init relropagesize.
* bfd.c (bfd_emul_get_commonpagesize): Add boolean param to
select relropagesize.
* elf32-ppc.c (ELF_COMMONPAGESIZE): Define as 0x1000.
(ELF_RELROPAGESIZE): Define as ELF_MAXPAGESIZE.
(ELF_MINPAGESIZE): Don't define.
* elf64-ppc.c (ELF_COMMONPAGESIZE): Define as 0x1000.
(ELF_RELROPAGESIZE): Define as ELF_MAXPAGESIZE.
* bfd-in2.h: Regenerate.
ld/
* ldmain.c (main): Move config.maxpagesize and
config.commonpagesize initialization to..
* ldemul.c (after_parse_default): ..here.
* testsuite/ld-powerpc/ppc476-shared.d: Pass -z common-page-size.
* testsuite/ld-powerpc/ppc476-shared2.d: Likewise.
49 lines
1.9 KiB
Makefile
49 lines
1.9 KiB
Makefile
#source: ppc476-shared.s
|
|
#as: -a32
|
|
#ld: -melf32ppc -q -shared -z common-page-size=0x10000 --ppc476-workaround -T ppc476-shared.lnk
|
|
#objdump: -dr
|
|
#target: powerpc*-*-*
|
|
|
|
.*: file format .*
|
|
|
|
Disassembly of section \.text:
|
|
|
|
0000fffc <\.text>:
|
|
fffc: (48 03 00 04|04 00 03 48) b 40000 .*
|
|
10000: (38 63 00 00|00 00 63 38) addi r3,r3,0
|
|
1000[02]: R_PPC_ADDR16_LO \.bss
|
|
\.\.\.
|
|
1fffc: (48 02 00 14|14 00 02 48) b 40010 .*
|
|
20000: (38 63 00 00|00 00 63 38) addi r3,r3,0
|
|
2000[02]: R_PPC_ADDR16_LO \.bss
|
|
\.\.\.
|
|
2fffc: (48 01 00 24|24 00 01 48) b 40020 .*
|
|
30000: (38 63 00 00|00 00 63 38) addi r3,r3,0
|
|
3000[02]: R_PPC_ADDR16_LO \.bss
|
|
\.\.\.
|
|
3fff0: (42 9f 00 05|05 00 9f 42) bcl .*
|
|
3fff4: (7d 28 02 a6|a6 02 28 7d) mflr r9
|
|
3fff8: (3d 29 00 01|01 00 29 3d) addis r9,r9,1
|
|
3fff[8a]: R_PPC_REL16_HA \.bss\+0x[46]
|
|
3fffc: (48 00 00 34|34 00 00 48) b 40030 .*
|
|
40000: (3c 60 00 00|00 00 60 3c) lis r3,0
|
|
4000[02]: R_PPC_ADDR16_HA \.bss
|
|
40004: (4b fc ff fc|fc ff fc 4b) b 10000 .*
|
|
40008: (48 00 00 02|02 00 00 48) ba 0 .*
|
|
4000c: (48 00 00 02|02 00 00 48) ba 0 .*
|
|
40010: (3c 60 00 00|00 00 60 3c) lis r3,0
|
|
4001[02]: R_PPC_ADDR16_HA \.bss
|
|
40014: (4b fd ff ec|ec ff fd 4b) b 20000 .*
|
|
40018: (48 00 00 02|02 00 00 48) ba 0 .*
|
|
4001c: (48 00 00 02|02 00 00 48) ba 0 .*
|
|
40020: (3c 60 00 00|00 00 60 3c) lis r3,0
|
|
4002[02]: R_PPC_ADDR16_HA \.bss
|
|
40024: (4b fe ff dc|dc ff fe 4b) b 30000 .*
|
|
40028: (48 00 00 02|02 00 00 48) ba 0 .*
|
|
4002c: (48 00 00 02|02 00 00 48) ba 0 .*
|
|
40030: (39 29 00 0c|0c 00 29 39) addi r9,r9,12
|
|
4003[02]: R_PPC_REL16_LO \.bss\+0x3[ce]
|
|
40034: (4b ff ff cc|cc ff ff 4b) b 40000 .*
|
|
40038: (48 00 00 02|02 00 00 48) ba 0 .*
|
|
4003c: (48 00 00 02|02 00 00 48) ba 0 .*
|