[PATCH]: force IFUNC symbols emit relocation
Rafael EspĂndola
rafael.espindola at gmail.com
Wed Jan 8 10:53:20 PST 2014
On 7 January 2014 15:41, Roman Divacky <rdivacky at freebsd.org> wrote:
> 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?
Yes, LGTM with a .s testcase.
Cheers,
Rafael
More information about the llvm-commits
mailing list