将-pie标志传递给gcc时堆栈溢出

时间:2011-05-16 08:55:20

标签: gcc mips fedora glibc binutils

我试图将fedora移植到mips cpu,一些软件包如“sudo”“krb5”,以下是configure生成的“sudo”的Makefile,其中“-fpie”“-pie”标志是自动添加的。< / p>

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中调用框架 - 核心.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库加载器?

1 个答案:

答案 0 :(得分:0)

这是binutils 2.20中的一个已知错误 - 它应该在较新版本中修复。看到 this bugzilla entry