stack overflow when pass -pie flags to gcc
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=0x7fc6d9开发者_如何学运维90) 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?
This was a known bug in binutils 2.20 - it should be fixed in newer releases. See this bugzilla entry.
精彩评论