[LLVMdev] Instruction::getOpcodeName()

Chris Lattner sabre at nondot.org
Tue May 9 10:35:26 PDT 2006


On Tue, 9 May 2006, Reid Spencer wrote:
> When compiling a release version on Linux with GCC 3.4.4, I get the
> following warnings repeated multiple times when linking LLVMCore.o:

> /usr/bin/ld: `.gnu.linkonce.t._ZNK4llvm11Instruction13getOpcodeNameEv' referenced in section `.gnu.linkonce.r._ZNK4llvm11Instruction13getOpcodeNameEv' of /proj/llvm/build/lib/VMCore/Release/Instruction.o: defined in discarded section `.gnu.linkonce.t._ZNK4llvm11Instruction13getOpcodeNameEv' of /proj/llvm/build/lib/VMCore/Release/Instruction.o

Strange.

> This is apparently coming from Instruction.h:
> virtual const char *getOpcodeName() const {
>  return getOpcodeName(getOpcode());
> }

ok.

> Would anyone object to me putting this method into Instruction.cpp so
> that the multiple (ignored) copies don't get generated? I don't think
> this is getting inlined anyway because it is virtual. Does it need to be
> virtual?

You're right, moving it out of line would be fine.  However, you're also 
right that it doesn't actually need to be virtual.  I made it non virtual, 
so hopefully the problem will go away.

Thanks Reid!

-Chris

-- 
http://nondot.org/sabre/
http://llvm.org/




More information about the llvm-dev mailing list