[LLVMbugs] [Bug 7957] New: The x86-64 backend incorrectly generates 32 bit direct relocations for COFF

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Sat Aug 21 09:03:21 PDT 2010


           Summary: The x86-64 backend incorrectly generates 32 bit direct
                    relocations for COFF
           Product: new-bugs
           Version: trunk
          Platform: PC
        OS/Version: Windows XP
            Status: NEW
          Severity: normal
          Priority: P
         Component: new bugs
        AssignedTo: unassignedbugs at nondot.org
        ReportedBy: bigcheesegs at gmail.com
                CC: llvmbugs at cs.uiuc.edu

Created an attachment (id=5393)
 --> (http://llvm.org/bugs/attachment.cgi?id=5393)
llvm IR and generated assembly

While working on adding x86-64 bit support to the COFF object writer, I've run
into a bug that I don't know how to solve.

A simple hello world example (attached as hello.ll) compiles with:

llc -filetype=obj -mtriple x86_64-pc-win32

But the resulting binary cannot be linked with link.exe without passing
-largeaddressspaceaware:no. This means that the binary will only have access to
the lowest 2GiB of virtual address space.

I've reduced this down to the x86-64 backend generating 32 bit direct
relocations instead of the proper 64 bit relocations.

I've attached the generated assembly code for ELF, MachO, and COFF. You can see
that both ELF and MachO use 64 bit instructions and registers, while COFF uses
32 bit.

Files generated with

llc -mtriple x86_64-pc-win32 hello.ll -o hello-coff.s
llc -mtriple x86_64-pc-linux hello.ll -o hello-elf.s
llc -mtriple x86_64-apple-darwin hello.ll -o hello-macho.s

Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.

More information about the llvm-bugs mailing list