[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#710845: g++-4.6: mipsel executables built -Wl,-z,now -fPIE crash on startup



Package: g++-4.6
Version: 4.6.4-2
Severity: serious
Justification: makes other packages fail to build from source

On mipsel, C++ executables built with -Wl,-z,now and -fPIE (per dpkg's
customary hardening flags) crash on startup (jumping to NULL from
__libc_start_main@plt), leading to #710807 and likely also #708812.
Could you please take a look?

Thanks!

BTW, the same errors occur with g++-4.7 4.7.3-4 and g++-4.8 4.8.0-8;
please feel free to clone and/or reassign this report accordingly.

----------------------------------------------------------------------

$ cat test.cc
#include <string>

static std::string s;

int main(int, char**) { return 0; }
$ g++ -Wl,-z,now -fPIE test.cc
$ gdb a.out
GNU gdb (GDB) 7.4.1-debian
[...]
Reading symbols from /home/ucko/a.out...(no debugging symbols found)...done.
(gdb) run
Starting program: /home/ucko/a.out 

Program received signal SIGSEGV, Segmentation fault.
0x00000000 in ?? ()
(gdb) where
#0  0x00000000 in ?? ()
#1  0x00400620 in _PROCEDURE_LINKAGE_TABLE_ ()
Backtrace stopped: frame did not save the PC
(gdb) info sym 0x400620
__libc_start_main@plt in section .plt of /home/ucko/a.out
(gdb) break __libc_start_main@plt
Breakpoint 1 at 0x400620
(gdb) kill
Kill the program being debugged? (y or n) y
(gdb) run
Starting program: /home/ucko/a.out 

Breakpoint 1, 0x00400620 in __libc_start_main@plt ()
(gdb) where
#0  0x00400620 in __libc_start_main@plt ()
#1  0x00400678 in _ftext ()
(gdb) disass
Dump of assembler code for function __libc_start_main@plt:
=> 0x00400620 <+0>:     lui     t7,0x41
   0x00400624 <+4>:     lw      t9,2764(t7)
   0x00400628 <+8>:     jr      t9
   0x0040062c <+12>:    addiu   t8,t7,2764
End of assembler dump.


Reply to: