public inbox for gdb@sourceware.org
 help / color / mirror / Atom feed
* [x86-64 psABI] Document STT_GNU_IFUNC and R_X86_64_IRELATIVE
@ 2012-04-10 15:33 H.J. Lu
  2012-04-16 16:52 ` H.J. Lu
  0 siblings, 1 reply; 3+ messages in thread
From: H.J. Lu @ 2012-04-10 15:33 UTC (permalink / raw)
  To: discuss, GCC Development, Binutils, GNU C Library, GDB

[-- Attachment #1: Type: text/plain, Size: 202 bytes --]

Hi,

This patch for x86-64 psABI adds document for STT_GNU_IFUNC and
R_X86_64_IRELATIVE. It has been implemented on Linux/x86-64 for
more than a year.  Please add it to x86-64 psABI.

Thanks.

-- 
H.J.

[-- Attachment #2: ifunc-spec.patch --]
[-- Type: application/octet-stream, Size: 2731 bytes --]

2010-12-30  H.J. Lu  <hongjiu.lu@intel.com>

	* object-files.tex: Document STT_GNU_IFUNC and R_X86_64_IRELATIVE.

diff --git a/object-files.tex b/object-files.tex
index 757a25d..4705e96 100644
--- a/object-files.tex
+++ b/object-files.tex
@@ -344,6 +344,23 @@ the section until the end, counting entries as they are encountered.
 The discussion of "Function Addresses" in Section \ref{function_addresses}
 defines some special values for symbol table fields.
 
+The \texttt{STT_GNU_IFUNC}
+\footnote{It is specified in {\bf ifunc.txt}
+at \url{http://groups.google.com/group/generic-abi/files}}
+symbol type is optional. It is the same as
+\texttt{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 \texttt{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 \texttt{STT_GNU_IFUNC} symbol.
+ 
+The purpose of the \texttt{STT_GNU_IFUNC} 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.
+
 \section{Relocation}
 
 \subsection{Relocation Types}
@@ -451,6 +468,7 @@ the relocation addend.
       \texttt{R_X86_64_GOTPC32_TLSDESC} & 34 & \textit{word32} &  \\
       \texttt{R_X86_64_TLSDESC_CALL} & 35 & none &  \\
       \texttt{R_X86_64_TLSDESC} & 36 & \textit{word64}$\times 2$ & \\
+      \texttt{R_X86_64_IRELATIVE} & 37 & \textit{word64} & \texttt{indirect (B + A)}\\
 %      \texttt{R_X86_64_GOT64} & 16 & \textit{word64} & \texttt{G + A} \\
 %      \texttt{R_X86_64_PLT64} & 17 & \textit{word64} & \texttt{L + A - P} \\
     \end{tabular}
@@ -563,6 +581,16 @@ to the named symbol.  \texttt{R_X86_64_TLSDESC_CALL} must annotate the
 instruction used to call the TLS Descriptor resolver function, so as
 to enable relaxation of that instruction.
 
+\texttt{R_X86_64_IRELATIVE} is similar to \texttt{R_X86_64_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 \texttt{R_X86_64_RELATIVE} relocation.
+
+One use of the \texttt{R_X86_64_IRELATIVE} relocation is to avoid name
+lookup for the locally defined \texttt{STT_GNU_IFUNC} symbols at
+load-time.  Support for this relocation is optional, but is required for
+the \texttt{STT_GNU_IFUNC} symbols.
+
 \subsection{Large Models}
 
 In order to extend both the PLT and the GOT beyond 2GB, it

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [x86-64 psABI] Document STT_GNU_IFUNC and R_X86_64_IRELATIVE
  2012-04-10 15:33 [x86-64 psABI] Document STT_GNU_IFUNC and R_X86_64_IRELATIVE H.J. Lu
@ 2012-04-16 16:52 ` H.J. Lu
  2012-04-17 12:42   ` Michael Matz
  0 siblings, 1 reply; 3+ messages in thread
From: H.J. Lu @ 2012-04-16 16:52 UTC (permalink / raw)
  To: discuss, GCC Development, Binutils, GNU C Library, GDB, Michael Matz

On Tue, Apr 10, 2012 at 8:33 AM, H.J. Lu <hjl.tools@gmail.com> wrote:
> Hi,
>
> This patch for x86-64 psABI adds document for STT_GNU_IFUNC and
> R_X86_64_IRELATIVE. It has been implemented on Linux/x86-64 for
> more than a year.  Please add it to x86-64 psABI.
>
> Thanks.
>

Hi Michael,

Can you apply IFUNC spec to x86-64 psABI?

BTW, where can I find the latest x86-64 psABI source? The svn
site:

https://www.x86-64.org/svn/trunk/x86-64-ABI

is down.

Thanks.


-- 
H.J.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [x86-64 psABI] Document STT_GNU_IFUNC and R_X86_64_IRELATIVE
  2012-04-16 16:52 ` H.J. Lu
@ 2012-04-17 12:42   ` Michael Matz
  0 siblings, 0 replies; 3+ messages in thread
From: Michael Matz @ 2012-04-17 12:42 UTC (permalink / raw)
  To: H.J. Lu; +Cc: discuss, GCC Development, Binutils, GNU C Library, GDB

Hi,

On Mon, 16 Apr 2012, H.J. Lu wrote:

> Hi Michael,
> 
> Can you apply IFUNC spec to x86-64 psABI?

Yes, ...

> BTW, where can I find the latest x86-64 psABI source? The svn
> site:
> 
> https://www.x86-64.org/svn/trunk/x86-64-ABI
> 
> is down.

... once I find out what the problem with that is :)


Ciao,
Michael.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2012-04-17 12:42 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-04-10 15:33 [x86-64 psABI] Document STT_GNU_IFUNC and R_X86_64_IRELATIVE H.J. Lu
2012-04-16 16:52 ` H.J. Lu
2012-04-17 12:42   ` Michael Matz

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).