Enhance powerpc ld -r --relax
authorAlan Modra <amodra@gmail.com>
Wed, 25 Jul 2018 05:54:55 +0000 (15:24 +0930)
committerAlan Modra <amodra@gmail.com>
Wed, 25 Jul 2018 07:22:58 +0000 (16:52 +0930)
commit491993044ba6cfb2b0fc93c8b3032d5c91cccda5
treeef399640acd0e20d9bd6f165015a882f66f0faad
parentbe3e27bb5554e45d54d7cdc74353dda246239475
Enhance powerpc ld -r --relax

One of the ill effects of ld -r is to mash together sections.  That
can result in reduced icache performance at runtime due to unexpected
movement of code.  Another problem is that sections can become too
large to link on targets that have limited relative addressing.  ld -r
--relax attempts to overcome the large section problem for branches by
inserting trampolines, but the powerpc support added lots of
unnecessary trampolines.  This patch trims them somewhat.

bfd/
* elf32-ppc.c (ppc_elf_relax_section): Ignore common or undef locals.
Avoid trashing toff with added when used as a symbol index.
Ignore R_PPC_PLTREL24 addends in unused example code.  Avoid
creating unnecessary fixups when relocatable.
ld/
* testsuite/ld-powerpc/big.s: New file.
* testsuite/ld-powerpc/relaxrl.d: New test.
* testsuite/ld-powerpc/powerpc.exp: Run new test.
* testsuite/ld-powerpc/relaxr.d: Adjust.
bfd/ChangeLog
bfd/elf32-ppc.c
ld/ChangeLog
ld/testsuite/ld-powerpc/big.s [new file with mode: 0644]
ld/testsuite/ld-powerpc/powerpc.exp
ld/testsuite/ld-powerpc/relaxr.d
ld/testsuite/ld-powerpc/relaxrl.d [new file with mode: 0644]