[LLVMdev] LLVM Win32 Issue

Chuck Rose III cfr at adobe.com
Thu Feb 21 11:15:12 PST 2008


Hola Aaron,

Just having that code didn't work since the linker still stripped it
out, so I have that function called from the code in the system that
actually is being used by our app.  

Kinda grubby, but I include:

  #include "llvm/lib/Target/X86/X86TargetMachine.h"

Which is in the LLVM lib, not the LLVM inc directory.  This little
maneuver made our Mac builds really unhappy, so we conditionally compile
all this goo.

I don't remember needing to do anything other than include the lib, the
header above, and the bit of code I sent around.

I'm sure there are better ways to do this and I'd love to hear about
them if you discover something cool.

Chuck.


-----Original Message-----
From: llvmdev-bounces at cs.uiuc.edu [mailto:llvmdev-bounces at cs.uiuc.edu]
On Behalf Of Aaron Dwyer
Sent: Wednesday, February 20, 2008 7:16 PM
To: llvmdev at cs.uiuc.edu
Subject: [LLVMdev] LLVM Win32 Issue

Thanks for your response Chuck.

>From this and the other responses to my question, it looks like I'm
including all the right object files, so it must be something with
Visual Studio stripping "dead" code.

So, given your response Chuck, I have a few questions.

First, what exactly is the code that VStudio seems to be stripping?  I
might be able to figure out how to prevent it from being overzealous.

Second, I tried putting the code you gave in my app, and I got into a
wild goose chase of include files not being found.  Finally ended
with:

<myabsolutepathroot>\llvm\target\x86\x86instrinfo.h(225) : error
C2504: 'TargetInstrInfoImpl' : base class undefined

   Did you put that code into LLVM itself and then call it from your
app?

Lastly, what do you mean by "somewhere real"?

Thanks again,

Aaron


> You'll need to link in x86.lib as generated from the VStudio project.
>
> I had trouble convincing VStudio's linker to keep the relevant code
> around, so did this in the app I work on:
>
> void
> LLVMCompiledProgram::linkerTrick()
> {
>     llvm::Module staticModule("staticModule");
>     std::string staticString;
>     llvm::X86_32TargetMachine staticMachine(staticModule,
staticString);
> }
>
> Which I called from somewhere real.
>
> Chuck.
_______________________________________________
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