更改哪个libc.so被链接? [英] Changing which libc.so gets linked?
问题描述
目前只有简单的hello world c代码,并且使用mipsel-linux-gnu-gcc编译器,该编译器适用于汇编。
编译器命令:
mipsel-linux-gnu-gcc - L / home / uname / devel / extr / squashfs-root / lib -l:libc.so.0 -mips32 -Wl, - build-id = none -Wl, - dynamic-linker = / lib / ld -uClibc .so.0 ma.c
libc.so.0是从路由器的固件中提取的。
该程序编译,但在readelf中,问题在于它与libc.so.6链接
<$ p共享库:[libc.so.6]
0x00000001(需要) p>,而从固件中拉出busybox二进制文件并运行readelf就可以了
0x00000001(需要)共享库:[libc.so .0]
如何使它与libc.so.0链接?
想通了。必须使用buildroot构建一个uClibc工具链。
Im trying to cross compile for MIPSEL on my router. I got stuff working in assembly, but now Im moving to trying to compile basic C code.
Currently just have simple hello world c code, and using the mipsel-linux-gnu-gcc compiler, which works for assembly.
Compiler command:
mipsel-linux-gnu-gcc -L/home/uname/devel/extr/squashfs-root/lib -l:libc.so.0 -mips32 -Wl,--build-id=none -Wl,--dynamic-linker=/lib/ld-uClibc.so.0 ma.c
The libc.so.0 is extracted from the firmware for the router.
The program compiles, however in readelf, the issue is that it links against libc.so.6
0x00000001 (NEEDED) Shared library: [libc.so.6]
whereas pulling the busybox binary from the firmware and running readelf on it
0x00000001 (NEEDED) Shared library: [libc.so.0]
How do I get it to link against libc.so.0?
Figured it out. Had to build a uClibc toolchain using buildroot.
这篇关于更改哪个libc.so被链接?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!