[LLVMdev] How to prevent LLVM from emitting R_X86_64_32 ELF relocations?

Keith Walker
Mon, 29 Apr 2013 16:12:02 -0000

I think that you may have confused 2 separate issues here; the size of the
DWARF tables with the size of addresses on the target system.

The 32-bit DWARF vs. 64-bit DWARF is all about the size of the tables in the
DWARF sections (and hence also the size of the references between entries in
the tables).

So a 32-bit DWARF section can correctly describe code/data addresses that
are 64-bit, and any references to variables/functions will require 64-bit
relocation entries.

However in this case the DWARF sections are effectively limited in size, and
references between one DWARF entry and another will use 32-bit relocation
entries.   It is these 32-bit relocations entries that I think you are
seeing in your image.

You only need to go to 64-bit DWARF when your debugging information becomes
too large to fit in 32-bit DWARF tables.

Keith

-----Original Message-----
From: llvmdev-bounces at cs.uiuc.edu [mailto:llvmdev-bounces at cs.uiuc.edu] On
Behalf Of Yuri
Sent: 27 April 2013 04:02
To: Jiong Wang
Cc: LLVM Developers Mailing List
Subject: Re: [LLVMdev] How to prevent LLVM from emitting R_X86_64_32 ELF
relocations?

On 04/26/2013 19:50, Jiong Wang wrote:
>
>
>   why do you want to prevent R_X86_64_32 generation? for 32bit dwarf,
> I think generation of R_X86_64_32 is reasonable.
>
>   you can check http://dwarfstd.org/doc/DWARF4.pdf.

Because R_X86_64_32 elements are 4-byte addresses and can't be relocated
for the 64-bit address space over 32-bit limit.

Dwarf2 actually allows for both 32bit and 64-bit relocations. The
document, mentioned by you, explains this in section 7.5.1.1 on page
143. If the first DWORD of .debug_info section is 0xffffffff, then this
is 64-bit format.

But LLVM for some reason always chooses DWARF 32-bit format. This is why
I asked the question. Resulting relocable 64-bit objects can't be loaded
into addresses that are over 32-bit limit.

Yuri
_______________________________________________
LLVM Developers mailing list
LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu