[LLVMdev] weird function

Chris Lattner clattner at apple.com
Wed Jul 23 11:34:43 PDT 2008


On Jul 23, 2008, at 11:31 AM, Duncan Sands wrote:

>> I  have tried to compile a simple cpp file with llvm-gcc. I have  
>> attached
>> the assemble file here.
>> I see a weird thing there. There are some call instructions, they  
>> call the
>> function "@_Znwj". But this function was only declared in the file,  
>> there is
>> no definition of it. So, how can it work, if this function is  
>> "empty" ?
>
> When you create a final executable using llvm-g++ it links with some  
> standard
> C++ libraries.  Probably @_Znwj is defined in one of those libraries.

_Znwj is aka "operator new".  You need to link to libstdc++.

-Chris



More information about the llvm-dev mailing list