将 -pie 标志传递给 gcc 时堆栈溢出
我正在尝试将 fedora 移植到 mips cpu,一些软件包如“sudo”“krb5”,以下是通过配置自动添加“-fpie”“-pie”标志生成的“sudo”的 Makefile。
SUDO_LIBS = -laudit -lselinux -lutil -lpam -ldl -lldap $(LIBS) $(NET_LIBS)
CFLAGS = -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -mabi=32 -march=mips3 -fpie
LDFLAGS = -L. -pie
当我尝试运行 sudo 时,发生核心转储。 gdb 中的调用框架 --core core.8420:
#0 0x2ad65bdc in elf_dynamic_do_rel (scope=<value optimized out>, reloc_mode=<value optimized out>, consider_profiling=<value optimized out>)
at do-rel.h:120
#1 _dl_relocate_object (scope=<value optimized out>, reloc_mode=<value optimized out>, consider_profiling=<value optimized out>) at dl-reloc.c:268
#2 0x2ad5bd7c in dl_main (phdr=<value optimized out>, phnum=<value optimized out>, user_entry=<value optimized out>, auxv=<value optimized out>)
at rtld.c:2254
#3 0x2ad73744 in _dl_sysdep_start (start_argptr=<value optimized out>, dl_main=0x2ad5aa38 <dl_main>) at ../elf/dl-sysdep.c:244
#4 0x2ad58f08 in _dl_start_final (arg=0x7fc6d990, info=<value optimized out>) at rtld.c:334
#5 0x2ad590d8 in _dl_start (arg=0x7fc6d990) at rtld.c:562
#6 0x2ad588f8 in __start () from /lib/ld.so.1
Backtrace stopped: frame did not save the PC
当我删除 -pie ld 标志时,一切正常,这是因为 binutils 或 glibc 库加载器吗?
I'am trying to port fedora to mips cpu,some packages like "sudo" "krb5", following is the Makefile of "sudo" generated by configure which "-fpie" "-pie" flags was auto added.
SUDO_LIBS = -laudit -lselinux -lutil -lpam -ldl -lldap $(LIBS) $(NET_LIBS)
CFLAGS = -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -mabi=32 -march=mips3 -fpie
LDFLAGS = -L. -pie
when i try run sudo , core dumped happen.
call frame in gdb --core core.8420:
#0 0x2ad65bdc in elf_dynamic_do_rel (scope=<value optimized out>, reloc_mode=<value optimized out>, consider_profiling=<value optimized out>)
at do-rel.h:120
#1 _dl_relocate_object (scope=<value optimized out>, reloc_mode=<value optimized out>, consider_profiling=<value optimized out>) at dl-reloc.c:268
#2 0x2ad5bd7c in dl_main (phdr=<value optimized out>, phnum=<value optimized out>, user_entry=<value optimized out>, auxv=<value optimized out>)
at rtld.c:2254
#3 0x2ad73744 in _dl_sysdep_start (start_argptr=<value optimized out>, dl_main=0x2ad5aa38 <dl_main>) at ../elf/dl-sysdep.c:244
#4 0x2ad58f08 in _dl_start_final (arg=0x7fc6d990, info=<value optimized out>) at rtld.c:334
#5 0x2ad590d8 in _dl_start (arg=0x7fc6d990) at rtld.c:562
#6 0x2ad588f8 in __start () from /lib/ld.so.1
Backtrace stopped: frame did not save the PC
when i remove -pie ld flag, everything is ok, is this because of binutils of or glibc library loader?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这是 binutils 2.20 中的一个已知错误 - 它应该在新版本中修复。看
此 bugzilla 条目。
This was a known bug in binutils 2.20 - it should be fixed in newer releases. See
this bugzilla entry.