Hi, 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" ? Thanks for any advice. Quang -------------- next part -------------- A non-text attachment was scrubbed... Name: simple01.ll Type: application/octet-stream Size: 15207 bytes Desc: not available URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20080723/c5ed1954/attachment.obj>
> 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. Ciao, Duncan.
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