Re: Gdb, PIE and scan_dyntag(DT_DEBUG)

Robert Jarzmik <[email protected]>
Newsgroups gmane.comp.gdb.devel
Message-ID <[email protected]>
Jan Kratochvil <[email protected]> writes:

> On Tue, 25 Mar 2014 21:43:22 +0100, Robert Jarzmik wrote:
>> I have a problem with gdb not finding the shared library list when analyzing a
>> core dump of an ELF-X86-64 binary on Linux.
>
> The problem is it works for me.  Tested on Fedora 20 x86_64 although I am not
> aware of any distro-specific stuff which could affect this functionality.
> It is also relevant to know prelink status but I have tested this
> functionality now even with unprelinked ld.so and libc.so:

OK, you're right.
I finally found the culprit : in my case, it was the linker and strip
discrepency.

To be more precise, the ELF program headers of the unstripped binary and the
stripped binary didn't match, as in the unstripped one the .bss section was
aligned (fileoffset wise) on 8 bytes, while in the stripped version it was
aligned on 4 (as the .bss section alignement).

This was creating different filesizes for the segment containing the .bss
section, and therefore gdb's svr4_relocate_*() function was lost and did not
relocate my PIE executable.

GDB was right, it's the linker which was faulty in my case.

Cheers.

--
Robert
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.