Okay, I'm past the GEP "have to dereference pointer first" problem of my
I now have a linkage error (I get undefined symbol when I try to
assemble the program).
gcc -o test.o test.s says:
/tmp/cczhiFk7.o(.text+0x7): In function `a':
: undefined reference to `_index_'
_index_ is defined like this:
%_index_ = external global long ; <long*> [#uses=12]
But, that's not what I expected to get when I defined it in the compiler
TheIndex = new GlobalVariable(
So, reading the documentation again, I discover that LinkOnceLinkage is
an _internal_ (static) linkage type. Fine, but why does LLVM give it
"external global" linkage?
Note that the Assembly reference says:
If none of the above identifiers are used, the global is
externally visible, meaning that it participates in linkage and
can be used to resolve external symbol references.
But, there's no way to do this in the code. You _must_ supply the third
argument to GlobalVariable's constructor (it doesn't default) and the
only values accepted are GlobalValue::LinkageTypes. If I use
"ExternalLinkage" is this the same as providing nothing in assembly and
getting the default "externally visible"?