Carl
2014-Jan-25 23:44 UTC
[LLVMdev] [windows+mingw] is there a way to tell llvm to generate symbol with a leading _ ?
Hello,
I was recommended to post my question here.
Here is the context for my question.
On Windows, mingw generates symbols with a leading _ in their name.
I have a project that combines regular C libraries compiled by mingw
(runtime.a) and IR code that I generated and compile via llvm libraries
(generated.a).
In my case generated.a uses variables exported by runtime.a.
And here lies the run, while those variables have the same name in the c
files that make runtime.a and in the IR code that I feed llvm, once they
get compiled, the former has a leading _ and the latter not.
To complicate things a little further, that project already work on macosx
and linux.
So, I can't want to rename the said variables in the IR code without
recreating ripples on the platforms.
Which I do want to avoid.
What I am looking for is the switch to tell llvm assembler "hey, we're
on
windows, please add the dreaded _".
Does such thing exist?
Where can I look for it?
I was told that I should add "m:w" to your data layout string. How
so?
By using the feature parameter of Target?
createTargetMachine ( StringRef Triple,
StringRef CPU,
StringRef Features,
const TargetOptions & Options,
Reloc::Model RM = Reloc::Default,
CodeModel::Model CM = CodeModel::Default,
CodeGenOpt::Level OL = CodeGenOpt::Default
) const [inline]
Cheers,
Carl.
PS: I'm posting in the correct mailing list?
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
<http://lists.llvm.org/pipermail/llvm-dev/attachments/20140126/1200b81e/attachment.html>
Rafael EspĂndola
2014-Jan-28 23:49 UTC
[LLVMdev] [windows+mingw] is there a way to tell llvm to generate symbol with a leading _ ?
On 25 January 2014 18:44, Carl <name.is.carl at gmail.com> wrote:> > Hello, > > I was recommended to post my question here. >...> I was told that I should add "m:w" to your data layout string. How so? > By using the feature parameter of Target?No, if this is codegen, it should just work. Check computeDataLayout in X86TargetMachine.cpp. The call to getManglingComponent should be adding the "m:w". If codegen is not involved, you need to set the datalayout in the Module by calling setDataLayout. Cheers, Rafael