Gmail Calendar Documents Reader Web more »
Recently Visited Groups | Help | Sign in
Google Groups Home
Proposal for STT_GNU_IFUNC and R_*_IRELATIVE
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  Messages 26 - 46 of 46 - Collapse all  -  Translate all to Translated (View all originals) < Older 
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post will appear after it is approved by moderators
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Ulrich Drepper  
View profile  
 More options May 28, 10:28 am
From: Ulrich Drepper <drep...@redhat.com>
Date: Thu, 28 May 2009 07:28:07 -0700
Local: Thurs, May 28 2009 10:28 am
Subject: Re: Proposal for STT_GNU_IFUNC and R_*_IRELATIVE
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

H.J. Lu wrote:
> for static executables. It is called from elf-init.c. How can I
> report a bad relocation safetly?

[I assume you meant dl-init.c.]

And for sake of reducing strange effects: it would be best to to handle
this a bit different.  Implicitly relying on the programmer having a
newer glibc installed which using ifunc can cause problems.  If,
instead, you write a new code fragment which is placed into the .init
section (provided by the linker whenever ifunc symbols are used in
statically linked code), then this new init function could reference a
function in libc which doesn't exist in older versions.

- --
➧ Ulrich Drepper ➧ Red Hat, Inc. ➧ 444 Castro St ➧ Mountain View, CA ❖
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)

iEYEARECAAYFAkoen3cACgkQ2ijCOnn/RHRmOgCeM6xpmcY3WEqxU28YbzSWDWB8
hf4AniMyukXNOgaxZXkztBVWBPVDi5oH
=Y9Gf
-----END PGP SIGNATURE-----


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
H.J. Lu  
View profile  
 More options May 28, 10:38 am
From: "H.J. Lu" <hjl.to...@gmail.com>
Date: Thu, 28 May 2009 07:38:56 -0700
Local: Thurs, May 28 2009 10:38 am
Subject: Re: Proposal for STT_GNU_IFUNC and R_*_IRELATIVE

On Thu, May 28, 2009 at 7:28 AM, Ulrich Drepper <drep...@redhat.com> wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1

> H.J. Lu wrote:
>> for static executables. It is called from elf-init.c. How can I
>> report a bad relocation safetly?

> [I assume you meant dl-init.c.]

No, it is in elf-init.c.. The R_*_IRELATIVE relocations are
processed first in __libc_csu_init before preinit_array only
for static executables.

> And for sake of reducing strange effects: it would be best to to handle
> this a bit different.  Implicitly relying on the programmer having a
> newer glibc installed which using ifunc can cause problems.  If,
> instead, you write a new code fragment which is placed into the .init
> section (provided by the linker whenever ifunc symbols are used in
> statically linked code), then this new init function could reference a
> function in libc which doesn't exist in older versions.

The same can be said for XXX_array. I don't think you will
get an error if you use preinit_array and your glibc doesn't support
it.

--
H.J.


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Ulrich Drepper  
View profile  
 More options May 28, 10:46 am
From: Ulrich Drepper <drep...@redhat.com>
Date: Thu, 28 May 2009 07:46:39 -0700
Local: Thurs, May 28 2009 10:46 am
Subject: Re: Proposal for STT_GNU_IFUNC and R_*_IRELATIVE
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

H.J. Lu wrote:
> The same can be said for XXX_array. I don't think you will get an
> error if you use preinit_array and your glibc doesn't support it.

This might be, but it doesn't mean we should repeat mistakes.

But I don't really care much.  Nobody should link statically in the
first place.  I wouldn't even care to implement IFUNC for static linking.

- --
➧ Ulrich Drepper ➧ Red Hat, Inc. ➧ 444 Castro St ➧ Mountain View, CA ❖
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)

iEYEARECAAYFAkoeo88ACgkQ2ijCOnn/RHQAawCeJLdhzhbkY+lkZEHIrmAk20qH
kfQAnjzkCL6Q+cgUGygJK2nX5E63qPr3
=5Pnb
-----END PGP SIGNATURE-----


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
H.J. Lu  
View profile  
 More options Jun 1, 3:46 pm
From: "H.J. Lu" <hjl.to...@gmail.com>
Date: Mon, 1 Jun 2009 12:46:26 -0700
Local: Mon, Jun 1 2009 3:46 pm
Subject: Re: Proposal for STT_GNU_IFUNC and R_*_IRELATIVE
Hi,

Here is the current proposal implemented in the Linux binutils
2.19.51.0.7.

H.J.
---
STT_GNU_IFUNC

      This symbol type is the same as STT_FUNC except that it always
      points to a function or piece of executable code which takes no
      arguments and returns a function pointer.  If an STT_GNU_IFUNC
      symbol is referred to by a relocation, then evaluation of that
      relocation is delayed until load-time.  The value used in the
      relocation is the function pointer returned by an invocation
      of the STT_GNU_IFUNC symbol.

      The purpose of this symbol type is to allow the run-time to
      select between multiple versions of the implementation of a
      specific function.  The selection made in general will take the
      currently available hardware into account and select the most
      appropriate version.

STT_GNU_IFUNC is defined in OS-specific range:

#define STT_LOOS        10      /* OS-specific semantics */
#define STT_GNU_IFUNC   10      /* Symbol is an indirect code object */
#define STT_HIOS        12      /* OS-specific semantics */

R_*_IRELATIVE

      This relocation is similar to R_*_RELATIVE except that the
      value used in this relocation is the program address returned
      by the function, which takes no arguments, at the address of
      the result of the corresponding R_*_RELATIVE relocation.

      The purpose of this relocation to avoid name lookup for locally
      defined STT_GNU_IFUNC symbols at load-time.

R_*_IRELATIVE is defined for i386 and x86-64:

#define R_386_IRELATIVE    42   /* Adjust indirectly by program base */
#define R_X86_64_IRELATIVE 37   /* Adjust indirectly by program base */

All references to a STT_GNU_IFUNC symbol, including function call and
function pointer, will go through a PLT slot, which jumps to the address
stored in the GOT entry.  If the STT_GNU_IFUNC symbol is locally defined,
a R_*_IRELATIVE relocation will be applied to the GOT entry at load time.
Otherwise, dynamic linker will lookup the symbol at the first call to the
function and update the GOT entry. This applies to all usages of
STT_GNU_IFUNC symbols in shared library, dynamic executable and static
executable.


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Roland McGrath  
View profile  
 More options Jun 1, 4:00 pm
From: Roland McGrath <rol...@redhat.com>
Date: Mon, 1 Jun 2009 13:00:35 -0700 (PDT)
Local: Mon, Jun 1 2009 4:00 pm
Subject: Re: Proposal for STT_GNU_IFUNC and R_*_IRELATIVE
To be a full description, it should say something about the ABI of the
entry-point that returns the function pointer.  Is it "the prevailing
normal ABI" for a function of no arguments returning a pointer to function?
i.e., with whatever call-clobbered registers et al that generically entails.
Or is it a special-case ABI to be defined precisely in the
processor-specific spec?  However much or little the specification of the
ELF feature per se wants to say about this, it should be explicit about
what it does or doesn't specify for it.

Thanks,
Roland


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Ian Lance Taylor  
View profile  
 More options Jun 1, 4:07 pm
From: Ian Lance Taylor <ianlancetay...@gmail.com>
Date: Mon, 01 Jun 2009 13:07:23 -0700
Local: Mon, Jun 1 2009 4:07 pm
Subject: Re: Proposal for STT_GNU_IFUNC and R_*_IRELATIVE

"H.J. Lu" <hjl.to...@gmail.com> writes:
> R_*_IRELATIVE

>       This relocation is similar to R_*_RELATIVE except that the
>       value used in this relocation is the program address returned
>       by the function, which takes no arguments, at the address of
>       the result of the corresponding R_*_RELATIVE relocation.

>       The purpose of this relocation to avoid name lookup for locally
>       defined STT_GNU_IFUNC symbols at load-time.

How is the "corresponding R_*_RELATIVE relocation" determined?

Ian


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
H.J. Lu  
View profile  
 More options Jun 1, 4:12 pm
From: "H.J. Lu" <hjl.to...@gmail.com>
Date: Mon, 1 Jun 2009 13:12:44 -0700
Local: Mon, Jun 1 2009 4:12 pm
Subject: Re: Proposal for STT_GNU_IFUNC and R_*_IRELATIVE
On Mon, Jun 1, 2009 at 1:07 PM, Ian Lance Taylor

<ianlancetay...@gmail.com> wrote:

> "H.J. Lu" <hjl.to...@gmail.com> writes:

>> R_*_IRELATIVE

>>       This relocation is similar to R_*_RELATIVE except that the
>>       value used in this relocation is the program address returned
>>       by the function, which takes no arguments, at the address of
>>       the result of the corresponding R_*_RELATIVE relocation.

>>       The purpose of this relocation to avoid name lookup for locally
>>       defined STT_GNU_IFUNC symbols at load-time.

> How is the "corresponding R_*_RELATIVE relocation" determined?

I added "as specified in the processor-specific ABI":

R_*_IRELATIVE

      This relocation is similar to R_*_RELATIVE except that the
      value used in this relocation is the program address returned
      by the function, which takes no arguments, at the address of
      the result of the corresponding R_*_RELATIVE relocation as
      specified in the processor-specific ABI.

--
H.J.


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
H.J. Lu  
View profile  
 More options Jun 1, 4:14 pm
From: "H.J. Lu" <hjl.to...@gmail.com>
Date: Mon, 1 Jun 2009 13:14:43 -0700
Local: Mon, Jun 1 2009 4:14 pm
Subject: Re: Proposal for STT_GNU_IFUNC and R_*_IRELATIVE

On Mon, Jun 1, 2009 at 1:00 PM, Roland McGrath <rol...@redhat.com> wrote:

> To be a full description, it should say something about the ABI of the
> entry-point that returns the function pointer.  Is it "the prevailing
> normal ABI" for a function of no arguments returning a pointer to function?
> i.e., with whatever call-clobbered registers et al that generically entails.
> Or is it a special-case ABI to be defined precisely in the
> processor-specific spec?  However much or little the specification of the
> ELF feature per se wants to say about this, it should be explicit about
> what it does or doesn't specify for it.

How about this:

The calling convention of the STT_GNU_IFUNC function, which takes no
arguments and returns a function pointer, should follow the
processor-specific ABI. All rules for caller-saved and callee-saved
registers apply.

--
H.J.


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
H.J. Lu  
View profile  
 More options Jun 3, 6:02 pm
From: "H.J. Lu" <hjl.to...@gmail.com>
Date: Wed, 3 Jun 2009 23:02:44 +0100
Local: Wed, Jun 3 2009 6:02 pm
Subject: Re: Proposal for STT_GNU_IFUNC and R_*_IRELATIVE
On Mon, Jun 1, 2009 at 1:07 PM, Ian Lance Taylor

<ianlancetay...@gmail.com> wrote:

> "H.J. Lu" <hjl.to...@gmail.com> writes:

>> R_*_IRELATIVE

>>       This relocation is similar to R_*_RELATIVE except that the
>>       value used in this relocation is the program address returned
>>       by the function, which takes no arguments, at the address of
>>       the result of the corresponding R_*_RELATIVE relocation.

>>       The purpose of this relocation to avoid name lookup for locally
>>       defined STT_GNU_IFUNC symbols at load-time.

> How is the "corresponding R_*_RELATIVE relocation" determined?

I added "as specified in the processor-specific ABI":

R_*_IRELATIVE

      This relocation is similar to R_*_RELATIVE except that the
      value used in this relocation is the program address returned
      by the function, which takes no arguments, at the address of
      the result of the corresponding R_*_RELATIVE relocation as
      specified in the processor-specific ABI.

--
H.J.


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Ian Lance Taylor  
View profile  
 More options Jun 3, 6:02 pm
From: "Ian Lance Taylor" <ianlancetay...@gmail.com>
Date: Wed, 3 Jun 2009 23:02:42 +0100
Local: Wed, Jun 3 2009 6:02 pm
Subject: Re: Proposal for STT_GNU_IFUNC and R_*_IRELATIVE

"H.J. Lu" <hjl.to...@gmail.com> writes:
> R_*_IRELATIVE

>       This relocation is similar to R_*_RELATIVE except that the
>       value used in this relocation is the program address returned
>       by the function, which takes no arguments, at the address of
>       the result of the corresponding R_*_RELATIVE relocation.

>       The purpose of this relocation to avoid name lookup for locally
>       defined STT_GNU_IFUNC symbols at load-time.

How is the "corresponding R_*_RELATIVE relocation" determined?

Ian


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
H.J. Lu  
View profile  
 More options Jun 4, 4:34 pm
From: "H.J. Lu" <hjl.to...@gmail.com>
Date: Thu, 4 Jun 2009 13:34:04 -0700
Local: Thurs, Jun 4 2009 4:34 pm
Subject: Re: Proposal for STT_GNU_IFUNC and R_*_IRELATIVE

There is an issue with STT_GNU_IFUNC symbols.

For branch, it is easy to understand. But it is unclear what the value
of STT_GNU_IFUNC symbol should be. In a non-shared object, the value
of the undefined STT_GNU_IFUNC symbol is the address of the PLT entry
since it will only be resolved at run-time.  In a shared object,
the value of the STT_GNU_IFUNC symbol will be the address of the
real function.  We can't use the address of the PLT entry since
the PLT entry in a shared object may not be usable in non-shared object.

So the undefined STT_GNU_IFUNC symbol will have 2 different values.
Will it be a problem?

--
H.J.


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
H.J. Lu  
View profile  
 More options Jun 4, 4:46 pm
From: "H.J. Lu" <hjl.to...@gmail.com>
Date: Thu, 4 Jun 2009 21:46:43 +0100
Local: Thurs, Jun 4 2009 4:46 pm
Subject: Re: Proposal for STT_GNU_IFUNC and R_*_IRELATIVE

There is an issue with STT_GNU_IFUNC symbols.

For branch, it is easy to understand. But it is unclear what the value
of STT_GNU_IFUNC symbol should be. In a non-shared object, the value
of the undefined STT_GNU_IFUNC symbol is the address of the PLT entry
since it will only be resolved at run-time.  In a shared object,
the value of the STT_GNU_IFUNC symbol will be the address of the
real function.  We can't use the address of the PLT entry since
the PLT entry in a shared object may not be usable in non-shared object.

So the undefined STT_GNU_IFUNC symbol will have 2 different values.
Will it be a problem?

--
H.J.


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Ulrich Drepper  
View profile  
 More options Jun 5, 1:26 am
From: Ulrich Drepper <drep...@redhat.com>
Date: Thu, 04 Jun 2009 22:26:17 -0700
Local: Fri, Jun 5 2009 1:26 am
Subject: Re: Proposal for STT_GNU_IFUNC and R_*_IRELATIVE
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

H.J. Lu wrote:
> For branch, it is easy to understand. But it is unclear what the value
> of STT_GNU_IFUNC symbol should be. In a non-shared object, the value
> of the undefined STT_GNU_IFUNC symbol is the address of the PLT entry
> since it will only be resolved at run-time.

What undefined STT_GNU_IFUNC symbol?  The whole point of this symbol
type is that the caller doesn't have to care at all about the
optimizations.  A library author can introduce them in DSOs and programs
at the next start can take advantage of this.

Linking against an STT_GNU_IFUNC symbol in a DSO should create a normal
STT_FUNC symbol table entry for the undefined symbol.

Again, there are no undefined STT_GNU_IFUNC symbols.

> So the undefined STT_GNU_IFUNC symbol will have 2 different values.
> Will it be a problem?

See above.  If you linker patch creates undefined STT_GNU_IFUNC symbols,
take that code out.  That's the solution.

- --
➧ Ulrich Drepper ➧ Red Hat, Inc. ➧ 444 Castro St ➧ Mountain View, CA ❖
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)

iEYEARECAAYFAkoorHkACgkQ2ijCOnn/RHSeHgCgtQgNxr3/FcEsGiMw2ZshnblY
1fwAoJo0zfcPBrzqHYR2EBuxBaZCA5mO
=dnZJ
-----END PGP SIGNATURE-----


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Ulrich Drepper  
View profile  
 More options Jun 5, 1:30 am
From: "Ulrich Drepper" <drep...@redhat.com>
Date: Fri, 5 Jun 2009 06:30:48 +0100
Local: Fri, Jun 5 2009 1:30 am
Subject: Re: Proposal for STT_GNU_IFUNC and R_*_IRELATIVE
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

H.J. Lu wrote:
> For branch, it is easy to understand. But it is unclear what the value
> of STT_GNU_IFUNC symbol should be. In a non-shared object, the value
> of the undefined STT_GNU_IFUNC symbol is the address of the PLT entry
> since it will only be resolved at run-time.

What undefined STT_GNU_IFUNC symbol?  The whole point of this symbol
type is that the caller doesn't have to care at all about the
optimizations.  A library author can introduce them in DSOs and programs
at the next start can take advantage of this.

Linking against an STT_GNU_IFUNC symbol in a DSO should create a normal
STT_FUNC symbol table entry for the undefined symbol.

Again, there are no undefined STT_GNU_IFUNC symbols.

> So the undefined STT_GNU_IFUNC symbol will have 2 different values.
> Will it be a problem?

See above.  If you linker patch creates undefined STT_GNU_IFUNC symbols,
take that code out.  That's the solution.

- --
➧ Ulrich Drepper ➧ Red Hat, Inc. ➧ 444 Castro St ➧ Mountain View, CA ❖
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)

iEYEARECAAYFAkoorHkACgkQ2ijCOnn/RHSeHgCgtQgNxr3/FcEsGiMw2ZshnblY
1fwAoJo0zfcPBrzqHYR2EBuxBaZCA5mO
=dnZJ
-----END PGP SIGNATURE-----


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
H.J. Lu  
View profile  
 More options Jun 6, 8:11 am
From: "H.J. Lu" <hjl.to...@gmail.com>
Date: Sat, 6 Jun 2009 05:11:09 -0700
Local: Sat, Jun 6 2009 8:11 am
Subject: Re: Proposal for STT_GNU_IFUNC and R_*_IRELATIVE
Hi,

There is an ordering issue on STT_GNU_IFUNC functions. In shared object,
we need dynamic relocation to get the real function address when there is a
non-GOT reference against a STT_GNU_IFUNC symbols.  A STT_GNU_IFUNC
function may use some data which need to be relocated first. Possible solutions:

1. A STT_GNU_IFUNC function should never access any data which need
relocation. Or
2. Dynamic relocations against STT_GNU_INFUNC symbols should be
placed after all other relocations.

Any comments?

Thanks.

H.J.


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
H.J. Lu  
View profile  
 More options Jun 6, 8:15 am
From: "H.J. Lu" <hjl.to...@gmail.com>
Date: Sat, 6 Jun 2009 13:15:57 +0100
Local: Sat, Jun 6 2009 8:15 am
Subject: Re: Proposal for STT_GNU_IFUNC and R_*_IRELATIVE
Hi,

There is an ordering issue on STT_GNU_IFUNC functions. In shared object,
we need dynamic relocation to get the real function address when there is a
non-GOT reference against a STT_GNU_IFUNC symbols.  A STT_GNU_IFUNC
function may use some data which need to be relocated first. Possible solutions:

1. A STT_GNU_IFUNC function should never access any data which need
relocation. Or
2. Dynamic relocations against STT_GNU_INFUNC symbols should be
placed after all other relocations.

Any comments?

Thanks.

H.J.


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Roland McGrath  
View profile  
 More options Jun 6, 8:55 am
From: Roland McGrath <rol...@redhat.com>
Date: Sat, 6 Jun 2009 05:55:21 -0700 (PDT)
Local: Sat, Jun 6 2009 8:55 am
Subject: Re: Proposal for STT_GNU_IFUNC and R_*_IRELATIVE

> 1. A STT_GNU_IFUNC function should never access any data which need
> relocation.

This does not seem like too much of a constraint, given that it also
unavoidably has to work before the DSO's initializers have run.
i.e., it is always special-purpose code that has to be written very
carefully.  Being PIC code it should not be relying on much to have been
done before.  It just has to avoid any PLT calls or other GOT use itself.

> 2. Dynamic relocations against STT_GNU_INFUNC symbols should be
> placed after all other relocations.

This is not possible, is it?  Some DSO has a reference to "&strlen".
It has no idea that libc's definition will be STT_GNU_IFUNC.
The DSO might even have been linked against a libc.so that did
not use STT_GNU_IFUNC to define "strlen".

The only other alternative to #1 that I see is some scheme whereby "&func"
will in all cases resolve to a PLT entry rather than the actual
STT_GNU_IFUNC symbol's st_value.  i.e., the ifunc resolver is only called
for PLT resolution (and you can do all those last for BIND_NOW).

e.g. in the defining DSO make ld generate a PLT entry with second symbol a
la executables' PLT entries, and then have rtld ignore the STT_GNU_IFUNC
symbol when resolving non-PLT relocs.  (Seems highly dubious.)

But in fact any scheme with that result might be undesireable in practice.
If the executable does not refer to "&func", then we don't have the pointer
equality issue and so DSOs with function pointer tables pointing to other
DSOs' entry points would do the extra indirection of a PLT jump when it
could be avoided except for this initialization order question.

Thanks,
Roland


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
H.J. Lu  
View profile  
 More options Jun 6, 11:21 am
From: "H.J. Lu" <hjl.to...@gmail.com>
Date: Sat, 6 Jun 2009 08:21:44 -0700
Local: Sat, Jun 6 2009 11:21 am
Subject: Re: Proposal for STT_GNU_IFUNC and R_*_IRELATIVE

This patch implements #2. It may not solve all the problems. But it
works for my simple testcase.

--
H.J.
----
bfd/

2009-06-06  H.J. Lu  <hongjiu...@intel.com>

        * elf32-i386.c (elf_i386_link_hash_table): Add irelifunc.
        (elf_i386_link_hash_table_create): Initialize irelifunc.
        (elf_i386_check_relocs): Updated.  Set up irelifunc for
        shared objects.
        (elf_i386_allocate_dynrelocs): Use irelifunc for dynamic
        relocation for non-GOT reference of STT_GNU_IFUNC symbol in
        shared objects.
        (elf_i386_relocate_section): Likewise.

        * elf64-x86-64.c (elf64_x86_64_link_hash_table): Add irelifunc.
        (elf64_x86_64_link_hash_table_create): Initialize irelifunc.
        (elf64_x86_64_check_relocs): Updated.  Set up irelifunc for
        shared objects.
        (elf64_x86_64_allocate_dynrelocs): Use irelifunc for dynamic
        relocation for non-GOT reference of STT_GNU_IFUNC symbol in
        shared objects.
        (elf64_x86_64_relocate_section): Likewise.

        * elf-bfd.h (_bfd_elf_create_static_ifunc_sections): Renamed to
        ...
        (_bfd_elf_create_ifunc_sections): This.

        * elflink.c (_bfd_elf_create_static_ifunc_sections): Renamd to
        ...
        (_bfd_elf_create_ifunc_sections): This.  Create .rel[a].ifunc
        for shared objects.

ld/

2009-06-06  H.J. Lu  <hongjiu...@intel.com>

        * scripttempl/elf.sc: Add .rel.ifunc and .rela.ifunc.

  binutils-ifunc-reloc-1.patch
15K Download

    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
H.J. Lu  
View profile  
 More options Jun 8, 9:57 am
From: "H.J. Lu" <hjl.to...@gmail.com>
Date: Mon, 8 Jun 2009 06:57:25 -0700
Local: Mon, Jun 8 2009 9:57 am
Subject: Re: [discuss] Proposal for STT_GNU_IFUNC and R_*_IRELATIVE

On Mon, Jun 8, 2009 at 6:30 AM, Paul Brook<p...@codesourcery.com> wrote:
>> The only other alternative to #1 that I see is some scheme whereby "&func"
>> will in all cases resolve to a PLT entry rather than the actual
>> STT_GNU_IFUNC symbol's st_value.  i.e., the ifunc resolver is only called
>> for PLT resolution (and you can do all those last for BIND_NOW).

> This will break pointer comparisons across modules.

Please try the current binutils in CVS. I think I have fixed all
problems. If not,
please open a bug report with a testcase.

Thanks.

--
H.J.


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Roland McGrath  
View profile  
 More options Jun 8, 12:59 pm
From: Roland McGrath <rol...@redhat.com>
Date: Mon, 8 Jun 2009 09:59:00 -0700 (PDT)
Subject: Re: Proposal for STT_GNU_IFUNC and R_*_IRELATIVE

> > The only other alternative to #1 that I see is some scheme whereby "&func"
> > will in all cases resolve to a PLT entry rather than the actual
> > STT_GNU_IFUNC symbol's st_value.  i.e., the ifunc resolver is only called
> > for PLT resolution (and you can do all those last for BIND_NOW).

> This will break pointer comparisons across modules.

You seem to have misunderstood the idea.

    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Roland McGrath  
View profile  
 More options Jun 8, 2:16 pm
From: "Roland McGrath" <rol...@redhat.com>
Date: Mon, 8 Jun 2009 19:16:15 +0100
Local: Mon, Jun 8 2009 2:16 pm
Subject: Re: Proposal for STT_GNU_IFUNC and R_*_IRELATIVE

> > The only other alternative to #1 that I see is some scheme whereby "&func"
> > will in all cases resolve to a PLT entry rather than the actual
> > STT_GNU_IFUNC symbol's st_value.  i.e., the ifunc resolver is only called
> > for PLT resolution (and you can do all those last for BIND_NOW).

> This will break pointer comparisons across modules.

You seem to have misunderstood the idea.

    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages < Older 
« Back to Discussions « Newer topic     Older topic »

Create a group - Google Groups - Google Home - Terms of Service - Privacy Policy
©2009 Google