[LLVMdev] SymbolRef and getSize

Wehrli Johan johan.wehrli at heig-vd.ch
Wed Jul 15 08:52:29 PDT 2015


Hi everyone,

I’m currently playing with the clang driver and I encounter a strange bug.

It occurs when I used the getSize function from the SymbolRef class.

On iOS, the number returned is not always correct (some function have the right size).

Sadly,

This is my code (at the end of the main function into driver.cpp) :

####

ErrorOr<OwningBinary<Binary>> BinaryOrErr = createBinary(file);
if (std::error_code ec = BinaryOrErr.getError()) {
  return ec.value();
}

Binary &Binary = *BinaryOrErr.get().getBinary();
object::ObjectFile *objfile;

objfile = dyn_cast<ObjectFile>(&Binary);

for (const SymbolRef &Symbol : objfile->symbols()) {
uint64_t size;
  Symbol.getAddress(size);

}

####

During my previous search, I check machODump.cpp in order to see of the list all the function.

They never use the getSize() but they use the address (getAddress()) of the next function.

Does anyone have ever heard of a bug with this function or did I do something wrong?

Greeting,

Johan Wehrli




More information about the llvm-dev mailing list