[LLVMbugs] [Bug 4253] New: available_externally causes wrong PIC code generation

bugzilla-daemon at cs.uiuc.edu bugzilla-daemon at cs.uiuc.edu
Sat May 23 06:21:11 PDT 2009


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

           Summary: available_externally causes wrong PIC code generation
           Product: new-bugs
           Version: unspecified
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: new bugs
        AssignedTo: unassignedbugs at nondot.org
        ReportedBy: edwintorok at gmail.com
                CC: llvmbugs at cs.uiuc.edu


Created an attachment (id=3019)
 --> (http://llvm.org/bugs/attachment.cgi?id=3019)
tst.i

$ clang tst.i -fPIC -o tst.o -c
$ gcc -shared -o tst.so tst.o
/usr/bin/ld: tst.o: relocation R_X86_64_PC32 against undefined symbol
`atoi@@GLIBC_2.2.5' can not be used when making a shared object; recompile with
-fPIC

The IR looks like this:
define available_externally fastcc i32 @atoi(i8* %__nptr) nounwind readonly {
entry:
        %call = tail call i64 @strtol(i8* nocapture %__nptr, i8** null, i32 10)
nounwind readonly               ; <i64> [#uses=1]
        %conv = trunc i64 %call to i32          ; <i32> [#uses=1]
        ret i32 %conv
}

If I remove the 'available_externally' flag the file is compiled correctly.

The problem is that llc emits this for available_externally, probably thinking
that atoi is a local function:
call    atoi


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