https://bugs.llvm.org/show_bug.cgi?id=43202

            Bug ID: 43202
           Summary: ARM FastIsel  is renaming the memcpy to
                    memcpy.<random-number> in getLibcallReg().
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: LLVM Codegen
          Assignee: unassignedclangb...@nondot.org
          Reporter: umesh.kalap...@gmail.com
                CC: llvm-bugs@lists.llvm.org, neeil...@live.com,
                    richard-l...@metafoo.co.uk

Created attachment 22461
  --> https://bugs.llvm.org/attachment.cgi?id=22461&action=edit
testcase

The attached file compiled like 

clang --target=arm-linux-eabi -mcpu=cortex-a9  -w -fno-builtin  -mlong-calls
testcase.cpp -c; nm testcase.o | grep memcpy
         U memcpy
         U memcpy.202
         U memcpy.203
         U memcpy.204

results with linker  undefined symbols error .

When we investigated why the codegen renames it ,the following code
ARMFastISel.cpp @ getLibcallReg  do so.

>>GlobalValue *GV = new GlobalVariable(M, Type::getInt32Ty(*Context), false,
                                        GlobalValue::ExternalLinkage, nullptr,
                                        Name);

where "Name=memcpy" in this case and GlobalVariable creates new instance with
"Name" if doesn't exist in the module table ,else its renames with appending
the random number to "Name".

But its not the semantics we required here ,hence we modified the code like 

>>GlobalValue *GV = cast 
>><GlobalVariable>(M.getOrInsertGlobal(Name.getSingleStringRef(), 
>>Type::getInt32Ty(*Context)));

where we used Module.getOrInsertGlobal () instead and getOrInsertGlobal()
creates new instance with "Name" if doesn't exist ,else returns the exist one .

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to