[LLVMdev] non-POD type with llvm-objdump

Joe Abbey jabbey at arxan.com
Tue Oct 18 16:25:56 PDT 2011


I'm so close to having LLVM build on PowerPC.  If there's any PowerPC experts, help?

Lines like this:

      outs() << "[" << format("%2d", i) << "]"
             << "(sec " << format("%2d", int16_t(symbol->SectionNumber)) << ")"
             << "(fl 0x" << format("%02x", symbol->Type.BaseType) << ")"
             << "(ty " << format("%3x", symbol->Type.ComplexType) << ")"
             << "(scl " << format("%3x", symbol->StorageClass) << ") "
             << "(nx " << unsigned(symbol->NumberOfAuxSymbols) << ") "
             << "0x" << format("%08x", symbol->Value) << " "
             << name << "\n";

Are trying to call the format function with

struct coff_symbol {
  struct StringTableOffset {
    support::ulittle32_t Zeroes;
    support::ulittle32_t Offset;
  };

  union {
    char ShortName[8];
    StringTableOffset Offset;
  } Name;

  support::ulittle32_t Value;
  support::little16_t SectionNumber;

  struct {
    support::ulittle8_t BaseType;
    support::ulittle8_t ComplexType;
  } Type;

  support::ulittle8_t  StorageClass;
  support::ulittle8_t  NumberOfAuxSymbols;
};

and on PowerPC it generates errors like:

/Users/jabbey/src/llvm/include/llvm/Support/Format.h: In member function 'int llvm::format_object1<T>::snprint(char*, unsigned int) const [with T = llvm::support::detail::packed_endian_specific_integral<unsigned int, little, unaligned>]':
/Users/jabbey/src/llvm/tools/llvm-objdump/llvm-objdump.cpp:622:   instantiated from here
/Users/jabbey/src/llvm/include/llvm/Support/Format.h:88: warning: cannot pass objects of non-POD type 'const struct llvm::support::detail::packed_endian_specific_integral<unsigned int, little, unaligned>' through '...'; call will abort at runtime
/Users/jabbey/src/llvm/include/llvm/Support/Format.h: In member function 'int llvm::format_object2<T1, T2>::snprint(char*, unsigned int) const [with T1 = llvm::support::detail::packed_endian_specific_integral<unsigned char, little, unaligned>, T2 = llvm::support::detail::packed_endian_specific_integral<unsigned char, little, unaligned>]':
/Users/jabbey/src/llvm/tools/llvm-objdump/llvm-objdump.cpp:622:   instantiated from here
/Users/jabbey/src/llvm/include/llvm/Support/Format.h:106: warning: cannot pass objects of non-POD type 'const struct llvm::support::detail::packed_endian_specific_integral<unsigned char, little, unaligned>' through '...'; call will abort at runtime

Can I just cast the value, or would the correct fix be in something like include/llvm/Support/Endian.h?

Thanks much!

Joe Abbey
Software Architect
Arxan Technologies, Inc.
1305 Cumberland Ave, Ste 215
West Lafayette, IN 47906
jabbey at arxan.com<mailto:jabbey at arxan.com>
www.arxan.com

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20111018/2e5c83e5/attachment.html>


More information about the llvm-dev mailing list