[PATCH]: force IFUNC symbols emit relocation
Roman Divacky
rdivacky at freebsd.org
Tue Jan 7 12:41:28 PST 2014
IFUNC symbols currently are resolved and thus the IFUNC functionality
doesnt work. This simple patch forces emission of a relocation to
IFUNC symbols, and that makes it work.
Index: lib/MC/ELFObjectWriter.cpp
===================================================================
--- lib/MC/ELFObjectWriter.cpp (revision 198706)
+++ lib/MC/ELFObjectWriter.cpp (working copy)
@@ -1645,7 +1645,7 @@
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);
Ie. this example http://rys.vlakno.cz/~rdivacky/agner-ifunc.cpp now works.
Do you think it's the right approach?
Thanks, Roman
More information about the llvm-commits
mailing list