non-POD type with llvm-objdump

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::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@arxan.com
www.arxan.com

Well,

This patch gets it to build and it is now running check

Index: tools/llvm-objdump/llvm-objdump.cpp

Try to "svn up" first. :slight_smile:

-Eli

Oh man r142320 fixed this.

Wow… talk about off-by-one.

Joe

Joe Abbey
Software Architect
Arxan Technologies, Inc.
1305 Cumberland Ave, Ste 215
West Lafayette, IN 47906
jabbey@arxan.com
www.arxan.com

Mac G4.

The non-POD stuff was cleared out by Michael Spencer’s refactoring of llmv-objdump.

Thanks Michael!

Now I just have to figure out how to get Debug+Asserts to build on Mac G4.

Cheers,

Joe Abbey
Software Architect
Arxan Technologies, Inc.
1305 Cumberland Ave, Ste 215
West Lafayette, IN 47906
W: 765-889-4756 x2
C: 765-464-9893
jabbey@arxan.com
www.arxan.com