arm-none-linux-gnueabi-gcc hello.c -v -o hello
-L/home/diluka/projects/softwares/arm-2007q3/arm-none-linux-gnueabi/libc/lib
-Wl,--dynamic-linker /system/bin/linker -Wl,-rpath /system/lib
-Wl,-L/home/diluka/projects/softwares/arm-2007q3/arm-none-linux-gnueabi/libc/lib
-Wl,-lc
I have got the following strace as well.
# ./strace ./hello
execve("./hello", ["./hello"], [/* 9 vars */]) = 0
getpid() = 2855
syscall_983045(0xb0016b48, 0xb0013760, 0x3e4, 0, 0xbead7e58, 0x1, 0,
0xf0005, 0xb0013760, 0, 0, 0xbead7e54, 0, 0xbead7e08, 0xb0000d89,
0xb00016ec, 0x10, 0xb0016b48, 0, 0, 0xc764, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0) = 0
gettid() = 2855
sigaction(SIGILL, {0xb0001469, [], SA_RESTART}, {SIG_DFL}, 0) = 0
sigaction(SIGABRT, {0xb0001469, [], SA_RESTART}, {SIG_DFL}, 0) = 0
sigaction(SIGBUS, {0xb0001469, [], SA_RESTART}, {SIG_DFL}, 0) = 0
sigaction(SIGFPE, {0xb0001469, [], SA_RESTART}, {SIG_DFL}, 0) = 0
sigaction(SIGSEGV, {0xb0001469, [], SA_RESTART}, {SIG_DFL}, 0) = 0
sigaction(SIGSTKFLT, {0xb0001469, [], SA_RESTART}, {SIG_DFL}, 0) = 0
open("libc.so.6", O_RDONLY|O_LARGEFILE) = 3
lseek(3, -8, SEEK_END) = 231908
read(3, "\0\0\340\257PRE ", 8) = 8
mmap2(0xafe00000, 233472, PROT_READ|PROT_WRITE|PROT_EXEC, MAP_PRIVATE,
3, 0) = 0xafe00000
close(3) = 0
mmap2(0xafe39000, 45056, PROT_READ|PROT_WRITE,
MAP_PRIVATE|MAP_ANONYMOUS, 0, 0) = 0xafe39000
mprotect(0xafe00000, 221184, PROT_READ|PROT_EXEC) = 0
fstat64(1, {st_mode=S_IFCHR|0600, st_rdev=makedev(253, 0), ...}) = 0
brk(0) = 0x11000
brk(0x11000) = 0x11000
brk(0x13000) = 0x13000
ioctl(1, SNDCTL_TMR_TIMEBASE or TCGETS, {B38400 opost isig icanon echo
...}) = 0
write(1, "ERROR: 2855 cannot locate \'__li"..., 50ERROR: 2855 cannot
locate '__libc_start_main'...
) = 50
write(1, "ERROR: failed to link ./hello\n", 30ERROR: failed to link ./hello
) = 30
write(1, "ERROR: CANNOT LINK EXECUTABLE \'."..., 40ERROR: CANNOT LINK
EXECUTABLE './hello'
) = 40
exit_group(-1) = ?
Process 2855 detached
It seems that, when I do not specifically call the linker, dynamic
linking doesn't happen and it can't find
the simbles in the libc.so. Any thoughts ?
Thanks,
Diluka.
Thanks,
Diluka.
arm-none-linux-gnueabi-gcc -c hello.c -v
arm-none-linux-gnueabi-ld hello.o -lc
-L/home/projects/softwares/arm-linux/arm-2007q3-none-linux-gnueabi-i686-51/arm-none-linux-gnueabi/libc/lib
--dynamic-linker /system/bin/linker -o hello -v
But what I want is, instead of explicitly calling the linker, I need to
get it done,
using the compiler; What I mean is something like this;
arm-none-linux-gnueabi-gcc hello.c -o hello {all the arguments}
I tried this in the usual way, but seems the compiler calls it's linker
and it links to a different libc.so than what is in android.
Thanks,
Diluka.
diluka@diluka-laptop:~/projects/BuildSystem/temp$ sh b.sh
/home/diluka/projects/softwares/arm-2007q3/bin/../arm-none-linux-gnueabi/libc/usr/lib/crt1.o:
In function `_start':
init.c:(.text+0x24): undefined reference to `__libc_start_main'
init.c:(.text+0x2c): undefined reference to `__libc_csu_fini'
init.c:(.text+0x34): undefined reference to `__libc_csu_init'
Thanks,
Diluka.
Thanks,
Diluka.
Thanks,
Diluka.
/home/diluka/projects/softwares/arm-2007q3/bin/../lib/gcc/arm-none-linux-gnueabi/4.2.1/../../../../arm-none-linux-gnueabi/bin/ld:
h_errno: TLS definition in
/home/diluka/projects/softwares/arm-2007q3/bin/../arm-none-linux-gnueabi/libc/lib/libc.so.6
section .tbss mismatches non-TLS definition in /system/lib/libc.so
section .bss
/home/diluka/projects/softwares/arm-2007q3/bin/../arm-none-linux-gnueabi/libc/lib/libc.so.6:
could not read symbols: Bad value
collect2: ld returned 1 exit status
Anybody has some idea regarding the matter ? Any ideas, highly appreciated.
Thanks,
Diluka.
Thanks