当前位置: 技术问答>linux和unix
ld如何使用呢?
来源: 互联网 发布时间:2016-07-23
本文导语: gcc -c helloworld.c 產生一個helloworld.o 如何用ld產生最後的程序呢 | 看似简单,实际很复杂 gcc -o helloworld helloworld.c -v 就能看到一堆详细过程 最后几行 /usr/libexec/gcc/i386-redhat-linux/4.3.0/collect2 --eh-frame-hdr ...
gcc -c helloworld.c
產生一個helloworld.o
如何用ld產生最後的程序呢
產生一個helloworld.o
如何用ld產生最後的程序呢
|
看似简单,实际很复杂
gcc -o helloworld helloworld.c -v
就能看到一堆详细过程
最后几行
/usr/libexec/gcc/i386-redhat-linux/4.3.0/collect2 --eh-frame-hdr --build-id -m elf_i386 --hash-style=gnu -dynamic-linker /lib/ld-linux.so.2 -o testc /usr/lib/gcc/i386-redhat-linux/4.3.0/../../../crt1.o /usr/lib/gcc/i386-redhat-linux/4.3.0/../../../crti.o /usr/lib/gcc/i386-redhat-linux/4.3.0/crtbegin.o -L/usr/lib/gcc/i386-redhat-linux/4.3.0 -L/usr/lib/gcc/i386-redhat-linux/4.3.0 -L/usr/lib/gcc/i386-redhat-linux/4.3.0/../../.. /tmp/ccybrZDQ.o -lgcc --as-needed -lgcc_s --no-as-needed -lc -lgcc --as-needed -lgcc_s --no-as-needed /usr/lib/gcc/i386-redhat-linux/4.3.0/crtend.o /usr/lib/gcc/i386-redhat-linux/4.3.0/../../../crtn.o
就是collect2 的参数也就是调用ld的参数 很bt的
gcc -o helloworld helloworld.c -v
就能看到一堆详细过程
最后几行
/usr/libexec/gcc/i386-redhat-linux/4.3.0/collect2 --eh-frame-hdr --build-id -m elf_i386 --hash-style=gnu -dynamic-linker /lib/ld-linux.so.2 -o testc /usr/lib/gcc/i386-redhat-linux/4.3.0/../../../crt1.o /usr/lib/gcc/i386-redhat-linux/4.3.0/../../../crti.o /usr/lib/gcc/i386-redhat-linux/4.3.0/crtbegin.o -L/usr/lib/gcc/i386-redhat-linux/4.3.0 -L/usr/lib/gcc/i386-redhat-linux/4.3.0 -L/usr/lib/gcc/i386-redhat-linux/4.3.0/../../.. /tmp/ccybrZDQ.o -lgcc --as-needed -lgcc_s --no-as-needed -lc -lgcc --as-needed -lgcc_s --no-as-needed /usr/lib/gcc/i386-redhat-linux/4.3.0/crtend.o /usr/lib/gcc/i386-redhat-linux/4.3.0/../../../crtn.o
就是collect2 的参数也就是调用ld的参数 很bt的
您可能感兴趣的文章:
本站(WWW.)旨在分享和传播互联网科技相关的资讯和技术,将尽最大努力为读者提供更好的信息聚合和浏览方式。
本站(WWW.)站内文章除注明原创外,均为转载、整理或搜集自网络。欢迎任何形式的转载,转载请注明出处。
本站(WWW.)站内文章除注明原创外,均为转载、整理或搜集自网络。欢迎任何形式的转载,转载请注明出处。