__libc_start_main on IA64
William <[email protected]> Mon, 15 May 2006 10:59:27 +0800
| Newsgroups | gmane.linux.redhat.ia64.general |
|---|---|
| Message-ID | <[email protected]> |
--===============0892018043==
Content-Type: multipart/alternative;
boundary="----=_Part_34576_9988625.1147661967114"
------=_Part_34576_9988625.1147661967114
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: quoted-printable
Content-Disposition: inline
*__libc_start_main on IA64*
------------------------------
Today I encountered a weird problem, I reimplement __libc_start_main in my
program. And this program can run very well on i386 and x86_64 either
compiled dynamic-linked with " gcc test.c -o test" or compiled staticlly
with "gcc test.c -o test -static". But on IA64 the program can run if I
compiled it using dynamic-linking, but if I compiled it staticlly, the
program cannot run. I read libc_start.c in glibc, but I cannot figure out
why it cannot run when compiled staticlly. I am using RHEL4U2. Could you
please give me some suggestions? Thank you very much.
#include <stdio.h>
#include <unistd.h>
extern int __libc_start_main(int(*main)())
{
printf("coming to __libc_start_main\n");
int result =3D main();
exit(result);
}
int main()
{
printf("coming to main\n");
return 0;
}
error message when using strace
execve("./test4", ["./test4"], [/* 25 vars */]) =3D 0
--- SIGSEGV (Segmentation fault) @ 40000000000113f0 (20000000002ac140) ---
+++ killed by SIGSEGV +++
Process 19948 detached
------=_Part_34576_9988625.1147661967114
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
Content-Disposition: inline
<div class=3D"smallfont"><strong>__libc_start_main on IA64</strong> </div>
<hr style=3D"COLOR: #ffffff" size=3D"1">
<div id=3D"post_message_2245485">Today I encountered a weird problem, I rei=
mplement __libc_start_main in my program. And this program can run very wel=
l on i386 and x86_64 either compiled dynamic-linked with " gcc test.c
-o test" or compiled staticlly with "gcc test.c -o test -static&=
quot;. But on IA64 the program can run if I compiled it using dynamic-linki=
ng, but if I compiled it staticlly, the program cannot run. I read libc_sta=
rt.c in glibc, but I cannot figure out why it cannot run when compiled stat=
iclly. I am using RHEL4U2. Could you please give me some suggestions? Thank=
you very much.
<br><br>#include <stdio.h><br>#include <unistd.h><br><br>extern=
int __libc_start_main(int(*main)())<br>{<br>printf("coming to __libc_=
start_main\n");<br>int result =3D main();<br>exit(result);<br>}<br><br=
>
int main()<br>{<br>printf("coming to main\n");<br>return 0;<br>}<=
/div>
<div> </div>
<div>error message when using strace </div>
<div>execve("./test4", ["./test4"], [/* 25 vars */]) =
=3D 0<br>--- SIGSEGV (Segmentation fault) @ 40000000000113f0 (20000000002ac=
140) ---<br>+++ killed by SIGSEGV +++<br>Process 19948 detached</div>
------=_Part_34576_9988625.1147661967114--
--===============0892018043==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline
_______________________________________________
ia64-list mailing list
[email protected]
https://www.redhat.com/mailman/listinfo/ia64-list
--===============0892018043==--