NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: port-arm32/50218: ARM executables linked with native linker on cortex-a9 raises SIGILL



The following reply was made to PR port-arm32/50218; it has been noted by GNATS.

From: Zaid Ibrahime <mzaidibrahime%gmail.com@localhost>
To: gnats-bugs%netbsd.org@localhost
Cc: port-arm32-maintainer%netbsd.org@localhost, gnats-admin%netbsd.org@localhost, 
	netbsd-bugs%netbsd.org@localhost
Subject: Re: port-arm32/50218: ARM executables linked with native linker on
 cortex-a9 raises SIGILL
Date: Tue, 8 Sep 2015 16:55:57 +0530

 --94eb2c032e6048771a051f3aa196
 Content-Type: text/plain; charset=UTF-8
 
 > Are you building from a single c source, or from libs?
 > My bet is the swapping happens fine for c source or "normal" objects,
 > but you are using some lib that has been partially stripped, which kills
 > the $t/$a markers. libgcc was one of those libraries (untill fixed)
 
 I have compiled 1 file.
 gcc -o api.o -DHAVE_CONFIG_H  -I. -I.. -I../include  -c  api.c
 
 Now I have written a simple C function which calls only one function from
 the objs.
 
 gcc -o test2 -DHAVE_CONFIG_H  -I. -I.. -I../include test1.c api.o
 
 # ./test2
 pid 447 (test2), uid 0: exited on signal 4 (core not dumped, err = 2)
 [1]   Illegal instruction     ./test2
 
 # gcc -o api.o -DHAVE_CONFIG_H  -I. -I.. -I../include  -c  api.c
 # gcc -o test2 -DHAVE_CONFIG_H  -I. -I.. -I../include test1.c api.o
 # ./test2
 #
 
 The content of the test1.c is always the same.
 
 # cat test1.c
 #include <yaml.h>
 
 int main ()
 {
   yaml_parser_t parser;
   yaml_parser_initialize (&parser);
 return 0;
 }
 
 The obj is correctly endianness swapped in the latter case. Wonder why the
 same function crashes in one case and not the other.
 
 
 
 
 On Tue, Sep 8, 2015 at 12:30 PM, Martin Husemann <martin%duskware.de@localhost> wrote:
 
 > The following reply was made to PR port-arm32/50218; it has been noted by
 > GNATS.
 >
 > From: Martin Husemann <martin%duskware.de@localhost>
 > To: Zaid Ibrahime <mzaidibrahime%gmail.com@localhost>
 > Cc: gnats-bugs%netbsd.org@localhost
 > Subject: Re: port-arm32/50218: ARM executables linked with native linker
 > on cortex-a9 raises SIGILL
 > Date: Tue, 8 Sep 2015 08:58:29 +0200
 >
 >  On Tue, Sep 08, 2015 at 11:12:40AM +0530, Zaid Ibrahime wrote:
 >  >  > Small programs(<6K size) does not result in SIGILL as all the
 >  > instruction are properly swapped for endianness by the linker.
 >  >
 >  >  > Are you sure that it depends on size of the program?
 >
 >  Are you building from a single c source, or from libs?
 >  My bet is the swapping happens fine for c source or "normal" objects,
 >  but you are using some lib that has been partially stripped, which kills
 >  the $t/$a markers. libgcc was one of those libraries (untill fixed)
 >
 >  Martin
 >
 >
 
 --94eb2c032e6048771a051f3aa196
 Content-Type: text/html; charset=UTF-8
 Content-Transfer-Encoding: quoted-printable
 
 <div dir=3D"ltr"><span style=3D"color:rgb(80,0,80);font-size:12.8px">&gt; A=
 re you building from a single c source, or from libs?</span><br style=3D"co=
 lor:rgb(80,0,80);font-size:12.8px"><span style=3D"color:rgb(80,0,80);font-s=
 ize:12.8px">&gt; My bet is the swapping happens fine for c source or &quot;=
 normal&quot; objects,</span><br style=3D"color:rgb(80,0,80);font-size:12.8p=
 x"><span style=3D"color:rgb(80,0,80);font-size:12.8px">&gt; but you are usi=
 ng some lib that has been partially stripped, which kills</span><br style=
 =3D"color:rgb(80,0,80);font-size:12.8px"><span style=3D"color:rgb(80,0,80);=
 font-size:12.8px">&gt; the $t/$a markers. libgcc was one of those libraries=
  (untill fixed)</span><br style=3D"color:rgb(80,0,80);font-size:12.8px"><di=
 v><span style=3D"color:rgb(80,0,80);font-size:12.8px"><br></span></div><div=
 ><font color=3D"#500050"><span style=3D"font-size:12.8px">I have compiled 1=
  file.=C2=A0</span></font></div><div><font color=3D"#500050"><span style=3D=
 "font-size:12.8px">gcc -o api.o -DHAVE_CONFIG_H =C2=A0-I. -I.. -I../include=
  =C2=A0-c =C2=A0api.c</span><br></font></div><div><font color=3D"#500050"><=
 span style=3D"font-size:12.8px"><br></span></font></div><div><span style=3D=
 "color:rgb(80,0,80);font-size:12.8px">Now I have written a simple C functio=
 n which calls only one function from the objs.</span><font color=3D"#500050=
 "><span style=3D"font-size:12.8px"><br></span></font></div><div><span style=
 =3D"color:rgb(80,0,80);font-size:12.8px"><br></span></div><div><div><font c=
 olor=3D"#500050"><span style=3D"font-size:12.8px">gcc -o test2 -DHAVE_CONFI=
 G_H =C2=A0-I. -I.. -I../include test1.c api.o</span></font></div><div style=
 =3D"color:rgb(80,0,80);font-size:12.8px"><br></div></div><div style=3D""><d=
 iv style=3D"color:rgb(80,0,80);font-size:12.8px"># ./test2</div><div style=
 =3D"color:rgb(80,0,80);font-size:12.8px">pid 447 (test2), uid 0: exited on =
 signal 4 (core not dumped, err =3D 2)</div><div style=3D"color:rgb(80,0,80)=
 ;font-size:12.8px">[1] =C2=A0 Illegal instruction =C2=A0 =C2=A0 ./test2</di=
 v><div style=3D"color:rgb(80,0,80);font-size:12.8px"><br></div><div style=
 =3D""><div style=3D""><font color=3D"#500050"><span style=3D"font-size:12.8=
 px"># gcc -o api.o -DHAVE_CONFIG_H =C2=A0-I. -I.. -I../include =C2=A0-c =C2=
 =A0api.c</span></font></div><div style=3D""><font color=3D"#500050"><span s=
 tyle=3D"font-size:12.8px"># gcc -o test2 -DHAVE_CONFIG_H =C2=A0-I. -I.. -I.=
 ./include test1.c api.o</span></font></div><div style=3D""><font color=3D"#=
 500050"><span style=3D"font-size:12.8px"># ./test2</span></font></div><div =
 style=3D""><font color=3D"#500050"><span style=3D"font-size:12.8px"># =C2=
 =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =
 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
 =A0 =C2=A0 =C2=A0</span></font></div><div style=3D""><font color=3D"#500050=
 "><span style=3D"font-size:12.8px"><br></span></font></div><div style=3D"">=
 <font color=3D"#500050"><span style=3D"font-size:12.8px">The content of the=
  test1.c is always the same.</span></font></div><div style=3D""><font color=
 =3D"#500050"><span style=3D"font-size:12.8px"><br></span></font></div><div =
 style=3D""><font color=3D"#500050"><div style=3D""><span style=3D"font-size=
 :12.8px"># cat test1.c</span></div><div style=3D""><span style=3D"font-size=
 :12.8px">#include &lt;yaml.h&gt;</span></div><div style=3D""><span style=3D=
 "font-size:12.8px"><br></span></div><div style=3D""><span style=3D"font-siz=
 e:12.8px">int main ()</span></div><div style=3D""><span style=3D"font-size:=
 12.8px">{</span></div><div style=3D""><span style=3D"font-size:12.8px">=C2=
 =A0 yaml_parser_t parser;</span></div><div style=3D""><span style=3D"font-s=
 ize:12.8px">=C2=A0 yaml_parser_initialize (&amp;parser);</span></div><div s=
 tyle=3D""><span style=3D"font-size:12.8px">return 0;</span></div><div style=
 =3D""><span style=3D"font-size:12.8px">}</span></div><div style=3D"font-siz=
 e:12.8px"><br></div><div style=3D"font-size:12.8px">The obj is correctly en=
 dianness swapped in the latter case. Wonder why the same function crashes i=
 n one case and not the other.</div></font></div></div></div><div><font colo=
 r=3D"#500050"><span style=3D"font-size:12.8px"><br></span></font></div><div=
 ><span style=3D"color:rgb(80,0,80);font-size:12.8px"><br></span></div><div>=
 <span style=3D"color:rgb(80,0,80);font-size:12.8px"><br></span></div></div>=
 <div class=3D"gmail_extra"><br><div class=3D"gmail_quote">On Tue, Sep 8, 20=
 15 at 12:30 PM, Martin Husemann <span dir=3D"ltr">&lt;<a href=3D"mailto:mar=
 tin%duskware.de@localhost" target=3D"_blank">martin%duskware.de@localhost</a>&gt;</span> wrote:=
 <br><blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-lef=
 t:1px #ccc solid;padding-left:1ex"><span class=3D"">The following reply was=
  made to PR port-arm32/50218; it has been noted by GNATS.<br>
 <br>
 From: Martin Husemann &lt;<a href=3D"mailto:martin%duskware.de@localhost";>martin@dusk=
 ware.de</a>&gt;<br>
 </span>To: Zaid Ibrahime &lt;<a href=3D"mailto:mzaidibrahime%gmail.com@localhost";>mza=
 idibrahime%gmail.com@localhost</a>&gt;<br>
 Cc: <a href=3D"mailto:gnats-bugs%netbsd.org@localhost";>gnats-bugs%netbsd.org@localhost</a><br>
 <span class=3D"">Subject: Re: port-arm32/50218: ARM executables linked with=
  native linker on cortex-a9 raises SIGILL<br>
 </span>Date: Tue, 8 Sep 2015 08:58:29 +0200<br>
 <div class=3D"HOEnZb"><div class=3D"h5"><br>
 =C2=A0On Tue, Sep 08, 2015 at 11:12:40AM +0530, Zaid Ibrahime wrote:<br>
 =C2=A0&gt;=C2=A0 &gt; Small programs(&lt;6K size) does not result in SIGILL=
  as all the<br>
 =C2=A0&gt; instruction are properly swapped for endianness by the linker.<b=
 r>
 =C2=A0&gt;<br>
 =C2=A0&gt;=C2=A0 &gt; Are you sure that it depends on size of the program?<=
 br>
 <br>
 =C2=A0Are you building from a single c source, or from libs?<br>
 =C2=A0My bet is the swapping happens fine for c source or &quot;normal&quot=
 ; objects,<br>
 =C2=A0but you are using some lib that has been partially stripped, which ki=
 lls<br>
 =C2=A0the $t/$a markers. libgcc was one of those libraries (untill fixed)<b=
 r>
 <br>
 =C2=A0Martin<br>
 <br>
 </div></div></blockquote></div><br></div>
 
 --94eb2c032e6048771a051f3aa196--
 



Home | Main Index | Thread Index | Old Index