[PATCH] Fix pie.lds.S.in script to work with the gold linker

Saied Kazemi saied at google.com
Fri Mar 7 14:49:00 PST 2014


The pie.lds.S.in needs two minor changes to work with the gold
(/usr/bin/gold) linker.  These changes are compatible with /usr/bin/ld
and make linker script more portable.

The first change is adding a comma before /DISCARD/ so that the grammar
won't be ambiguous.  Otherwise, gold treats it as a part of the assignment
and would generate a syntax error about the "unexpected ':'".

The second change is moving initialization of __export_parasite_args
to inside the SECTIONS command because it references the dot symbol.
Otherwise, gold would generate the error "invalid reference to dot symbol
outside of SECTIONS clause."

Signed-off-by: Saied Kazemi <saied at google.com>
---
 pie/pie.lds.S.in | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/pie/pie.lds.S.in b/pie/pie.lds.S.in
index cbdfaa9..97e6c41 100644
--- a/pie/pie.lds.S.in
+++ b/pie/pie.lds.S.in
@@ -12,7 +12,7 @@ SECTIONS
  . = ALIGN(32);
  *(.got*)
  . = ALIGN(32);
- } =0x00000000
+ } =0x00000000,

  /DISCARD/ : {
  *(.debug*)
@@ -22,6 +22,6 @@ SECTIONS
  *(.eh_frame*)
  *(*)
  }
-}

-__export_parasite_args = .;
+ __export_parasite_args = .;
+}
-- 
1.9.0.279.gdc9e3eb

--047d7b6776947a497e04f40caa61
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><div>cat 0001-Fix-pie.lds.S.in-script-to-work-with-the-gol=
d-linker.patch</div><div>From e65747b94f52acdf422ae6f3f2c4d9d383665f2d Mon =
Sep 17 00:00:00 2001</div><div>From: Saied Kazemi &lt;<a href=3D"mailto:sai=
ed at google.com">saied at google.com</a>&gt;</div>
<div>Date: Fri, 7 Mar 2014 14:49:00 -0800</div><div>Subject: [PATCH] Fix <a=
 href=3D"http://pie.lds.S.in">pie.lds.S.in</a> script to work with the gold=
 linker</div><div><br></div><div>The <a href=3D"http://pie.lds.S.in">pie.ld=
s.S.in</a> needs two minor changes to work with the gold</div>
<div>(/usr/bin/gold) linker. =C2=A0These changes are compatible with /usr/b=
in/ld</div><div>and make linker script more portable.</div><div><br></div><=
div>The first change is adding a comma before /DISCARD/ so that the grammar=
</div>
<div>won&#39;t be ambiguous. =C2=A0Otherwise, gold treats it as a part of t=
he assignment</div><div>and would generate a syntax error about the &quot;u=
nexpected &#39;:&#39;&quot;.</div><div><br></div><div>The second change is =
moving initialization of __export_parasite_args</div>
<div>to inside the SECTIONS command because it references the dot symbol.</=
div><div>Otherwise, gold would generate the error &quot;invalid reference t=
o dot symbol</div><div>outside of SECTIONS clause.&quot;</div><div><br>
</div><div>Signed-off-by: Saied Kazemi &lt;<a href=3D"mailto:saied at google.c=
om">saied at google.com</a>&gt;</div><div>---</div><div>=C2=A0pie/<a href=3D"h=
ttp://pie.lds.S.in">pie.lds.S.in</a> | 6 +++---</div><div>=C2=A01 file chan=
ged, 3 insertions(+), 3 deletions(-)</div>
<div><br></div><div>diff --git a/pie/<a href=3D"http://pie.lds.S.in">pie.ld=
s.S.in</a> b/pie/<a href=3D"http://pie.lds.S.in">pie.lds.S.in</a></div><div=
>index cbdfaa9..97e6c41 100644</div><div>--- a/pie/<a href=3D"http://pie.ld=
s.S.in">pie.lds.S.in</a></div>
<div>+++ b/pie/<a href=3D"http://pie.lds.S.in">pie.lds.S.in</a></div><div>@=
@ -12,7 +12,7 @@ SECTIONS</div><div>=C2=A0<span class=3D"" style=3D"white-s=
pace:pre">		</span>. =3D ALIGN(32);</div><div>=C2=A0<span class=3D"" style=
=3D"white-space:pre">		</span>*(.got*)</div>
<div>=C2=A0<span class=3D"" style=3D"white-space:pre">		</span>. =3D ALIGN(=
32);</div><div>-<span class=3D"" style=3D"white-space:pre">	</span>} =3D0x0=
0000000</div><div>+<span class=3D"" style=3D"white-space:pre">	</span>} =3D=
0x00000000,</div><div>
=C2=A0</div><div>=C2=A0<span class=3D"" style=3D"white-space:pre">	</span>/=
DISCARD/ : {</div><div>=C2=A0<span class=3D"" style=3D"white-space:pre">		<=
/span>*(.debug*)</div><div>@@ -22,6 +22,6 @@ SECTIONS</div><div>=C2=A0<span=
 class=3D"" style=3D"white-space:pre">		</span>*(.eh_frame*)</div>
<div>=C2=A0<span class=3D"" style=3D"white-space:pre">		</span>*(*)</div><d=
iv>=C2=A0<span class=3D"" style=3D"white-space:pre">	</span>}</div><div>-}<=
/div><div>=C2=A0</div><div>-__export_parasite_args =3D .;</div><div>+<span =
class=3D"" style=3D"white-space:pre">	</span>__export_parasite_args =3D .;<=
/div>
<div>+}</div><div>--=C2=A0</div><div>1.9.0.279.gdc9e3eb</div><div><br></div=
></div>

--047d7b6776947a497e04f40caa61--


More information about the CRIU mailing list