[LLVMbugs] [Bug 10833] New: LLVM generates wrong reloc type for global_ctors (section .init_array) for ARM target

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Fri Sep 2 02:17:35 PDT 2011


http://llvm.org/bugs/show_bug.cgi?id=10833

           Summary: LLVM generates wrong reloc type for global_ctors
                    (section .init_array) for ARM target
           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: barto at gmx.net
                CC: llvmbugs at cs.uiuc.edu


Hi,
I'm trying to get my LLVM generated .obj file (ELF) to link with the official
ARM linker together with a project that is C++ code compiled with ARMCC. The
file contains llvm.global_ctors that are emitted (correctly) to the .init_array
section. However LLVM emits a R_ARM_ABS32(2) relocation for the entries in the
.init_array section.
A comparison with a .cpp file compiled with ARMCC showed that it uses a
R_ARM_TARGET1(38) relocation. (see also
http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.dui0474c/CHDECJAJ.html)
As a consequence, the linked project crashes in __cpp_initialize__aeabi as the
relocation (from the LLVM compiled module) is wrong.

I tried for myself to find where to change code in LLVM to make LLVM emit the
correct relocation, but was unfortunately stuck.

Is there an easy way for LLVM to generate R_ARM_TARGET1 instead of R_ARM_ABS32
for .init_array?

My exact target configuration when generating the .obj file using LLVM is:
        std::string triple = "armv6-unknown-unknown-eabi";
        cpu = "mpcore"; // (ARM) needed for VFP
        // all these options needed for the ARM linker to use fz (fpmode=fast)
library instead of f or g (fpmode=ieee_full)
        llvm::FloatABIType = llvm::FloatABI::Hard;
        llvm::UnsafeFPMath = true;
        llvm::NoInfsFPMath = true;
        llvm::NoNaNsFPMath = true;

-- 
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