首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >如何编写静态gdbserver

如何编写静态gdbserver
EN

Stack Overflow用户
提问于 2015-01-21 05:36:45
回答 1查看 2.1K关注 0票数 0

我已经对GDB的源代码做了一些修改,所以我想编译一个新的可执行文件。我已经成功地编译了一个新的GDB,但是当涉及到编译gdb服务器时,它失败了,我需要在Makefile中创建LDFLAGS = -static,因为Android没有库。失败消息如下:

代码语言:javascript
复制
gcc -shared -fPIC -Wl,--no-undefined -g -O2     -I. -I. -I./../common -I./../regformats -I./.. -I./../../include -I./../gnulib/import -Ibuild-gnulib-gdbserver/import -Wall -Wdeclaration-after-statement -Wpointer-arith -Wformat-nonliteral -Wno-char-subscripts -Wempty-body  -DGDBSERVER \
-static  -Wl,--dynamic-list=./proc-service.list -o libinproctrace.so ax-ipa.o tracepoint-ipa.o format-ipa.o utils-ipa.o regcache-ipa.o remote-utils-ipa.o common-utils-ipa.o tdesc-ipa.o print-utils-ipa.o rsp-low-ipa.o amd64-linux-ipa.o linux-amd64-ipa.o -ldl -pthread
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/4.6/crtbeginT.o: relocation R_X86_64_32 against `__DTOR_END__' can not be used when making a shared object; recompile with -fPIC
/usr/lib/gcc/x86_64-linux-gnu/4.6/crtbeginT.o: could not read symbols: Bad value
collect2: ld returned 1 exit status
make: *** [libinproctrace.so] Error 1

它在使用ld时失败,所以我想知道如何编译静态gdbserver?

非常感谢。

EN

回答 1

Stack Overflow用户

发布于 2015-01-22 05:04:32

gcc -shared -fPIC ... -static ... -o libinproctrace.so ...

在这个命令中,您要求GCC将共享库libinproctrace.so-static标志链接起来。GCC的回答是:“对不起,戴夫,恐怕我做不到”

所以别那么做。相反,编辑Makefile并将您的-static专门添加到gdbserver的链接行,而不是添加到命令行上的所有内容。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/28060316

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档