Vladimir Vissoultchev via llvm-dev
2018-Jul-10 14:23 UTC
[llvm-dev] A bug-report too difficult to make
Hi all, I just found out that there is an extern "C" missing on the LLVMInitializeInstCombine function definition somewhere around this line: https://github.com/llvm-mirror/llvm/blob/master/lib/Transforms/InstCombine/I nstructionCombining.cpp#L3365 As a result the function name gets mangled in the .lib file and is not accessible from LLVM C API. cheers, </wqw> -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20180710/fe7fb7bf/attachment-0001.html>
George Burgess IV via llvm-dev
2018-Jul-10 22:56 UTC
[llvm-dev] A bug-report too difficult to make
Hi, It looks like there's an `extern "C"` declaration in the corresponding header file <https://github.com/llvm-mirror/llvm/blob/master/include/llvm-c/Initialization.h#L39>, which appears to be sufficient <https://godbolt.org/g/UCZ3qo>. All of my attempts to grep for `LLVMInitializeInstCombine` in my build directory are leaving me with unmangled symbols, though I can't say the same for `LLVMInitializeAggressiveInstCombiner`. r336736 is an attempt to fix `LLVMInitializeAggressiveInstCombiner`. If I missed something, please let me know. (and if you're still seeing a problem with `LLVMInitializeInstCombine`, more details about your setup/etc. would be appreciated.) :) Thanks, George On Tue, Jul 10, 2018 at 7:23 AM Vladimir Vissoultchev via llvm-dev < llvm-dev at lists.llvm.org> wrote:> Hi all, > > > > I just found out that there is an *extern "C"* missing on the > *LLVMInitializeInstCombine* function definition somewhere around this > line: > > > > > https://github.com/llvm-mirror/llvm/blob/master/lib/Transforms/InstCombine/InstructionCombining.cpp#L3365 > > > > As a result the function name gets mangled in the .lib file and is not > accessible from LLVM C API. > > > > cheers, > > </wqw> > _______________________________________________ > LLVM Developers mailing list > llvm-dev at lists.llvm.org > http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20180710/3739c9f6/attachment.html>
Vladimir Vissoultchev via llvm-dev
2018-Jul-11 13:36 UTC
[llvm-dev] A bug-report too difficult to make
Hi,
I think I missed the root cause of the problem the previous time. Consider your
sample code with a small tweak:
extern "C" {
void LLVMInitializeInstCombine(int);
}
char *LLVMInitializeInstCombine(int) { return 0; }
This will bomb out with error C2556: 'char
*LLVMInitializeInstCombine(int)': overloaded function differs only by return
type from 'void LLVMInitializeInstCombine(int)' in MSVC
But when you "tweak" the same way LLVMInitializeInstCombine in
InstructionCombining.cpp the LLVMInstCombine project compiles w/ no error.
So the root cause here seems to be that the .h file with the extern
"C" declaration of LLVMInitializeInstCombine is not included in
InstructionCombining.cpp source, so a mismatch between declaration vs definition
is possible and is actually happening.
My previous fix works but probably including Initialization.h would be better
altogether.
cheers,
</wqw>
From: George Burgess IV [mailto:george.burgess.iv at gmail.com]
Sent: Wednesday, July 11, 2018 1:56 AM
To: wqweto at gmail.com
Cc: llvm-dev <llvm-dev at lists.llvm.org>
Subject: Re: [llvm-dev] A bug-report too difficult to make
Hi,
It looks like there's an `extern "C"` declaration in the
corresponding header file
<https://github.com/llvm-mirror/llvm/blob/master/include/llvm-c/Initialization.h#L39>
, which appears to be sufficient <https://godbolt.org/g/UCZ3qo> . All of
my attempts to grep for `LLVMInitializeInstCombine` in my build directory are
leaving me with unmangled symbols, though I can't say the same for
`LLVMInitializeAggressiveInstCombiner`.
r336736 is an attempt to fix `LLVMInitializeAggressiveInstCombiner`. If I missed
something, please let me know. (and if you're still seeing a problem with
`LLVMInitializeInstCombine`, more details about your setup/etc. would be
appreciated.) :)
Thanks,
George
On Tue, Jul 10, 2018 at 7:23 AM Vladimir Vissoultchev via llvm-dev <llvm-dev
at lists.llvm.org <mailto:llvm-dev at lists.llvm.org> > wrote:
Hi all,
I just found out that there is an extern "C" missing on the
LLVMInitializeInstCombine function definition somewhere around this line:
https://github.com/llvm-mirror/llvm/blob/master/lib/Transforms/InstCombine/InstructionCombining.cpp#L3365
As a result the function name gets mangled in the .lib file and is not
accessible from LLVM C API.
cheers,
</wqw>
_______________________________________________
LLVM Developers mailing list
llvm-dev at lists.llvm.org <mailto:llvm-dev at lists.llvm.org>
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
<http://lists.llvm.org/pipermail/llvm-dev/attachments/20180711/5cb7307a/attachment.html>