On Tue, Mar 1, 2016 at 10:39 PM, Kristaps Dzonsons <[email protected]> wrote:
> I'm having a strange issue on 5.8 regarding compiling -static binaries.
>  In short, unless I specify -nopie for a particular statically-linked
> binary, it segfaults.  Am I making a mistake, maybe, in my compilation?
...
> Then I try the same, but linking with -static:
>
> % cc -static -L/usr/local/lib -o admin ...
>
> Now,
>
> % ./admin
> Segmentation fault (core dumped)
>
> % gdb ./admin
...
> (gdb) run
> Starting program: ./admin
>
> Program received signal SIGSEGV, Segmentation fault.
> 0x00000f92a5b46ced in _dl_boot_bind ()
> (gdb) bt
> #0  0x00000f92a5b46ced in _dl_boot_bind ()
> #1  0x00000f92a5b468e9 in __start ()
> #2  0x0000000000000000 in ?? ()

Well that's not good.  First, what's the output of
    readelf -edr admin

That covers the data used by _dl_boot_bind() to relocate the static
PIE process.  Next, can you run it under gdb like that and after it
gets a SEGV can you get the output of both 'bt' (like you did above)
and 'info reg'?  As is it looks like an R_X86_64_RELATIVE relocation
for a bogus location, but the readelf output should clarify that.


Phliip Guenther

Reply via email to