Yuri
2013-Apr-27 03:02 UTC
[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
Jiong Wang
2013-Apr-27 03:36 UTC
[LLVMdev] How to prevent LLVM from emitting R_X86_64_32 ELF relocations?
On 04/27/2013 11:02 AM, Yuri wrote:> 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.there is no support for Dwarf 64 yet. From what I known, there is no way you can get rid of that. looks like there are some discussions on this already, you can search bugzilla. http://llvm.org/bugs/show_bug.cgi?id=14969 http://llvm.org/bugs/show_bug.cgi?id=15173> > Yuri-- Regards, Jiong. Wang Tilera Corporation.
Keith Walker
2013-Apr-29 16:12 UTC
[LLVMdev] How to prevent LLVM from emitting R_X86_64_32 ELF relocations?
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 http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
Yuri
2013-Apr-29 20:29 UTC
[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
Possibly Parallel Threads
- [LLVMdev] How to prevent LLVM from emitting R_X86_64_32 ELF relocations?
- [LLVMdev] How to prevent LLVM from emitting R_X86_64_32 ELF relocations?
- [LLVMdev] How to prevent LLVM from emitting R_X86_64_32 ELF relocations?
- [LLVMdev] How to prevent LLVM from emitting R_X86_64_32 ELF relocations?
- [LLVMdev] How to prevent LLVM from emitting R_X86_64_32 ELF relocations?