[LLVMdev] Fix for non-standard variable length array + Visual C X86 specific code

Chris Lattner sabre at nondot.org
Mon Oct 18 09:50:31 PDT 2004


On Mon, 18 Oct 2004, Morten Ofstad wrote:

> Chris Lattner wrote:
> > Can you explain what goes wrong without the stub?  It's the only part that
> > I didn't apply.
>
> The X86 backend doesn't get registered since there are no references to
> symbols in X86TargetMachine the object file is never pulled in from the
> library I create, and thus the static intializer for the RegisterTarget
> is never called...

I'm not sure how your patch fixes it though.  The only references added by
your change would be within the X86 library.  How does this change the
situation?

>    RegisterTarget<X86TargetMachine> X("x86", "  IA-32 (Pentium and above)");
>
> I've tried some other ways to resolve it, but so far I've had no luck ..
>    any suggestions are appreciated, as this is a problem in other places
> as well - and I'm not happy with the IncludeFile hack, I can well
> understand why you didn't want to apply it.

One of the funny things about the LLVM Unix build is that we can build
libraries in three different ways: as .a files, as .so files, and as .o
files.  The IncludeFile hack is used for libraries compmiled to .a files,
to make sure that the library is actually linked in.  The other two types
of library (X86 is a .o file version) do not have this problem: they
"library" either gets linked in as a unit or not.

I'm not sure if VC has something like this, but I strongly suspect it
does.  The trick is getting libx86 to compile as a single unit that is
forced to link in.

-Chris

-- 
http://llvm.org/
http://nondot.org/sabre/




More information about the llvm-dev mailing list