[LLVMdev] Invalid bitcode signature

Duncan Sands baldrick at free.fr
Sun Feb 12 07:18:34 PST 2012

Hi Fraser,

> Oh, and upgrading hasn't actually fully worked, I'm still getting cases where
> it's not merging the two structs from each module properly.

that may depend on how you define "properly"! :)

> This, coupled with my issue of segfaulting when accessing a struct field
> that I know will exist once modules are linked, is causing me a bit of a
> headache.
> How do other people get around this?

First off, they configure LLVM with --enable-assertions so that they get
helpful messages rather than segmentation faults!  Secondly, if you know
what the final type is, or at least that it will have a certain field at
a certain position, why not declare an appropriate type T in your module,
one which has such a field in that position, and bitcast your opaque* to
a T* before using GEP.  Alternatively, bitcast your opaque* to an i8* and
do a GEP that offsets the pointer by the offset your field will be at.
This is assuming that you know in advance what the offset of your field is.

Ciao, Duncan.

> Thanks,
> Fraser
> Chris Lattner-2 wrote:
>> Are you using mainline or LLVM 3.0?  The behavior in this area has changed
>> since 3.0 was released (and it should now do what you want).
>> -Chris
>> _______________________________________________
>> LLVM Developers mailing list
>> LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
>> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev

More information about the llvm-dev mailing list