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

Keith Walker
Mon, 29 Apr 2013 22:53:33 -0000

The size of an address on the target machine in the 32-bit DWARF format is NOT
restricted to 32-bits.  The size of an address on the target machine is
specified in the DWARF table headers.

For example, in the DWARF-3 Specification, section 7.5.1, the unit_length field
is used to specify whether the DWARF format is 32-bit or 64-bit (as well as
defining the length of the table).   However the address_size field is used to
specify the size of an address on the target machine.

So whether the DWARF format is 32-bit or 64-bit is independent of the size of
addresses on the target machine as they are specified by different fields.

It sounds like you are trying to load the DWARF sections into target memory ....
and if so I guess I would have to ask you why as they are not normally loaded
into target memory?

Keith

-----Original Message-----
From: Yuri [mailto:yuri at rawbw.com]
Sent: 29 April 2013 21:30
To: Keith Walker
Cc: Jiong Wang; LLVM Developers Mailing List
Subject: Re: [LLVMdev] How to prevent LLVM from emitting R_X86_64_32 ELF
relocations?

On 04/29/2013 09:12, Keith Walker wrote:
> You only need to go to 64-bit DWARF when your debugging information becomes
> too large to fit in 32-bit DWARF tables.

I am not sure if this is true.
Currently R_X86_64_32 EL relocations are issued for DWARF-32 debug info
sections. This is because the size of address in DWARF-32 is only
32-bits, according to the above mentioned specification. Such
relocations can't be resolved (without overflow) when the base address
is 64-bit and higher than 4GB threshold.

So I have to always load such ELFs into the space within the first 4GB,
otherwise relocation resolver will fail with overflow.

Yuri



-- IMPORTANT NOTICE: The contents of this email and any attachments are
confidential and may also be privileged. If you are not the intended recipient,
please notify the sender immediately and do not disclose the contents to any
other person, use it for any purpose, or store or copy the information in any
medium.  Thank you.