[llvm] r198780 - Force emit a relocation for @gnu_indirect_function symbols so that the indirect
Roman Divacky
rdivacky at freebsd.org
Wed Jan 8 10:50:32 PST 2014
Author: rdivacky
Date: Wed Jan 8 12:50:32 2014
New Revision: 198780
URL: http://llvm.org/viewvc/llvm-project?rev=198780&view=rev
Log:
Force emit a relocation for @gnu_indirect_function symbols so that the indirect
resolution works.
Added:
llvm/trunk/test/MC/ELF/ifunc-reloc.s
Modified:
llvm/trunk/lib/MC/ELFObjectWriter.cpp
Modified: llvm/trunk/lib/MC/ELFObjectWriter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/ELFObjectWriter.cpp?rev=198780&r1=198779&r2=198780&view=diff
==============================================================================
--- llvm/trunk/lib/MC/ELFObjectWriter.cpp (original)
+++ llvm/trunk/lib/MC/ELFObjectWriter.cpp Wed Jan 8 12:50:32 2014
@@ -1645,7 +1645,7 @@ ELFObjectWriter::IsSymbolRefDifferenceFu
const MCFragment &FB,
bool InSet,
bool IsPCRel) const {
- if (DataA.getFlags() & ELF_STB_Weak)
+ if (DataA.getFlags() & ELF_STB_Weak || MCELF::GetType(DataA) == ELF::STT_GNU_IFUNC)
return false;
return MCObjectWriter::IsSymbolRefDifferenceFullyResolvedImpl(
Asm, DataA, FB,InSet, IsPCRel);
Added: llvm/trunk/test/MC/ELF/ifunc-reloc.s
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/ELF/ifunc-reloc.s?rev=198780&view=auto
==============================================================================
--- llvm/trunk/test/MC/ELF/ifunc-reloc.s (added)
+++ llvm/trunk/test/MC/ELF/ifunc-reloc.s Wed Jan 8 12:50:32 2014
@@ -0,0 +1,16 @@
+// RUN: llvm-mc -filetype=obj -triple x86_64-pc-linux-gnu %s -o - | llvm-readobj -r | FileCheck %s
+ .global sym
+ .type sym, @gnu_indirect_function
+alias:
+ .global alias
+ .type alias, @function
+ .set sym, alias
+
+
+ callq sym
+
+// CHECK: Relocations [
+// CHECK-NEXT: Section (2) .rela.text {
+// CHECK-NEXT: 0x1 R_X86_64_PC32 sym 0xFFFFFFFFFFFFFFFC
+// CHECK-NEXT: }
+// CHECK-NEXT: ]
More information about the llvm-commits
mailing list