__libc_start_main on IA64

William snowingbear at gmail.com
Mon May 15 03:40:56 UTC 2006


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 = main();
exit(result);
}

int main()
{
printf("coming to main\n");
return 0;
}

error message using strace to trace test program(compiled staticlly) on
IA64:
execve("./test4", ["./test4"], [/* 25 vars */]) = 0
--- SIGSEGV (Segmentation fault) @ 40000000000113f0 (20000000002ac140) ---
+++ killed by SIGSEGV +++
Process 19948 detached



More information about the redhat-list mailing list