Round 2 documentation review updates

Pervasive corrections:
- Miscellaneous formating
- Insert space in () and []
- Correct footnote spacing
- Use <note> tag for notes
- Cleanup spacing around <anchor> tags
- Add a couple missing paragraphs
- Correct list nesting in a couple places
- Correct subsection nesting
- Correct spacing around subscript, superscripts, and emphasis tags
- Bolding of some <emphasis> statements
- Build xref links for manual footnotes in a couple tables and remove explicit numerals.
- Return POWER ISA 3.0 text

Specific updates:
- Update a couple tables on bit/byte positions in chapter 2
- Return figures in place of some tables for the coding examples in
  chapter 2

Signed-off-by: Jeff Scheel <scheel@us.ibm.com>
master
Jeff Scheel 8 years ago
parent 2cb6450f10
commit 5eba3e1cb1

File diff suppressed because it is too large Load Diff

@ -18,9 +18,8 @@ xml:id="dbdoclet.50655245_pgfId-1450875" revisionflag="added">
BCD values are stored in memory as contiguous arrays of 1 - 16 BCD values are stored in memory as contiguous arrays of 1 - 16
bytes.</para> bytes.</para>
<note> <note>
<para>BCD built-in functions are valid only when - <para>BCD built-in functions are valid only when -<emphasis role="bold">march</emphasis> or
<emphasis role="bold">march</emphasis> or - -<emphasis role="bold">qarch</emphasis> is set to target POWER8 processors or
<emphasis role="bold">qarch</emphasis> is set to target POWER8 processors or
later.</para> later.</para>
</note> </note>
<para> <para>
@ -424,8 +423,7 @@ xml:id="dbdoclet.50655245_pgfId-1450875" revisionflag="added">
<row> <row>
<entry align="center"> <entry align="center">
<para> <para>
<emphasis role="bold">Macro <emphasis role="bold">Macro<footnote xml:id="tabb2fna"><para>Or static inline function.</para></footnote></emphasis>
<footnote xml:id="tabb2fna"><para>Or static inline function.</para></footnote></emphasis>
</para> </para>
</entry> </entry>
<entry> <entry>
@ -529,8 +527,7 @@ xml:id="dbdoclet.50655245_pgfId-1450875" revisionflag="added">
<para>bcd_xl(a,b)</para> <para>bcd_xl(a,b)</para>
</entry> </entry>
<entry> <entry>
<para>(bcd)vec_xl_len_r(a,b) <para>(bcd)vec_xl_len_r(a,b)<footnote xml:id="tabb2fnb"><para>Optionaly, __builtin_ldrmb (a,b) for previous
<footnote xml:id="tabb2fnb"><para>Optionaly, __builtin_ldrmb (a,b) for previous
generations of XL compilers.</para></footnote> generations of XL compilers.</para></footnote>
</para> </para>
</entry> </entry>
@ -540,8 +537,7 @@ xml:id="dbdoclet.50655245_pgfId-1450875" revisionflag="added">
<para>bcd_xst(a,b)</para> <para>bcd_xst(a,b)</para>
</entry> </entry>
<entry> <entry>
<para>(bcd)vec_xst_len_r(a,b) <para>(bcd)vec_xst_len_r(a,b)<footnote xml:id="tabb2fnc"><para>Optionaly, __builti_strmb (a,b) for previous
<footnote xml:id="tabb2fnc"><para>Optionaly, __builti_strmb (a,b) for previous
generatoin f XL compilers.</para></footnote> generatoin f XL compilers.</para></footnote>
</para> </para>
</entry> </entry>

@ -27,7 +27,7 @@
<xref linkend="dbdoclet.50655240___RefHeading___Toc377640574" />). <xref linkend="dbdoclet.50655240___RefHeading___Toc377640574" />).
OpenPOWER-compliant processors in the 64-bit Power Architecture can execute OpenPOWER-compliant processors in the 64-bit Power Architecture can execute
in either big-endian or little-endian mode. Executables and in either big-endian or little-endian mode. Executables and
executable-generated data (in general) that subscribes to either byte executable-generated data (in general) that subscribe to either byte
ordering is not portable to a system running in the other mode.</para> ordering is not portable to a system running in the other mode.</para>
<itemizedlist> <itemizedlist>
<listitem> <listitem>
@ -155,8 +155,7 @@
</emphasis></para> </emphasis></para>
</listitem> </listitem>
<listitem> <listitem>
<para>ELF Assembly Users Guide, Fourth edition, IBM, 2000.</para> <para>ELF Assembly Users Guide, Fourth edition, IBM, 2000.
<para>
<emphasis> <emphasis>
<link xl:href="https://www-03.ibm.com/technologyconnect/tgcm/TGCMFileServlet.wss/assem_um.pdf?id=109917A251EFD64C872569D900656D07&amp;linkid=1h3000&amp;c_t=md515o6ntgh671shz9ioar20oyfp1grs"> <link xl:href="https://www-03.ibm.com/technologyconnect/tgcm/TGCMFileServlet.wss/assem_um.pdf?id=109917A251EFD64C872569D900656D07&amp;linkid=1h3000&amp;c_t=md515o6ntgh671shz9ioar20oyfp1grs">



File diff suppressed because it is too large Load Diff

@ -116,8 +116,7 @@ e_ident[EI_DATA] ELFDATA2LSB For all little-endian implementations.</progra
</row> </row>
<row> <row>
<entry> <entry>
<para>.plt <para>.plt<footnote>
<footnote>
<para>The type of the OpenPOWER ABI .plt section is <para>The type of the OpenPOWER ABI .plt section is
SHT_NOBITS, not SHT_PROGBITS as on most other processors.</para> SHT_NOBITS, not SHT_PROGBITS as on most other processors.</para>
</footnote></para> </footnote></para>
@ -184,7 +183,7 @@ e_ident[EI_DATA] ELFDATA2LSB For all little-endian implementations.</progra
is linker generated. The linker must ensure that .got is aligned to an is linker generated. The linker must ensure that .got is aligned to an
8-byte boundary. In an executable or shared library, it may contain 8-byte boundary. In an executable or shared library, it may contain
part or all of the TOC. For more information, see part or all of the TOC. For more information, see
<xref revisionflag='deleted' linkend="dbdoclet.50655240___RefHeading___Toc377640591" /> and <xref linkend="dbdoclet.50655240___RefHeading___Toc377640591" /> and
<xref linkend="dbdoclet.50655242_47739" />.</para> <xref linkend="dbdoclet.50655242_47739" />.</para>
</listitem> </listitem>
<listitem> <listitem>
@ -319,7 +318,7 @@ e_ident[EI_DATA] ELFDATA2LSB For all little-endian implementations.</progra
pointer can use a common entry point for the local and global pointer can use a common entry point for the local and global
entry points.</para> entry points.</para>
<note> <note>
<para>Note: If the function is not a leaf function, it must <para>If the function is not a leaf function, it must
call subroutines using the R_PPC64_REL24_NOTOC relocation call subroutines using the R_PPC64_REL24_NOTOC relocation
to indicate that the TOC register is not initialized. In to indicate that the TOC register is not initialized. In
turn, this may lead to more expensive procedure linkage turn, this may lead to more expensive procedure linkage
@ -852,7 +851,7 @@ my_func:
</entry> </entry>
</row> </row>
<row> <row>
<entry align="left"> <entry align="right">
<para>0</para> <para>0</para>
</entry> </entry>
<entry> <entry>
@ -2230,7 +2229,7 @@ my_func:
</entry> </entry>
<entry> <entry>
<para>Denotes the high adjusted value: bits 16 - 63 of the <para>Denotes the high adjusted value: bits 16 - 63 of the
indicated value, compensating for #lo() being treated as a indicated value, compensating for #lo( ) being treated as a
signed number. That is:</para> signed number. That is:</para>
<para>#ha(x) = (x + 0x8000) &gt;&gt; 16</para> <para>#ha(x) = (x + 0x8000) &gt;&gt; 16</para>
</entry> </entry>
@ -2324,7 +2323,7 @@ my_func:
<para>If n is the offset computed:</para> <para>If n is the offset computed:</para>
<para>GOT[n] = dtpmod</para> <para>GOT[n] = dtpmod</para>
<para>GOT[n + 1] = dtprel</para> <para>GOT[n + 1] = dtprel</para>
<para>The call to __tls_get_addr () happens as:</para> <para>The call to __tls_get_addr ( ) happens as:</para>
<para>__tls_get_addr ((tls_index *) &amp;GOT[n])</para> <para>__tls_get_addr ((tls_index *) &amp;GOT[n])</para>
</entry> </entry>
</row> </row>
@ -2339,7 +2338,7 @@ my_func:
<para>If n is the offset computed:</para> <para>If n is the offset computed:</para>
<para>GOT[n] = dtpmod</para> <para>GOT[n] = dtpmod</para>
<para>GOT[n + 1] = 0</para> <para>GOT[n + 1] = 0</para>
<para>The call to __tls_get_addr () happens as:</para> <para>The call to __tls_get_addr ( ) happens as:</para>
<para>__tls_get_addr ((tls_index *) &amp;GOT[n])</para> <para>__tls_get_addr ((tls_index *) &amp;GOT[n])</para>
</entry> </entry>
</row> </row>
@ -2360,7 +2359,7 @@ my_func:
</tgroup> </tgroup>
</informaltable> </informaltable>
<note> <note>
<para>Note: Relocations flagged with an asterisk(*) will <para>Relocations flagged with an asterisk(*) will
trigger a relocation failure if the value computed does trigger a relocation failure if the value computed does
not fit in the field specified.</para> not fit in the field specified.</para>
</note> </note>
@ -2426,11 +2425,12 @@ my_func:
<tfoot> <tfoot>
<row> <row>
<entry nameend="c4" namest="c1" align="left"> <entry nameend="c4" namest="c1" align="left">
<para><emphasis role="bold">Note:</emphasis>Relocation values 8, 9, 12, 13, 18, 23, 32, <note>
<para>Relocation values 8, 9, 12, 13, 18, 23, 32,
and 247 are not used. This is to maintain a and 247 are not used. This is to maintain a
correspondence to the relocation values used by the correspondence to the relocation values used by the
32-bit PowerPC ELF ABI. 32-bit PowerPC ELF ABI.
</para> </para></note>
</entry> </entry>
</row> </row>
</tfoot> </tfoot>
@ -3204,7 +3204,7 @@ my_func:
<para>half16ds*</para> <para>half16ds*</para>
</entry> </entry>
<entry> <entry>
<para></para> <para>(R + A) &gt;&gt; 2</para>
</entry> </entry>
</row> </row>
<row> <row>
@ -4119,9 +4119,7 @@ my_func:
resolved through a call to the symbols procedure linkage table entry. resolved through a call to the symbols procedure linkage table entry.
Additionally, it instructs the link editor to build a procedure linkage Additionally, it instructs the link editor to build a procedure linkage
table for the executable or shared object if one is not created.</para> table for the executable or shared object if one is not created.</para>
<para> <para><anchor xml:id="dbdoclet.50655241_R_PPC_COPY" xreflabel="" />R_PPC64_COPY</para>
<anchor xml:id="dbdoclet.50655241_R_PPC_COPY"
xreflabel="" /> R_PPC64_COPY</para>
<para>This relocation type is created by the link editor for dynamic <para>This relocation type is created by the link editor for dynamic
linking. Its offset member refers to a location in a writable segment. linking. Its offset member refers to a location in a writable segment.
The symbol table index specifies a symbol that should exist both in the The symbol table index specifies a symbol that should exist both in the
@ -4219,7 +4217,7 @@ ld r3,x@got@l(r3)</programlisting>
<para> </para> <para> </para>
<note> <note>
<para> <para>
<emphasis role="bold">Note:</emphasis> If X is a variable stored in the TOC, If X is a variable stored in the TOC,
then X@got is the offset within the TOC of a doubleword whose then X@got is the offset within the TOC of a doubleword whose
value is X@toc.</para> value is X@toc.</para>
</note> </note>
@ -4274,23 +4272,23 @@ lwz rt, offset(r2)</programlisting>
<para>Compilers and programmers <para>Compilers and programmers
<emphasis>must</emphasis> ensure that r2 is live at the actual data access <emphasis>must</emphasis> ensure that r2 is live at the actual data access
point associated with extended displacement addressing.</para> point associated with extended displacement addressing.</para>
</section>
<section xml:id="dbdoclet.50655241_19147"> <section xml:id="dbdoclet.50655241_19147">
<title>TOC Pointer Usage</title> <title>TOC Pointer Usage</title>
<para>To enable linker-based optimizations when global data is accessed, <para>To enable linker-based optimizations when global data is accessed,
the TOC pointer needs to be available for dereference at the point of all the TOC pointer needs to be available for dereference at the point of all
uses of values derived from the TOC pointer in conjunction with the @l uses of values derived from the TOC pointer in conjunction with the @l
operator. This property is used by the linker to optimize TOC pointer operator. This property is used by the linker to optimize TOC pointer
accesses. In addition, all reaching definitions for a TOC-pointer-derived accesses. In addition, all reaching definitions for a TOC-pointer-derived
access must compute the same definition.</para> access must compute the same definition.</para>
<para>In some implementations, non-ABI-compliant code may be processed by <para>In some implementations, non-ABI-compliant code may be processed by
providing additional linker options; for example, linker options providing additional linker options; for example, linker options
disabling linker optimization. However, this behavior in support of disabling linker optimization. However, this behavior in support of
non-ABI-compliant code is not guaranteed to be portable and supported in non-ABI-compliant code is not guaranteed to be portable and supported in
all systems.</para> all systems.</para>
<para>&#160;</para> <para>&#160;</para>
<bridgehead>Compliant example</bridgehead> <bridgehead>Compliant example</bridgehead>
<programlisting> addis r4, r2, mysym@toc@ha <programlisting> addis r4, r2, mysym@toc@ha
b target b target
@ -4301,9 +4299,9 @@ lwz rt, offset(r2)</programlisting>
target: target:
addi r4, r4, mysym@toc@l addi r4, r4, mysym@toc@l
...</programlisting> ...</programlisting>
<para>&#160;</para> <para>&#160;</para>
<bridgehead>Non-compliant example</bridgehead> <bridgehead>Non-compliant example</bridgehead>
<programlisting> li r4, 0 ; #d1 <programlisting> li r4, 0 ; #d1
b target b target
... ...
@ -4312,14 +4310,16 @@ target:
target: target:
addi r4, r4, mysym@toc@l ; incompatible definitions #d1 and #d2 reach this addi r4, r4, mysym@toc@l ; incompatible definitions #d1 and #d2 reach this
...</programlisting> ...</programlisting>
</section>
<section>
<title>Table Jump Sequences</title>
<para>Some linkers may rewrite jump table sequences, as described in
<xref linkend="dbdoclet.50655240_47036" />. For example, linkers may
rewrite address references created using GOT-indirect loads and bl+4
sequences to use TOC-relative address computation.</para>
</section>
</section> </section>
<section>
<title>Table Jump Sequences</title>
<para>Some linkers may rewrite jump table sequences, as described in
<xref linkend="dbdoclet.50655240_47036" />. For example, linkers may
rewrite address references created using GOT-indirect loads and bl+4
sequences to use TOC-relative address computation.</para>
</section>
<section> <section>
<title>Fusion</title> <title>Fusion</title>
<para>Code generation in compilers, linkers, and by programmers should <para>Code generation in compilers, linkers, and by programmers should
@ -4426,14 +4426,14 @@ addi r4, r4, lower</programlisting>
tlsoffset(m + 1) = round(tlsoffset(m) + tlssize(m), align(m + 1))</programlisting> tlsoffset(m + 1) = round(tlsoffset(m) + tlssize(m), align(m + 1))</programlisting>
<itemizedlist> <itemizedlist>
<listitem> <listitem>
<para>The function round() returns its first argument rounded up to <para>The function round( ) returns its first argument rounded up to
the next multiple of its second argument:</para> the next multiple of its second argument:</para>
</listitem> </listitem>
</itemizedlist> </itemizedlist>
<programlisting>round(x, y) = y × ceiling(x / y)</programlisting> <programlisting>round(x, y) = y × ceiling(x / y)</programlisting>
<itemizedlist> <itemizedlist>
<listitem> <listitem>
<para>The function ceiling() returns the smallest integer greater <para>The function ceiling( ) returns the smallest integer greater
than or equal to its argument, where n is an integer satisfying: n - than or equal to its argument, where n is an integer satisfying: n -
1 &lt; x ≤ n:</para> 1 &lt; x ≤ n:</para>
</listitem> </listitem>
@ -4441,9 +4441,9 @@ tlsoffset(m + 1) = round(tlsoffset(m) + tlssize(m), align(m + 1))</programlistin
<programlisting>ceiling(x) = n</programlisting> <programlisting>ceiling(x) = n</programlisting>
<para>In the case of dynamic shared objects (DSO), TLS blocks are <para>In the case of dynamic shared objects (DSO), TLS blocks are
allocated on an as-needed basis, with the details of allocation allocated on an as-needed basis, with the details of allocation
abstracted away by the __tls_get_addr() function, which is used to abstracted away by the __tls_get_addr( ) function, which is used to
retrieve the address of any TLS variable.</para> retrieve the address of any TLS variable.</para>
<para>The prototype for the __tls_get_addr() function, is defined as <para>The prototype for the __tls_get_addr( ) function, is defined as
follows.</para> follows.</para>
<programlisting>typedef struct <programlisting>typedef struct
{ {
@ -4514,7 +4514,7 @@ extern void *__tls_get_addr (tls_index *ti);</programlisting>
code model, which is the default for the ELF V2 ABI.</para> code model, which is the default for the ELF V2 ABI.</para>
</note> </note>
<para>Given the following code fragment, to determine the address of a <para>Given the following code fragment, to determine the address of a
thread-local variable x, the __tls_get_addr() function is called with one thread-local variable x, the __tls_get_addr( ) function is called with one
parameter. That parameter is a pointer to a data object of type parameter. That parameter is a pointer to a data object of type
tls_index.</para> tls_index.</para>
<programlisting>extern __thread unsigned int x; <programlisting>extern __thread unsigned int x;
@ -5717,8 +5717,7 @@ static __thread unsigned int x3;
the following code, which makes no reference to GOT entries. The GOT the following code, which makes no reference to GOT entries. The GOT
entries in entries in
<xref linkend="dbdoclet.50655241_16273" /> can be removed from the GOT by <xref linkend="dbdoclet.50655241_16273" /> can be removed from the GOT by
the linker when performing this code transformation. the linker when performing this code transformation.<footnote xml:id="pgfId-1134055">
<footnote xml:id="pgfId-1134055">
<para>To further optimize the code in <para>To further optimize the code in
<xref linkend="dbdoclet.50655241_16273" />, a linker may reschedule the <xref linkend="dbdoclet.50655241_16273" />, a linker may reschedule the
sequence to exploit fusion by generating a sequence that may be fused sequence to exploit fusion by generating a sequence that may be fused
@ -6251,7 +6250,7 @@ nop</programlisting>
<para> <para>
<orderedlist> <orderedlist>
<listitem xml:id="dbdoclet.50655241_21152"> <listitem xml:id="dbdoclet.50655241_21152">
<para>1. The linker may prefer to schedule the addis and <para>The linker may prefer to schedule the addis and
addi to be adjacent to take advantage of fusion as a addi to be adjacent to take advantage of fusion as a
microarchitecture optimization opportunity.</para> microarchitecture optimization opportunity.</para>
</listitem> </listitem>
@ -6703,7 +6702,7 @@ nop</programlisting>
<para>The result of performing a relocation for a TLS symbol is the <para>The result of performing a relocation for a TLS symbol is the
module ID and its offset within the TLS block. These are then stored in module ID and its offset within the TLS block. These are then stored in
the GOT. Later, they are obtained by the dynamic linker at run-time and the GOT. Later, they are obtained by the dynamic linker at run-time and
passed to __tls_get_addr(), which returns the address for the variable passed to __tls_get_addr( ), which returns the address for the variable
for the current thread.</para> for the current thread.</para>
<para>For more information, see <para>For more information, see
<xref linkend="dbdoclet.50655241_18894" />. For TLS relocations, see <xref linkend="dbdoclet.50655241_18894" />. For TLS relocations, see

@ -141,7 +141,7 @@ xmlns:xl="http://www.w3.org/1999/xlink" version="5.0" xml:lang="en">
</tgroup> </tgroup>
</table> </table>
<note> <note>
<para>Note: For the PT_LOAD entry describing the data segment, the <para>For the PT_LOAD entry describing the data segment, the
p_memsz may be greater than the p_filesz. The difference is the size of p_memsz may be greater than the p_filesz. The difference is the size of
the .bss section. On implementations that use virtual memory file the .bss section. On implementations that use virtual memory file
mapping, only the portion of the file between the .data p_offset mapping, only the portion of the file between the .data p_offset
@ -152,7 +152,7 @@ xmlns:xl="http://www.w3.org/1999/xlink" version="5.0" xml:lang="en">
data through p_vaddr + p_memsz.</para> data through p_vaddr + p_memsz.</para>
</note> </note>
<para> <para>
<xref linkend="dbdoclet.50655242_44623" /> demonstrates a typical mapping of <xref linkend="dbdoclet.50655242_45730" /> demonstrates a typical mapping of
file to memory segments.</para> file to memory segments.</para>
<table frame="all" pgwide="1" xml:id="dbdoclet.50655242_45730"> <table frame="all" pgwide="1" xml:id="dbdoclet.50655242_45730">
<title>Memory Segment Mappings</title> <title>Memory Segment Mappings</title>
@ -341,8 +341,8 @@ xmlns:xl="http://www.w3.org/1999/xlink" version="5.0" xml:lang="en">
argument passing. For example, a C program might typically issue the argument passing. For example, a C program might typically issue the
following declaration to begin executing at the local entry point of a following declaration to begin executing at the local entry point of a
function named main:</para> function named main:</para>
<programlisting revisionflag="changed">extern int main (int argc, char *argv[], char *envp[], void *auxv[]); <programlisting revisionflag="changed">extern int main (int argc, char *argv[ ], char *envp[ ], void *auxv[ ]);
int main(int argc, char *argv[], char *envp[], ElfW(auxv_t) *auxvec)</programlisting> int main(int argc, char *argv[ ], char *envp[ ], ElfW(auxv_t) *auxvec)</programlisting>
<para>where:</para> <para>where:</para>
<itemizedlist mark="none"> <itemizedlist mark="none">
<listitem> <listitem>
@ -366,192 +366,190 @@ int main(int argc, char *argv[], char *envp[], ElfW(auxv_t) *auxvec)</programlis
</itemizedlist> </itemizedlist>
<para>This section explains how to implement the call to main or to the <para>This section explains how to implement the call to main or to the
entry point.</para> entry point.</para>
</section>
<section xml:id="dbdoclet.50655242___RefHeading___Toc377640653"> <section xml:id="dbdoclet.50655242___RefHeading___Toc377640653">
<title>Registers <title xml:id="dbdoclet.50655242_PROC-REG">Registers</title>
<anchor xml:id="dbdoclet.50655242_PROC-REG" <para>The contents of most registers are
xreflabel="" /> Registers</title> <emphasis>not</emphasis> specified when a process is first entered from an
<para>The contents of most registers are exec system call. A program should not expect the operating system to set
<emphasis>not</emphasis> specified when a process is first entered from an all registers to 0. If a register other than those listed in
exec system call. A program should not expect the operating system to set <xref linkend="dbdoclet.50655242_74550" /> must have a specific value, the
all registers to 0. If a register other than those listed in program must set it to that value during process initialization.</para>
<xref linkend="dbdoclet.50655242_74550" /> must have a specific value, the <para>The contents of the following registers
program must set it to that value during process initialization.</para> <emphasis>are</emphasis> specified:</para>
<para>The contents of the following registers <para> </para>
<emphasis>are</emphasis> specified:</para> <table frame="all" pgwide="1" xml:id="dbdoclet.50655242_74550">
<para> </para> <title>Registers Specified during Process Initialization</title>
<table frame="all" pgwide="1" xml:id="dbdoclet.50655242_74550"> <tgroup cols="2">
<title>Registers Specified during Process Initialization</title> <colspec colname="c1" colwidth="15*" align="center"/>
<tgroup cols="2"> <colspec colname="c2" colwidth="85*" />
<colspec colname="c1" colwidth="15*" align="center"/> <thead>
<colspec colname="c2" colwidth="85*" /> <row>
<thead> <entry>
<row> <para>
<entry> <emphasis role="bold">Register</emphasis>
<para> </para>
<emphasis role="bold">Register</emphasis> </entry>
</para> <entry align="center">
</entry> <para>
<entry align="center"> <emphasis role="bold">Description</emphasis>
<para> </para>
<emphasis role="bold">Description</emphasis> </entry>
</para> </row>
</entry> </thead>
</row> <tbody>
</thead> <row>
<tbody> <entry>
<row> <para>r1</para>
<entry> </entry>
<para>r1</para> <entry>
</entry> <para>The initial stack pointer, aligned to a quadword
<entry> boundary.</para>
<para>The initial stack pointer, aligned to a quadword </entry>
boundary.</para> </row>
</entry> <row>
</row> <entry>
<row> <para>r2</para>
<entry> </entry>
<para>r2</para> <entry>
</entry> <para>Undefined.</para>
<entry> </entry>
<para>Undefined.</para> </row>
</entry> <row>
</row> <entry>
<row> <para>r3</para>
<entry> </entry>
<para>r3</para> <entry>
</entry> <para>Contains argc, the nonnegative argument count.</para>
<entry> </entry>
<para>Contains argc, the nonnegative argument count.</para> </row>
</entry> <row>
</row> <entry>
<row> <para>r4</para>
<entry> </entry>
<para>r4</para> <entry>
</entry> <para>Contains argv, a pointer to the array of argument
<entry> pointers in the stack. The array is immediately followed by a
<para>Contains argv, a pointer to the array of argument NULL pointer. If there are no arguments, r4 points to a NULL
pointers in the stack. The array is immediately followed by a pointer.</para>
NULL pointer. If there are no arguments, r4 points to a NULL </entry>
pointer.</para> </row>
</entry> <row>
</row> <entry>
<row> <para>r5</para>
<entry> </entry>
<para>r5</para> <entry>
</entry> <para>Contains envp, a pointer to the array of environment
<entry> pointers in the stack. The array is immediately followed by a
<para>Contains envp, a pointer to the array of environment NULL pointer. If no environment exists, r5 points to a NULL
pointers in the stack. The array is immediately followed by a pointer.</para>
NULL pointer. If no environment exists, r5 points to a NULL </entry>
pointer.</para> </row>
</entry> <row>
</row> <entry>
<row> <para>r6</para>
<entry> </entry>
<para>r6</para> <entry>
</entry> <para>Contains a pointer to the auxiliary vector. The auxiliary
<entry> vector shall have at least one member, a terminating entry with
<para>Contains a pointer to the auxiliary vector. The auxiliary an a_type of AT_NULL (see
vector shall have at least one member, a terminating entry with <xref linkend="dbdoclet.50655242_98651" />).</para>
an a_type of AT_NULL (see </entry>
<xref linkend="dbdoclet.50655242_98651" />).</para> </row>
</entry> <row>
</row> <entry>
<row> <para>r7</para>
<entry> </entry>
<para>r7</para> <entry>
</entry> <para>Contains a termination function pointer. If r7 contains a
<entry> nonzero value, the value represents a function pointer that the
<para>Contains a termination function pointer. If r7 contains a application should register with atexit. If r7 contains zero,
nonzero value, the value represents a function pointer that the no action is required.</para>
application should register with atexit. If r7 contains zero, </entry>
no action is required.</para> </row>
</entry> <row>
</row> <entry>
<row> <para>r12</para>
<entry> </entry>
<para>r12</para> <entry>
</entry> <para>Contains the address of the global entry point of the
<entry> first function being invoked, which represents the start
<para>Contains the address of the global entry point of the address of the executable specified in the exec call.</para>
first function being invoked, which represents the start </entry>
address of the executable specified in the exec call.</para> </row>
</entry> <row>
</row> <entry>
<row> <para>FPSCR</para>
<entry> </entry>
<para>FPSCR</para> <entry>
</entry> <para>Contains 0, specifying “round to nearest” mode for both
<entry> binary and decimal rounding modes, IEEE Mode, and the disabling
<para>Contains 0, specifying “round to nearest” mode for both of floating-point exceptions.</para>
binary and decimal rounding modes, IEEE Mode, and the disabling </entry>
of floating-point exceptions.</para> </row>
</entry> <row>
</row> <entry>
<row> <para>VSCR</para>
<entry> </entry>
<para>VSCR</para> <entry>
</entry> <para>Vector Status and Control Register. Contains 0,
<entry> specifying vector Java/IEEE mode and that no saturation has
<para>Vector Status and Control Register. Contains 0, occurred.</para>
specifying vector Java/IEEE mode and that no saturation has </entry>
occurred.</para> </row>
</entry> </tbody>
</row> </tgroup>
</tbody> </table>
</tgroup> <para>The run-time that gets control from _start is responsible for:</para>
</table> <itemizedlist spacing="compact">
<para>The run-time that gets control from _start is responsible for:</para> <listitem>
<itemizedlist spacing="compact"> <para>Creating the first stack frame</para>
<listitem> </listitem>
<para>Creating the first stack frame</para> <listitem>
</listitem> <para>Initializing the first stack frame's back chain pointer to
<listitem> NULL</para>
<para>Initializing the first stack frame's back chain pointer to </listitem>
NULL</para> <listitem>
</listitem> <para>Allocating and initializing TLS storage</para>
<listitem> </listitem>
<para>Allocating and initializing TLS storage</para> <listitem>
</listitem> <para>Initializing the thread control block (TCB) and dynamic thread
<listitem> vector (DTV)</para>
<para>Initializing the thread control block (TCB) and dynamic thread </listitem>
vector (DTV)</para> <listitem>
</listitem> <para>Initializing any __thread variables</para>
<listitem> </listitem>
<para>Initializing any __thread variables</para> <listitem>
</listitem> <para>Setting R13 for the initial process thread.</para>
<listitem> </listitem>
<para>Setting R13 for the initial process thread.</para> </itemizedlist>
</listitem> <para>This initialization must be completed before any library
</itemizedlist> initialization codes are run and before control is transferred to the
<para>This initialization must be completed before any library main program (main( )).</para>
initialization codes are run and before control is transferred to the </section>
main program (main()).</para> <section xml:id="dbdoclet.50655242_83727">
</section> <title>Process Stack</title>
<section xml:id="dbdoclet.50655242_83727"> <para>Although every process has a stack, no fixed stack address is
<title>Process Stack</title> defined by the system. In addition, a program's stack address can change
<para>Although every process has a stack, no fixed stack address is from one system to another. It can even change from one process
defined by the system. In addition, a program's stack address can change invocation to another. Thus, the process initialization code must use the
from one system to another. It can even change from one process stack address in general-purpose register r1. Data in the stack segment
invocation to another. Thus, the process initialization code must use the at addresses below the stack pointer contain undefined values.</para>
stack address in general-purpose register r1. Data in the stack segment </section>
at addresses below the stack pointer contain undefined values.</para> <section xml:id="dbdoclet.50655242_98651">
</section> <title>Auxiliary Vector</title>
<section xml:id="dbdoclet.50655242_98651"> <para>The argument and environment vectors transmit information from one
<title>Auxiliary Vector</title> application program to another. However, the auxiliary vector conveys
<para>The argument and environment vectors transmit information from one information from the operating system to the program. This vector is an
application program to another. However, the auxiliary vector conveys array of structures, defined as follows:</para>
information from the operating system to the program. This vector is an <programlisting>typedef struct
array of structures, defined as follows:</para>
<programlisting>typedef struct
{ {
long a_type; long a_type;
union union
{ {
long a_val; long a_val;
void *a_ptr; void *a_ptr;
void (*a_fcn)(); void (*a_fcn)( );
} a_un; } a_un;
} auxv_t; } auxv_t;
@ -571,7 +569,7 @@ AT_EGID 14 /* Effective group ID (egid) */
AT_PLATFORM 15 a_ptr /* String identifying platform. */ AT_PLATFORM 15 a_ptr /* String identifying platform. */
AT_HWCAP 16 a_val /* Machine-dependent hints about AT_HWCAP 16 a_val /* Machine-dependent hints about
processor capabilities. */ processor capabilities. */
AT_CLKTCK 17 /* Frequency of times(), always 100 */ AT_CLKTCK 17 /* Frequency of times( ), always 100 */
AT_DCACHEBSIZE 19 a_val /* Data cache block size */ AT_DCACHEBSIZE 19 a_val /* Data cache block size */
AT_ICACHEBSIZE 20 a_val /* Instruction cache block size */ AT_ICACHEBSIZE 20 a_val /* Instruction cache block size */
AT_UCACHEBSIZE 21 a_val /* Unified cache block size */ AT_UCACHEBSIZE 21 a_val /* Unified cache block size */
@ -591,72 +589,72 @@ AT_SYSINFO_EHDR 33 /* In many architectures, the kernel
VDSO header that is used by the VDSO header that is used by the
dynamic linker to resolve function dynamic linker to resolve function
symbols with the VDSO. */</programlisting> symbols with the VDSO. */</programlisting>
<para>AT_NULL</para> <para>AT_NULL</para>
<para>The auxiliary vector has no fixed length; instead an entry of this <para>The auxiliary vector has no fixed length; instead an entry of this
type denotes the end of the vector. The corresponding value of a_un is type denotes the end of the vector. The corresponding value of a_un is
undefined.</para> undefined.</para>
<para>AT_PHDR</para> <para>AT_PHDR</para>
<para>Under some conditions, the system creates the memory image of the <para>Under some conditions, the system creates the memory image of the
application program before passing control to an interpreter program. application program before passing control to an interpreter program.
When this happens, the a_ptr member of the AT_PHDR entry tells the When this happens, the a_ptr member of the AT_PHDR entry tells the
interpreter where to find the program header table in the memory image. interpreter where to find the program header table in the memory image.
If the AT_PHDR entry is present, entries of types AT_PHENT, AT_PHNUM, and If the AT_PHDR entry is present, entries of types AT_PHENT, AT_PHNUM, and
AT_ENTRY must also be present. See the Program Header section in Chapter AT_ENTRY must also be present. See the Program Header section in Chapter
5 of the 5 of the
<citetitle>System V ABI</citetitle> for more information about the program <citetitle>System V ABI</citetitle> for more information about the program
header table.</para> header table.</para>
<para>AT_PHENT</para> <para>AT_PHENT</para>
<para>The a_val member of this entry holds the size, in bytes, of one <para>The a_val member of this entry holds the size, in bytes, of one
entry in the program header table to which the AT_PHDR entry entry in the program header table to which the AT_PHDR entry
points.</para> points.</para>
<para>AT_PHNUM</para> <para>AT_PHNUM</para>
<para>The a_val member of this entry holds the number of entries in the <para>The a_val member of this entry holds the number of entries in the
program header table to which the AT_PHDR entry points.</para> program header table to which the AT_PHDR entry points.</para>
<para>AT_PAGESZ</para> <para>AT_PAGESZ</para>
<para>If present, this entry's a_val member gives the system page size in <para>If present, this entry's a_val member gives the system page size in
bytes. The same information is also available through the sysconf system bytes. The same information is also available through the sysconf system
call.</para> call.</para>
<para>AT_BASE</para> <para>AT_BASE</para>
<para>The a_ptr member of this entry holds the base address at which the <para>The a_ptr member of this entry holds the base address at which the
interpreter program was loaded into memory. See the Program Header interpreter program was loaded into memory. See the Program Header
section in Chapter 5 of the section in Chapter 5 of the
<citetitle>System V ABI</citetitle> for more information about the base <citetitle>System V ABI</citetitle> for more information about the base
address.</para> address.</para>
<para>AT_FLAGS</para> <para>AT_FLAGS</para>
<para>If present, the a_val member of this entry holds 1-bit flags. Bits <para>If present, the a_val member of this entry holds 1-bit flags. Bits
with undefined semantics are set to zero. Other auxiliary vector types with undefined semantics are set to zero. Other auxiliary vector types
are reserved. No flags are currently defined for AT_FLAGS on the 64-bit are reserved. No flags are currently defined for AT_FLAGS on the 64-bit
OpenPOWER ABI Architecture.</para> OpenPOWER ABI Architecture.</para>
<para>AT_ENTRY</para> <para>AT_ENTRY</para>
<para>The a_ptr member of this entry holds the entry point of the <para>The a_ptr member of this entry holds the entry point of the
application program to which the interpreter program should transfer application program to which the interpreter program should transfer
control.</para> control.</para>
<para>AT_DCACHEBSIZE</para> <para>AT_DCACHEBSIZE</para>
<para>The a_val member of this entry gives the data cache block size for <para>The a_val member of this entry gives the data cache block size for
processors on the system on which this program is running. If the processors on the system on which this program is running. If the
processors have unified caches, AT_DCACHEBSIZE is the same as processors have unified caches, AT_DCACHEBSIZE is the same as
AT_UCACHEBSIZE.</para> AT_UCACHEBSIZE.</para>
<para>AT_ICACHEBSIZE</para> <para>AT_ICACHEBSIZE</para>
<para>The a_val member of this entry gives the instruction cache block <para>The a_val member of this entry gives the instruction cache block
size for processors on the system on which this program is running. If size for processors on the system on which this program is running. If
the processors have unified caches, AT_ICACHEBSIZE is the same as the processors have unified caches, AT_ICACHEBSIZE is the same as
AT_UCACHEBSIZE.</para> AT_UCACHEBSIZE.</para>
<para>AT_UCACHEBSIZE</para> <para>AT_UCACHEBSIZE</para>
<para>The a_val member of this entry is zero if the processors on the <para>The a_val member of this entry is zero if the processors on the
system on which this program is running do not have a unified instruction system on which this program is running do not have a unified instruction
and data cache. Otherwise, it gives the cache block size.</para> and data cache. Otherwise, it gives the cache block size.</para>
<para>AT_PLATFORM</para> <para>AT_PLATFORM</para>
<para>The a_ptr member is the address of the platform name string. For <para>The a_ptr member is the address of the platform name string. For
virtualized systems, this may be different (that is, an older platform) virtualized systems, this may be different (that is, an older platform)
than the physical machine running this environment.</para> than the physical machine running this environment.</para>
<para>AT_BASE_PLATFORM</para> <para>AT_BASE_PLATFORM</para>
<para>The a_ptr member is the address of the platform name string for the <para>The a_ptr member is the address of the platform name string for the
physical machine. For virtualized systems, this will be the platform name physical machine. For virtualized systems, this will be the platform name
of the real hardware.</para> of the real hardware.</para>
<para>AT_HWCAP</para> <para>AT_HWCAP</para>
<para>The a_val member of this entry is a bit map of hardware <para>The a_val member of this entry is a bit map of hardware
capabilities. Some bit mask values include:</para> capabilities. Some bit mask values include:</para>
<programlisting>PPC_FEATURE_32 0x80000000 /* Always set for powerpc64 */ <programlisting>PPC_FEATURE_32 0x80000000 /* Always set for powerpc64 */
PPC_FEATURE_64 0x40000000 /* Always set for powerpc64 */ PPC_FEATURE_64 0x40000000 /* Always set for powerpc64 */
PPC_FEATURE_HAS_ALTIVEC 0x10000000 PPC_FEATURE_HAS_ALTIVEC 0x10000000
PPC_FEATURE_HAS_FPU 0x08000000 PPC_FEATURE_HAS_FPU 0x08000000
@ -690,15 +688,17 @@ PPC_FEATURE2_HAS_ISEL 0x08000000 /* Integer Select */
PPC_FEATURE2_HAS_TAR 0x04000000 /* Target Address Register */ PPC_FEATURE2_HAS_TAR 0x04000000 /* Target Address Register */
PPC_FEATURE2_HAS_VCRYPTO 0x02000000 /* The processor implements the PPC_FEATURE2_HAS_VCRYPTO 0x02000000 /* The processor implements the
Vector.AES category */</programlisting> Vector.AES category */</programlisting>
<para>When a process starts to execute, its stack holds the arguments, <para>When a process starts to execute, its stack holds the arguments,
environment, and auxiliary vector received from the exec call. The system environment, and auxiliary vector received from the exec call. The system
makes no guarantees about the relative arrangement of argument strings, makes no guarantees about the relative arrangement of argument strings,
environment strings, and the auxiliary information, which appear in no environment strings, and the auxiliary information, which appear in no
defined or predictable order. Further, the system may allocate memory defined or predictable order. Further, the system may allocate memory
after the null auxiliary vector entry and before the beginning of the after the null auxiliary vector entry and before the beginning of the
information block.</para> information block.</para>
</section>
</section> </section>
</section> </section>
<section> <section>
<title>Dynamic Linking</title> <title>Dynamic Linking</title>
<section xml:id="dbdoclet.50655242___RefHeading___Toc377640656"> <section xml:id="dbdoclet.50655242___RefHeading___Toc377640656">
@ -709,8 +709,7 @@ PPC_FEATURE2_HAS_VCRYPTO 0x02000000 /* The processor implements the
</section> </section>
<section> <section>
<title>Dynamic Section</title> <title>Dynamic Section</title>
<para> <para><anchor xml:id="dbdoclet.50655242_page119" xreflabel="" />The dynamic
<anchor xml:id="dbdoclet.50655242_page119" xreflabel="" /> The dynamic
section provides information used by the dynamic linker to manage section provides information used by the dynamic linker to manage
dynamically loaded shared objects, including relocation, initialization, dynamically loaded shared objects, including relocation, initialization,
and termination when loaded or unloaded, resolving dependencies on other and termination when loaded or unloaded, resolving dependencies on other
@ -877,189 +876,190 @@ PPC_FEATURE2_HAS_VCRYPTO 0x02000000 /* The processor implements the
stored in the file image. The individual PLT entries are populated by the stored in the file image. The individual PLT entries are populated by the
dynamic linker using one of the following binding methods. Execution can dynamic linker using one of the following binding methods. Execution can
then be redirected to a dependent shared object or executable.</para> then be redirected to a dependent shared object or executable.</para>
</section>
<section> <section>
<title>Lazy Binding</title> <title>Lazy Binding</title>
<para>The lazy binding method is the default. It delays the resolution of <para>The lazy binding method is the default. It delays the resolution of
a PLT entry to an absolute address until the function call is made the a PLT entry to an absolute address until the function call is made the
first time. The benefit of this method is that the application does not first time. The benefit of this method is that the application does not
pay the resolution cost until the first time it needs to call the pay the resolution cost until the first time it needs to call the
function, if at all.</para> function, if at all.</para>
<para>To implement lazy binding, the dynamic loader points each PLT entry <para>To implement lazy binding, the dynamic loader points each PLT entry
to a lazy resolution stub at load time. After the function call is made to a lazy resolution stub at load time. After the function call is made
the first time, this lazy resolution stub gets control, resolves the the first time, this lazy resolution stub gets control, resolves the
symbol, and updates the PLT entry to hold the final value to be used for symbol, and updates the PLT entry to hold the final value to be used for
future calls.</para> future calls.</para>
</section> </section>
<section xml:id="dbdoclet.50655242_93623"> <section xml:id="dbdoclet.50655242_93623">
<title>Immediate Binding</title> <title>Immediate Binding</title>
<para>The immediate binding method resolves the absolute addresses of all <para>The immediate binding method resolves the absolute addresses of all
PLT entries in the executable and dependent shared objects at load time, PLT entries in the executable and dependent shared objects at load time,
before passing execution control to the application. The environment before passing execution control to the application. The environment
variable LD_BIND_NOW may be set to a nonnull value to signal the dynamic variable LD_BIND_NOW may be set to a nonnull value to signal the dynamic
linker that immediate binding is requested at load time, before control linker that immediate binding is requested at load time, before control
is given to the application.</para> is given to the application.</para>
<para>For some performance-sensitive situations, it may be better to pay <para>For some performance-sensitive situations, it may be better to pay
the resolution cost to populate the PLT entries up front rather than the resolution cost to populate the PLT entries up front rather than
during execution.</para> during execution.</para>
</section> </section>
<section xml:id="dbdoclet.50655242_82622"> <section xml:id="dbdoclet.50655242_82622">
<title>Procedure Linkage Table</title> <title>Procedure Linkage Table</title>
<para>For every call site that needs to use the PLT, the link editor <para>For every call site that needs to use the PLT, the link editor
constructs a call stub in the .text section and resolves the call site to constructs a call stub in the .text section and resolves the call site to
use that call stub. The call stub transfers control to the address use that call stub. The call stub transfers control to the address
indicated in the PLT entry. These call stubs need not be adjacent to one indicated in the PLT entry. These call stubs need not be adjacent to one
another or unique. They can be scattered throughout the text segment so another or unique. They can be scattered throughout the text segment so
that they can be reached with a branch and link instruction.</para> that they can be reached with a branch and link instruction.</para>
<para>Depending on relocation information at the call site, the stub <para>Depending on relocation information at the call site, the stub
provides one of the following properties:</para> provides one of the following properties:</para>
<orderedlist> <orderedlist>
<listitem> <listitem>
<para>The caller has set up r2 to hold the TOC pointer and expects <para>The caller has set up r2 to hold the TOC pointer and expects
the PLT call stub to save that value to the TOC save stack slot. This the PLT call stub to save that value to the TOC save stack slot. This
is the default.</para> is the default.</para>
</listitem> </listitem>
<listitem> <listitem>
<para>The caller has set up r2 to hold the TOC pointer and has <para>The caller has set up r2 to hold the TOC pointer and has
already saved that value to the TOC save stack slot itself. This is already saved that value to the TOC save stack slot itself. This is
indicated by the presence of a R_PPC64_TOCSAVE relocation on the nop indicated by the presence of a R_PPC64_TOCSAVE relocation on the nop
following the call.</para> following the call.</para>
</listitem> </listitem>
</orderedlist> </orderedlist>
<programlisting>tocsaveloc: <programlisting>tocsaveloc:
nop nop
... ...
bl target bl target
.reloc ., R_PPC64_TOCSAVE, tocsaveloc .reloc ., R_PPC64_TOCSAVE, tocsaveloc
nop</programlisting> nop</programlisting>
<orderedlist> <orderedlist>
<listitem> <listitem>
<para>3. The caller has not set up r2 to hold the TOC pointer. This <para>3. The caller has not set up r2 to hold the TOC pointer. This
is indicated by use of a R_PPC64_REL24_NOTOC relocation (instead of is indicated by use of a R_PPC64_REL24_NOTOC relocation (instead of
R_PPC64_REL24) on the call instruction.</para> R_PPC64_REL24) on the call instruction.</para>
</listitem> </listitem>
</orderedlist> </orderedlist>
<para>In any scenario, the PLT call stub must transfer control to the <para>In any scenario, the PLT call stub must transfer control to the
function whose address is provided in the associated PLT entry. This function whose address is provided in the associated PLT entry. This
address is treated as a global entry point for ABI purposes. This means address is treated as a global entry point for ABI purposes. This means
that the PLT call stub loads the address into r12 before transferring that the PLT call stub loads the address into r12 before transferring
control.</para> control.</para>
<para>Although the details of the call stub implementation are left to <para>Although the details of the call stub implementation are left to
the link editor, some examples are provided. In those examples, func@plt the link editor, some examples are provided. In those examples, func@plt
is used to denote the address of the PLT entry for func; func@plt@toc is used to denote the address of the PLT entry for func; func@plt@toc
denotes the offset of that address relative to the TOC pointer; and the denotes the offset of that address relative to the TOC pointer; and the
@ha and @l variants denote the high-adjusted and low parts of these @ha and @l variants denote the high-adjusted and low parts of these
values as usual. Because the link editor synthesizes the PLT call stubs values as usual. Because the link editor synthesizes the PLT call stubs
directly, it can determine all these values as immediate constants. The directly, it can determine all these values as immediate constants. The
assembler is not required to support those notations.</para> assembler is not required to support those notations.</para>
<para>A possible implementation for case 1 looks as follows (if <para>A possible implementation for case 1 looks as follows (if
func@plt@toc is less than 32 KB, the call stub may be simplified to omit func@plt@toc is less than 32 KB, the call stub may be simplified to omit
the addis):</para> the addis):</para>
<programlisting>std r2,24(r1) <programlisting>std r2,24(r1)
addis r12,r2,func@plt@toc@ha addis r12,r2,func@plt@toc@ha
ld r12,func@plt@toc@l(r12) ld r12,func@plt@toc@l(r12)
mtctr r12 mtctr r12
bctr</programlisting> bctr</programlisting>
<para>For case 2, the same implementation as for case 1 may be used, <para>For case 2, the same implementation as for case 1 may be used,
except that the first instruction “std r2,24(r1)” is omitted:</para> except that the first instruction “std r2,24(r1)” is omitted:</para>
<programlisting>addis r12,r2,func@plt@toc@ha <programlisting>addis r12,r2,func@plt@toc@ha
ld r12,func@plt@toc@l(r12) ld r12,func@plt@toc@l(r12)
mtctr r12 mtctr r12
bctr</programlisting> bctr</programlisting>
<para> <para><anchor xml:id="dbdoclet.50655242___DdeLink__61883_1749258592"
<anchor xml:id="dbdoclet.50655242___DdeLink__61883_1749258592" xreflabel="" />A possible implementation for case 3 looks as
xreflabel="" /> A possible implementation for case 3 looks as follows:</para>
follows:</para> <programlisting> mflr r0
<programlisting> mflr r0 bcl 20,31,1f
bcl 20,31,1f 1: mflr r2
1: mflr r2 mtlr r0
mtlr r0 addis r2,r2,(.TOC.-1b)@ha
addis r2,r2,(.TOC.-1b)@ha addi r2,r2,(.TOC.-1b)@l
addi r2,r2,(.TOC.-1b)@l addis r12,r2,func@plt@toc@ha
addis r12,r2,func@plt@toc@ha ld r12,func@plt@toc@l(r12)
ld r12,func@plt@toc@l(r12) mtctr r12
mtctr r12 bctr</programlisting>
bctr</programlisting> <para>When generating non-PIC code for the small or medium code model, a
<para>When generating non-PIC code for the small or medium code model, a simpler variant may alternatively be used for cases 2 or 3:</para>
simpler variant may alternatively be used for cases 2 or 3:</para> <programlisting>lis r12,func@plt@ha
<programlisting>lis r12,func@plt@ha ld r12,func@plt@l(r12)
ld r12,func@plt@l(r12) mtctr r12
mtctr r12 bctr</programlisting>
bctr</programlisting> <para>To support lazy binding, the link editor also provides a set of
<para>To support lazy binding, the link editor also provides a set of symbol resolver stubs, one for each PLT entry. Each resolver stub
symbol resolver stubs, one for each PLT entry. Each resolver stub consists of a single instruction, which is usually a branch to a common
consists of a single instruction, which is usually a branch to a common resolver entry point or a nop. The resolver stubs are placed in the
resolver entry point or a nop. The resolver stubs are placed in the .glink section, which is merged into the .text section of the final
.glink section, which is merged into the .text section of the final executable or dynamic object. The address of the resolver stubs is
executable or dynamic object. The address of the resolver stubs is communicated to the dynamic loader through the DT_PPC64_GLINK dynamic
communicated to the dynamic loader through the DT_PPC64_GLINK dynamic section entry. The address of the symbol resolver stub associated with
section entry. The address of the symbol resolver stub associated with PLT entry N is determined by adding 4xN + 32 to the d_ptr field of the
PLT entry N is determined by adding 4xN + 32 to the d_ptr field of the DT_PPC64_GLINK entry. When using lazy binding, the dynamic linker
DT_PPC64_GLINK entry. When using lazy binding, the dynamic linker initializes each PLT entry at load time to that address.</para>
initializes each PLT entry at load time to that address.</para> <para>The resolver stubs provided by the link editor must call into the
<para>The resolver stubs provided by the link editor must call into the main resolver routine provided by the dynamic linker. This resolver
main resolver routine provided by the dynamic linker. This resolver routine must be called with r0 set to the index of the PLT entry to be
routine must be called with r0 set to the index of the PLT entry to be resolved, r11 set to the identifier of the current dynamic object, and
resolved, r11 set to the identifier of the current dynamic object, and r12 set to the resolver entry point address (as usual when calling a
r12 set to the resolver entry point address (as usual when calling a global entry point). The resolver entry point address and the dynamic
global entry point). The resolver entry point address and the dynamic object identifier are installed at load time by the dynamic linker into
object identifier are installed at load time by the dynamic linker into the two doublewords immediately preceding the array of PLT entries,
the two doublewords immediately preceding the array of PLT entries, allowing the resolver stubs to retrieve these values from there. These
allowing the resolver stubs to retrieve these values from there. These two doublewords are considered part of the .plt section; the DT_PLTGOT
two doublewords are considered part of the .plt section; the DT_PLTGOT dynamic section entry points to the first of those words.</para>
dynamic section entry points to the first of those words.</para> <para>Beyond the above requirements, the implementation of the .glink
<para>Beyond the above requirements, the implementation of the .glink resolver stubs is up to the link editor. The following shows an example
resolver stubs is up to the link editor. The following shows an example implementation:</para>
implementation:</para> <programlisting> # ABI note: At entry to the resolver stub:
<programlisting> # ABI note: At entry to the resolver stub: # - r12 holds the address of the res_N stub for the target routine
# - r12 holds the address of the res_N stub for the target routine # - all argument registers hold arguments for the target routine
# - all argument registers hold arguments for the target routine PLTresolve:
PLTresolve: # Determine addressability. This sequence works for both PIC
# Determine addressability. This sequence works for both PIC # and non-PIC code and does not rely on presence of the TOC pointer.
# and non-PIC code and does not rely on presence of the TOC pointer. mflr r0
mflr r0 bcl 20,31,1f
bcl 20,31,1f 1: mflr r11
1: mflr r11 mtlr r0
mtlr r0 # Compute .plt section index from entry point address in r12
# Compute .plt section index from entry point address in r12 # .plt section index is placed into r0 as argument to the resolver
# .plt section index is placed into r0 as argument to the resolver sub r0,r12,r11
sub r0,r12,r11 subi r0,r0,res_0-1b
subi r0,r0,res_0-1b srdi r0,r0,2
srdi r0,r0,2 # Load address of the first byte of the PLT
# Load address of the first byte of the PLT ld r12,PLToffset-1b(r11)
ld r12,PLToffset-1b(r11) add r11,r12,r11
add r11,r12,r11 # Load resolver address and DSO identifier from the
# Load resolver address and DSO identifier from the # first two doublewords of the PLT
# first two doublewords of the PLT ld r12,0(r11)
ld r12,0(r11) ld r11,8(r11)
ld r11,8(r11) # Branch to resolver
# Branch to resolver mtctr r12
mtctr r12 bctr
bctr # ABI note: At entry to the resolver:
# ABI note: At entry to the resolver: # - r12 holds the resolver address
# - r12 holds the resolver address # - r11 holds the DSO identifier
# - r11 holds the DSO identifier # - r0 holds the PLT index of the target routine
# - r0 holds the PLT index of the target routine # - all argument registers hold arguments for the target routine
# - all argument registers hold arguments for the target routine
# Constant pool holding offset to the PLT
# Constant pool holding offset to the PLT # Note that there is no actual symbol PLT; the link editor
# Note that there is no actual symbol PLT; the link editor # synthesizes this value when creating the .glink section
# synthesizes this value when creating the .glink section PLToffset:
PLToffset: .quad PLT-.
.quad PLT-.
# A table of branches, one for each PLT entry
# A table of branches, one for each PLT entry # The idea is that the PLT call stub loads r12 with these
# The idea is that the PLT call stub loads r12 with these # addresses, so (r12 - res_0) gives the PLT index × 4.
# addresses, so (r12 - res_0) gives the PLT index × 4.
res_0: b PLTresolve
res_0: b PLTresolve res_1: b PLTresolve
res_1: b PLTresolve ...</programlisting>
...</programlisting> <para>After resolution, the value of a PLT entry in the PLT is the
<para>After resolution, the value of a PLT entry in the PLT is the address of the functions global entry point, unless the resolver can
address of the functions global entry point, unless the resolver can determine that a module-local call occurs with a shared TOC value wherein
determine that a module-local call occurs with a shared TOC value wherein the TOC is shared between the caller and the callee.</para>
the TOC is shared between the caller and the callee.</para> <para> </para>
<para> </para> </section>
</section> </section>
</section> </section>

</chapter> </chapter>

@ -17,7 +17,7 @@ xml:id="dbdoclet.50655243_pgfId-1099317">
<para /> <para />
<section xml:id="dbdoclet.50655243___RefHeading___Toc377640667"> <section xml:id="dbdoclet.50655243___RefHeading___Toc377640667">
<title>Malloc Routine Return Pointer Alignment</title> <title>Malloc Routine Return Pointer Alignment</title>
<para>The malloc() routine must always return a pointer with the <para>The malloc( ) routine must always return a pointer with the
alignment of the largest alignment needed for loads and stores of the alignment of the largest alignment needed for loads and stores of the
built-in data types. This is currently 16 bytes.</para> built-in data types. This is currently 16 bytes.</para>
</section> </section>
@ -195,8 +195,7 @@ xml:id="dbdoclet.50655243_pgfId-1099317">
<entry> <entry>
<para>__PPC64__</para> <para>__PPC64__</para>
<para>__powerpc64__</para> <para>__powerpc64__</para>
<para>__64BIT__ <para>__64BIT__<footnote xml:id="pgfId-1101811">
<footnote xml:id="pgfId-1101811">
<para>Phased in.</para> <para>Phased in.</para>
</footnote></para> </footnote></para>
</entry> </entry>

@ -60,7 +60,7 @@ xml:id="dbdoclet.50655244_pgfId-1095944">
alignment.</para> alignment.</para>
<para>The preferred way to access vectors at an application-defined address <para>The preferred way to access vectors at an application-defined address
is by using vector pointers and the C/C++ dereference operator *. Similar is by using vector pointers and the C/C++ dereference operator *. Similar
to other C /C++ data types, the array reference operator [] may be used to to other C /C++ data types, the array reference operator [ ] may be used to
access vector objects with a vector pointer with the usual definition to access vector objects with a vector pointer with the usual definition to
access the n-th vector element from a vector pointer. The use of vector access the n-th vector element from a vector pointer. The use of vector
built-in functions such as vec_xl and vec_xst is discouraged except for built-in functions such as vec_xl and vec_xst is discouraged except for
@ -136,7 +136,7 @@ register vector double vd = vec_splats(*double_ptr);</programlisting>
layout and vector element ordering in big-endian environments shall be big layout and vector element ordering in big-endian environments shall be big
endian, and the default vector layout and vector element ordering in endian, and the default vector layout and vector element ordering in
little-endian environments shall be little endian.</para> little-endian environments shall be little endian.</para>
<para>This element numbering shall also be used by the [] accessor method <para>This element numbering shall also be used by the [ ] accessor method
to vector elements provided as an extension of the C/C++ languages by some to vector elements provided as an extension of the C/C++ languages by some
compilers, as well as for other language extensions or library constructs compilers, as well as for other language extensions or library constructs
that directly or indirectly refer to elements by their element that directly or indirectly refer to elements by their element
@ -203,9 +203,9 @@ register vector double vd = vec_splats(*double_ptr);</programlisting>
<table frame="all" pgwide="1" xml:id="dbdoclet.50655244_35023"> <table frame="all" pgwide="1" xml:id="dbdoclet.50655244_35023">
<title>Endian-Sensitive Operations</title> <title>Endian-Sensitive Operations</title>
<tgroup cols="3"> <tgroup cols="3">
<colspec colname="c1" colwidth="15*" align="center" /> <colspec colname="c1" colwidth="25*" align="center" />
<colspec colname="c2" colwidth="35*" align="center" /> <colspec colname="c2" colwidth="30*" align="center" />
<colspec colname="c3" colwidth="50*" /> <colspec colname="c3" colwidth="45*" />
<thead> <thead>
<row> <row>
<entry> <entry>
@ -274,8 +274,7 @@ register vector double vd = vec_splats(*double_ptr);</programlisting>
</row> </row>
<row revisionflag="added"> <row revisionflag="added">
<entry> <entry>
<para>vec_extract_fp32_</para> <para>vec_extract_fp32_from_shorth</para>
<para>from_shorth</para>
</entry> </entry>
<entry> <entry>
<para> </para> <para> </para>
@ -286,8 +285,7 @@ register vector double vd = vec_splats(*double_ptr);</programlisting>
</row> </row>
<row revisionflag="added"> <row revisionflag="added">
<entry> <entry>
<para>vec_extract_fp32_</para> <para>vec_extract_fp32_from_shortl</para>
<para>from_shortl</para>
</entry> </entry>
<entry> <entry>
<para> </para> <para> </para>
@ -310,8 +308,7 @@ register vector double vd = vec_splats(*double_ptr);</programlisting>
</row> </row>
<row revisionflag="added"> <row revisionflag="added">
<entry> <entry>
<para>vec_first_match</para> <para>vec_first_match_index</para>
<para>_index</para>
</entry> </entry>
<entry> <entry>
<para> </para> <para> </para>
@ -322,8 +319,7 @@ register vector double vd = vec_splats(*double_ptr);</programlisting>
</row> </row>
<row revisionflag="added"> <row revisionflag="added">
<entry> <entry>
<para>vec_first_match</para> <para>vec_first_match_index_or_eos</para>
<para>_index_or_eos</para>
</entry> </entry>
<entry> <entry>
<para> </para> <para> </para>
@ -364,8 +360,7 @@ register vector double vd = vec_splats(*double_ptr);</programlisting>
<para>vmrgew</para> <para>vmrgew</para>
</entry> </entry>
<entry> <entry>
<para>Swap inputs and use vmrgow for LE. Phased in. <para>Swap inputs and use vmrgow for LE. Phased in.<footnote xml:id="pgfId-1105723">
<footnote xml:id="pgfId-1105723">
<para>This optional function is being phased in, and it may not <para>This optional function is being phased in, and it may not
be available on all implementations.</para> be available on all implementations.</para>
</footnote></para> </footnote></para>
@ -401,8 +396,7 @@ register vector double vd = vec_splats(*double_ptr);</programlisting>
<para>vmrgow</para> <para>vmrgow</para>
</entry> </entry>
<entry> <entry>
<para>Swap inputs and use vmrgew for LE. Phased in. <para>Swap inputs and use vmrgew for LE. Phased in.<footnoteref linkend="pgfId-1105723" /> </para>
<footnoteref linkend="pgfId-1105723" /> </para>
</entry> </entry>
</row> </row>
<row> <row>
@ -754,8 +748,7 @@ register vector double vd = vec_splats(*double_ptr);</programlisting>
</row> </row>
<row> <row>
<entry> <entry>
<para>vec_xlw4 <para>vec_xlw4<footnote xml:id="dbdoclet.50655244_73052"><para>
<footnote xml:id="dbdoclet.50655244_73052"><para>
Deprecated. The use of vector data type Deprecated. The use of vector data type
assignment and overloaded vec_xl and vec_xst vector assignment and overloaded vec_xl and vec_xst vector
built-in functions are preferred forms for assigning built-in functions are preferred forms for assigning
@ -774,8 +767,7 @@ register vector double vd = vec_splats(*double_ptr);</programlisting>
</row> </row>
<row> <row>
<entry> <entry>
<para>vec_xld2 <para>vec_xld2<footnoteref linkend="dbdoclet.50655244_73052"/>
<footnoteref linkend="dbdoclet.50655244_73052"/>
</para> </para>
</entry> </entry>
<entry> <entry>
@ -798,8 +790,7 @@ register vector double vd = vec_splats(*double_ptr);</programlisting>
</row> </row>
<row> <row>
<entry> <entry>
<para>vec_xstw4 <para>vec_xstw4<footnoteref linkend="dbdoclet.50655244_73052"/>
<footnoteref linkend="dbdoclet.50655244_73052"/>
</para> </para>
</entry> </entry>
<entry> <entry>
@ -811,8 +802,7 @@ register vector double vd = vec_splats(*double_ptr);</programlisting>
</row> </row>
<row> <row>
<entry> <entry>
<para>vec_xstd2 <para>vec_xstd2<footnoteref linkend="dbdoclet.50655244_73052"/>
<footnoteref linkend="dbdoclet.50655244_73052"/>
</para> </para>
</entry> </entry>
<entry> <entry>
@ -1173,8 +1163,7 @@ register vector double vd = vec_splats(*double_ptr);</programlisting>
</row> </row>
<row> <row>
<entry> <entry>
<para>vec_xlw<phrase revisionflag="added">4</phrase> <para>vec_xlw<phrase revisionflag="added">4</phrase><footnote xml:id="dbdoclet.50655244_78719">
<footnote xml:id="dbdoclet.50655244_78719">
<para>Deprecated. The use of vector data type <para>Deprecated. The use of vector data type
assignment and overloaded vec_xl and vec_xst vector assignment and overloaded vec_xl and vec_xst vector
built-in functions are preferred forms for assigning built-in functions are preferred forms for assigning
@ -1193,8 +1182,7 @@ register vector double vd = vec_splats(*double_ptr);</programlisting>
</row> </row>
<row> <row>
<entry> <entry>
<para>vec_xld2 <para>vec_xld2<footnoteref linkend="dbdoclet.50655244_78719"/>
<footnoteref linkend="dbdoclet.50655244_78719"/>
</para> </para>
</entry> </entry>
<entry> <entry>
@ -1219,8 +1207,7 @@ register vector double vd = vec_splats(*double_ptr);</programlisting>
</row> </row>
<row> <row>
<entry> <entry>
<para>vec_xstw4 <para>vec_xstw4<footnoteref linkend="dbdoclet.50655244_78719"/>
<footnoteref linkend="dbdoclet.50655244_78719"/>
</para> </para>
</entry> </entry>
<entry> <entry>
@ -1232,8 +1219,7 @@ register vector double vd = vec_splats(*double_ptr);</programlisting>
</row> </row>
<row> <row>
<entry> <entry>
<para>vec_xstd2 <para>vec_xstd2<footnoteref linkend="dbdoclet.50655244_78719"/>
<footnoteref linkend="dbdoclet.50655244_78719"/>
</para> </para>
</entry> </entry>
<entry> <entry>
@ -1295,6 +1281,53 @@ register vector double vd = vec_splats(*double_ptr);</programlisting>
</row> </row>
</thead> </thead>
<tbody> <tbody>
<row revisionflag="added">
<entry>
<para>VEC_CONCAT (ARG1, ARG2)<?linebreak?>(Fortran)</para>
<para></para>
</entry>
<entry>
<para>Purpose:</para>
<para>Concatenates two elements to form a vector.</para>
<para>Result value:</para>
<para>The resulting vector consists of the two scalar elements,
ARG1 and ARG2, assigned to elements 0 and 1 (using the
environments native endian numbering), respectively.</para>
<itemizedlist>
<listitem>
<para><emphasis role="bold">Note: </emphasis>This function corresponds to the C/C++ vector
constructor (vector type){a,b}. It is provided only for
languages without vector constructors.</para>
</listitem>
</itemizedlist>
</entry>
</row>
<row revisionflag="added">
<entry>
<para></para>
</entry>
<entry>
<para>vector signed long long vec_concat (signed long long,
signed long long);</para>
</entry>
</row>
<row revisionflag="added">
<entry>
<para></para>
</entry>
<entry>
<para>vector unsigned long long vec_concat (unsigned long long,
unsigned long long);</para>
</entry>
</row>
<row revisionflag="added">
<entry>
<para></para>
</entry>
<entry>
<para>vector double vec_concat (double, double);</para>
</entry>
</row>
<row> <row>
<entry> <entry>
<para>VEC_CONVERT(V, MOLD)</para> <para>VEC_CONVERT(V, MOLD)</para>

Loading…
Cancel
Save