Re: [RFC] Improve stabs debugging for mingw64 executables loaded at high addresses

Tristan Gingold
2010-09-14T15:14:34Z

On Sep 14, 2010, at 5:04 PM, Pierre Muller wrote:

> On 64-bit targets, stabs suffers from the fact that addresses
> are only stored as 32-bit values.
>
> For mingw64, I was able to debug executables loaded
> at address 0x100000000 (the default location for executables
> compiled by Free Pascal Compiler) by using the simple
> patch below.
>
> The idea of the patch is quite basic:
> add the 32 high bits of text_addr as
> to the offsets of all sections in read_dbx_symtab.
>
> I don't know if this is mingw64 (possibly 64-bit PE) specific or not...
>
> All those offsets seemed to be at zero at the time I added
> the high 32-bit part of text_addr, but maybe other
> targets do something else... If this should not be applied
> for other 64-bit targets, we could of course modify
> the tests before changing the offsets, restricting it to
> targets for which it is relevant.
>
> I just tried to use gcc to compile an executable
> with -Wl,--image-base,0x300000000, to force high load address,
> but this lead to lots of messages:
> relocation truncated to fit R_X86_64_32 against .text
> Free Pascal compiler doesn't seem to generate any of those
> time of relocations...
>
> Comments welcome,

I think that some 64 bits targets have 8 bytes for the address.

Tristan.