globals, modules and badref.

While adapting my JIT compiler to ToT coming from 2.5, I found this:

Referencing global in another module!
        %3 = bitcast [8 x i8]** <badref> to i8* ; <i8*> [#uses=1]Instruction

<badref> is a naked (void*) pointer. This worked on 2.5 without problem.

I tried creating a GlobalVariable:

external constant [8 x i8]* ; <[8 x i8]**>:<badref> [#uses=0]

but there it is <badref> again (and the declaration does not shows on
the generated llvm assembly file).

The compiler creates only one module. How can LLVM complain about the
global being on another module?

How to fix this?

Is it documented somewhere? (there is no mention of <badref> on the
Language Reference Manual)

Óscar Fuentes <ofv@wanadoo.es> writes:

[snip]

Fixed. Seems that 2.6 requires a bit more boilerplate for constants.

The error messages thrown by the verifier are not helpful at all. It
would be a good idea to document the <badref> thing.