Avoid misleading uses of r12; add new PPC_FEATURE2_ bits.

Signed-off-by: Bill Schmidt <wschmidt@linux.ibm.com>
master
Bill Schmidt 6 years ago
parent 6984303ef0
commit ee46fb7bb5

@ -37,7 +37,7 @@
</author> </author>
<copyright> <copyright>
<!-- TODO: Keep second year accurate for latest publish --> <!-- TODO: Keep second year accurate for latest publish -->
<year>2014-2018</year> <year>2014-2019</year>
<holder>OpenPOWER Foundation</holder> <holder>OpenPOWER Foundation</holder>
</copyright> </copyright>
<copyright> <copyright>
@ -57,7 +57,7 @@
<holder>Freescale Semiconductor, Inc</holder> <holder>Freescale Semiconductor, Inc</holder>
</copyright> </copyright>
<!-- TODO: Set the correct document releaseinfo --> <!-- TODO: Set the correct document releaseinfo -->
<releaseinfo>Revision 1.5h draft</releaseinfo> <releaseinfo>Revision 1.5i draft</releaseinfo>
<productname>OpenPOWER</productname> <productname>OpenPOWER</productname>
<pubdate/> <pubdate/>


@ -94,7 +94,17 @@
<revhistory> <revhistory>
<!-- TODO: Set the initial version information and clear any old information out --> <!-- TODO: Set the initial version information and clear any old information out -->
<revision> <revision>
<date>2018-12-20</date> <date>2019-04-16</date>
<revdescription>
<itemizedlist spacing="compact">
<listitem>
<para>Revision 1.5i: Changes from compiler workshop.</para>
</listitem>
</itemizedlist>
</revdescription>
</revision>
<revision>
<date>2019-02-01</date>
<revdescription> <revdescription>
<itemizedlist spacing="compact"> <itemizedlist spacing="compact">
<listitem> <listitem>

@ -6645,8 +6645,8 @@ s6 - 72 (stored)</programlisting>
instructions:</para> instructions:</para>
</listitem> </listitem>
</itemizedlist> </itemizedlist>
<programlisting>lis r16, symbol@ha <programlisting revisionflag="changed">lis r16, symbol@hba
ld r12, symbol@l(r16) ld r10, symbol@l(r16)


lis r16, symbol2@ha lis r16, symbol2@ha
addi r16, r16, symbol2@l addi r16, r16, symbol2@l
@ -6658,8 +6658,8 @@ lvx v1, r0, r16</programlisting>
<xref linkend="dbdoclet.50655241_66700" />.)</para> <xref linkend="dbdoclet.50655241_66700" />.)</para>
</listitem> </listitem>
</itemizedlist> </itemizedlist>
<programlisting>&lt;load TOC base to r2&gt; <programlisting revisionflag="changed">&lt;load TOC base to r2&gt;
ld r12, symbol@toc(r2) ld r10, symbol@toc(r2)


li r16, symbol2@toc li r16, symbol2@toc
lvx v1, r2, r16</programlisting> lvx v1, r2, r16</programlisting>
@ -6669,13 +6669,13 @@ lvx v1, r2, r16</programlisting>
addressing:</para> addressing:</para>
</listitem> </listitem>
</itemizedlist> </itemizedlist>
<programlisting>&lt;load TOC base to r2&gt; <programlisting revisionflag="changed">&lt;load TOC base to r2&gt;


ld r12, symbol@got(r2) ld r10, symbol@got(r2)
ld r12, 0(r12) ld r10, 0(r10)


ld r12, symbol2@got(r2) ld r10, symbol2@got(r2)
lvx v1, 0, r12</programlisting> lvx v1, 0, r10</programlisting>
<itemizedlist> <itemizedlist>
<listitem> <listitem>
<para revisionflag="added"> <para revisionflag="added">
@ -6683,7 +6683,7 @@ lvx v1, 0, r12</programlisting>
</para> </para>
</listitem> </listitem>
</itemizedlist> </itemizedlist>
<programlisting revisionflag="added">pld r12, symbol@pcrel <programlisting revisionflag="added">pld r10, symbol@pcrel


plxv v1, symbol@pcrel</programlisting> plxv v1, symbol@pcrel</programlisting>
<para>In the OpenPOWER ELF V2 ABI, position-dependent code built with <para>In the OpenPOWER ELF V2 ABI, position-dependent code built with
@ -6769,9 +6769,9 @@ plxv v1, symbol@pcrel</programlisting>
relative addressing (for private data).</para> relative addressing (for private data).</para>
</listitem> </listitem>
</itemizedlist> </itemizedlist>
<programlisting>&lt;load TOC base to r2&gt; <programlisting revisionflag="changed">&lt;load TOC base to r2&gt;


ld r12, symbol@toc(r2) ld r10, symbol@toc(r2)


li r16, symbol2@toc li r16, symbol2@toc
lvx v1, r2, r16</programlisting> lvx v1, r2, r16</programlisting>
@ -6782,21 +6782,21 @@ lvx v1, r2, r16</programlisting>
sections):</para> sections):</para>
</listitem> </listitem>
</itemizedlist> </itemizedlist>
<programlisting>&lt;load TOC base to r2&gt; <programlisting revisionflag="changed">&lt;load TOC base to r2&gt;


ld r12, symbol@got(r2) ld r10, symbol@got(r2)


ld r12, 0(r12) ld r10, 0(r10)


ld r12 symbol2@got(r2) ld r10, symbol2@got(r2)
lvx v1, 0, r12</programlisting> lvx v1, 0, r10</programlisting>
<itemizedlist> <itemizedlist>
<listitem> <listitem>
<para revisionflag="added">By using PC-relative addressing (for <para revisionflag="added">By using PC-relative addressing (for
private data).</para> private data).</para>
</listitem> </listitem>
</itemizedlist> </itemizedlist>
<programlisting revisionflag="added">pld r12, symbol@pcrel <programlisting revisionflag="added">pld r10, symbol@pcrel


plxv v1, symbol@pcrel</programlisting> plxv v1, symbol@pcrel</programlisting>
<itemizedlist> <itemizedlist>
@ -6806,11 +6806,11 @@ plxv v1, symbol@pcrel</programlisting>
</para> </para>
</listitem> </listitem>
</itemizedlist> </itemizedlist>
<programlisting revisionflag="added">pld r12, symbol@got@pcrel <programlisting revisionflag="added">pld r10, symbol@got@pcrel
ld r12, 0(r12) ld r10, 0(r10)


pld r12, symbol@got@pcrel pld r10, symbol@got@pcrel
lvx v1, 0, r12</programlisting> lvx v1, 0, r10</programlisting>
<para revisionflag="added"> <para revisionflag="added">
A compiler may generate a PC-relative addressing sequence to access A compiler may generate a PC-relative addressing sequence to access
static or restricted-visibility data, but must generate a PC-relative static or restricted-visibility data, but must generate a PC-relative

@ -5350,15 +5350,15 @@ target:
and replace the reference with direct PC-relative addressing. and replace the reference with direct PC-relative addressing.
For example: For example:
</para> </para>
<programlisting>pld r12, symbol@got@pcrel <programlisting>pld r10, symbol@got@pcrel
lvx v1, 0, r12</programlisting> lvx v1, 0, r10</programlisting>
<para>The previous sequence may be replaced by:</para> <para>The previous sequence may be replaced by:</para>
<programlisting>plxv v1, symbol@pcrel <programlisting>plxv v1, symbol@pcrel
nop</programlisting> nop</programlisting>
<para> <para>
However, this optimization is not universally safe, since it However, this optimization is not universally safe, since it
changes the value of r12 following the data reference. The changes the value of r10 following the data reference. The
compiler or programmer must ensure that the value of r12 is not compiler or programmer must ensure that the value of r10 is not
subsequently used, and communicate a request for this optimization subsequently used, and communicate a request for this optimization
by placing an R_PPC64_PCREL_OPT relocation on the first instruction by placing an R_PPC64_PCREL_OPT relocation on the first instruction
in the sequence. The compiler or programmer must further ensure that in the sequence. The compiler or programmer must further ensure that
@ -5375,19 +5375,19 @@ nop</programlisting>
of these instructions, but may instead generate a short sequence of these instructions, but may instead generate a short sequence
that can be optimized by a linker. For example: that can be optimized by a linker. For example:
</para> </para>
<programlisting>paddi r12,symbol@pcrel <programlisting>paddi r10,symbol@pcrel
pmlxvx v1,r10,r12,VRM,MC,P,0</programlisting> pmlxvx v1,r9,r10,VRM,MC,P,0</programlisting>
<para>The previous sequence may be replaced by:</para> <para>The previous sequence may be replaced by:</para>
<programlisting>dnop <programlisting>dnop
pmlxv v1,symbol@pcrel(r10),VRM,MC,P,1</programlisting> pmlxv v1,symbol@pcrel(r9),VRM,MC,P,1</programlisting>
<para> <para>
when the linker determines that the offset from the current when the linker determines that the offset from the current
instruction address to symbol's address will fit in 28 bits. instruction address to symbol's address will fit in 28 bits.
</para> </para>
<para> <para>
Again, this optimization is not universally safe, since it changes Again, this optimization is not universally safe, since it changes
the value of r12 following the data reference. The compiler or the value of r10 following the data reference. The compiler or
programmer must ensure that the value of r12 is not subsequently programmer must ensure that the value of r10 is not subsequently
used, and communicate a request for this optimization by placing used, and communicate a request for this optimization by placing
an R_PPC64_PCREL_OPT relocation on the first instruction in the an R_PPC64_PCREL_OPT relocation on the first instruction in the
sequence. The compiler or programmer must further ensure that the sequence. The compiler or programmer must further ensure that the

@ -716,7 +716,9 @@ PPC_FEATURE2_ARCH_3_00 0x00800000 /* ISA 3.0 */
PPC_FEATURE2_HAS_IEEE128 0x00400000 /* VSX IEEE Binary Float 128-bit */ PPC_FEATURE2_HAS_IEEE128 0x00400000 /* VSX IEEE Binary Float 128-bit */
PPC_FEATURE2_DARN 0x00200000 /* darn instruction */ PPC_FEATURE2_DARN 0x00200000 /* darn instruction */
PPC_FEATURE2_SCV 0x00100000 /* scv syscall */ PPC_FEATURE2_SCV 0x00100000 /* scv syscall */
PPC_FEATURE2_HTM_NO_SUSPEND 0x00080000 /* TM without suspended state */</programlisting> PPC_FEATURE2_HTM_NO_SUSPEND 0x00080000 /* TM without suspended state */
PPC_FEATURE2_ARCH_3_1 0x00040000 /* ISA 3.1 */
PPC_FEATURE2_MMA 0x00020000 /* Matrix Multiply Accumulate */</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,

Loading…
Cancel
Save