PPC64: Constant initializers with dynamic relocations go in .data.rel.ro.
authorBill Schmidt <wschmidt@linux.vnet.ibm.com>
Mon, 13 May 2013 19:34:37 +0000 (19:34 +0000)
committerBill Schmidt <wschmidt@linux.vnet.ibm.com>
Mon, 13 May 2013 19:34:37 +0000 (19:34 +0000)
commit240b9b6078cdf8048945107b4ff7d517729dab96
tree46ede5378ba9cddb219e4af0b52b71ffbcc4e637
parenta753ff72b2dfcd9c09451a124373e0a8ed1a1d47
PPC64: Constant initializers with dynamic relocations go in .data.rel.ro.

This fixes warning messages observed in the oggenc application test in
projects/test-suite.  Special handling is needed for the 64-bit
PowerPC SVR4 ABI when a constant is initialized with a pointer to a
function in a shared library.  Because a function address is
implemented as the address of a function descriptor, the use of copy
relocations can lead to problems with initialization.  GNU ld
therefore replaces copy relocations with dynamic relocations to be
resolved by the dynamic linker.  This means the constant cannot reside
in the read-only data section, but instead belongs in .data.rel.ro,
which is designed for constants containing dynamic relocations.

The implementation creates a class PPC64LinuxTargetObjectFile
inheriting from TargetLoweringObjectFileELF, which behaves like its
parent except to place constants of this sort into .data.rel.ro.

The test case is reduced from the oggenc application.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@181723 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Target/PowerPC/CMakeLists.txt
lib/Target/PowerPC/PPCISelLowering.cpp
lib/Target/PowerPC/PPCTargetObjectFile.cpp [new file with mode: 0644]
lib/Target/PowerPC/PPCTargetObjectFile.h [new file with mode: 0644]
test/CodeGen/PowerPC/addrfuncstr.ll [new file with mode: 0644]