PowerPC64 changes for xlc
authorAlan Modra <amodra@gmail.com>
Tue, 27 Jan 2015 13:10:05 +0000 (23:40 +1030)
committerAlan Modra <amodra@gmail.com>
Wed, 28 Jan 2015 08:00:54 +0000 (18:30 +1030)
commitdbd1e97e32057af2841e5150daa2e2d4cb046a3b
treead21bab1f655d821724de5eab738bd4016aff80d
parent3f8107ab38095bb3db840f9f14a0fd339f55e06e
PowerPC64 changes for xlc

The changes to reorder sections for better relro protection on powerpc64,
3e2b0f3123283c1b, and 5ad18f16, run into a problem with xlc.
xlc -qdatalocal puts global variables into .toc, which means that .toc
must be writable.  The simplest way to accomplish this is to edit the
linker script to remove .toc sections from .got on detecting xlc object
files.

bfd/
* elf64-ppc.h (struct ppc64_elf_params): Add "object_in_toc".
* elf64-ppc.c (ppc64_elf_add_symbol_hook): Assume that global symbols
in .toc indicate xlc compiled code that might require a rw .toc.
ld/
* emulparams/elf64ppc.sh (INITIAL_READWRITE_SECTIONS): Define.
* emultempl/ppc64elf.em (params): Init new field.
(ppc_after_open): New function.
(LDEMUL_AFTER_OPEN): Define.
* ldlang.c (lang_final): Whitespace fix.
ld/testsuite/
* ld-powerpc/tocvar.d, * ld-powerpc/tocvar.s: New test.
* ld-powerpc/tocnovar.d, * ld-powerpc/tocnovar.s: New test.
* ld-powerpc/powerpc.exp: Run tocvar and tocnovar.
13 files changed:
bfd/ChangeLog
bfd/elf64-ppc.c
bfd/elf64-ppc.h
ld/ChangeLog
ld/emulparams/elf64ppc.sh
ld/emultempl/ppc64elf.em
ld/ldlang.c
ld/testsuite/ChangeLog
ld/testsuite/ld-powerpc/powerpc.exp
ld/testsuite/ld-powerpc/tocnovar.d [new file with mode: 0644]
ld/testsuite/ld-powerpc/tocnovar.s [new file with mode: 0644]
ld/testsuite/ld-powerpc/tocvar.d [new file with mode: 0644]
ld/testsuite/ld-powerpc/tocvar.s [new file with mode: 0644]