This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] S/390: STT_GNU_IFUNC support


On 07/03/2012 12:52 PM, Andreas Jaeger wrote:
> On Tuesday, July 03, 2012 12:19:44 Andreas Krebbel wrote:
>> On 07/02/2012 04:21 PM, Andreas Jaeger wrote:
>>> On Monday, July 02, 2012 15:52:49 Andreas Krebbel wrote:
>>>> On Mon, Jul 02, 2012 at 03:20:30PM +0200, Andreas Jaeger wrote:
>>>>> So, do you want to add a configure test and only enable the IFUNC
>>>>> support with new binutils? Or how do you want to handle the
>>>>> requirement?
>>>>
>>>> I'll add a configure check when it is clear which Binutils version
>>>> will include the support.
>>>
>>> I suggest to check for the feature, not for the version, the
>>> configure file already has support for this, so this might be
>>> enough:
>>> AC_CACHE_CHECK([for assembler gnu_indirect_function symbol type
>>> support],
>>>
>>>                libc_cv_asm_gnu_indirect_function, [dnl
>>>
>>> cat > conftest.s <<EOF
>>> .type foo,%gnu_indirect_function
>>> EOF
>>> if ${CC-cc} -c $ASFLAGS conftest.s 1>&AS_MESSAGE_LOG_FD
>>> 2>&AS_MESSAGE_LOG_FD;
>>> then
>>>
>>>   libc_cv_asm_gnu_indirect_function=yes
>>>
>>> else
>>>
>>>   libc_cv_asm_gnu_indirect_function=no
>>>
>>> fi
>>> rm -f conftest*])
>>
>> This only checks whether the assembler supports gnu_indirect_function
>> as symbol type not whether the linker actually handles IFUNC symbols
>> for the target.
> 
> In that case, I suggest to enhance the configure check with a linker test 
> as well,

Sure. But as I understand it's not thaaat easy. Older LDs will not complain about IFUNC
symbols. In fact the IFUNC symbol will even make it into the resulting binary without
anybody complaining. The only thing I could come up with is building a small program like
this:

void foo ();
void foo_resolver () {}

asm (".globl foo\n\t"
     ".type  foo,@gnu_indirect_function\n\t"
     ".set   foo,foo_resolver\n");

int main () { foo (); return 0; }

and then check the `readelf -r` output for `IREL`. s390 and x86 will generate an
*_IRELATIVE reloc, others (e.g. Power) probably come up with _JMP_IREL.

However, that looks fragile to me. Any better ideas?

-Andreas-


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]