[llvm-dev] A bug-report too difficult to make

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

[llvm-dev] A bug-report too difficult to make

Tom Stellard via llvm-dev

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
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
Reply | Threaded
Open this post in threaded view
|

Re: [llvm-dev] A bug-report too difficult to make

Tom Stellard via llvm-dev
Hi,

It looks like there's an `extern "C"` declaration in the corresponding header file, which appears to be sufficient. 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 <[hidden email]> 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
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev

_______________________________________________
LLVM Developers mailing list
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
Reply | Threaded
Open this post in threaded view
|

Re: [llvm-dev] A bug-report too difficult to make

Tom Stellard via llvm-dev

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:[hidden email]]
Sent: Wednesday, July 11, 2018 1:56 AM
To: [hidden email]
Cc: llvm-dev <[hidden email]>
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, which appears to be sufficient. 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 <[hidden email]> 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
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev


_______________________________________________
LLVM Developers mailing list
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev