Samuel Benjamin Posted December 15, 2020 Report Posted December 15, 2020 Hello Everyone, I came to an issue which is only occuring with gcc-7.4.0 and linux 32 bit. The issue is with this static cast statement in the following scenario. # define SC_MAKE_FUNC_PTR(callback_tag, func) \ static_cast<sc_core::SC_ENTRY_FUNC>(&callback_tag::func) I Create a SystemC shared library (systemc.so) It has a memory Module Memory Module has TWO SC_METHODS p_memory and p_foo p_foo has no implementation --> this should give linking error. In order to provide some utlity to detect the undefined methods I create a stub.c file as shown below. This stub basically creates a function with the decorated name and has an implementation which issues a specific message instead of blocking the design. I generate (systemc_stub.so) to deal with the stub independent of systemc.so Then i Create a main where I load systemc_stub.so and then system.so Then i get the sc_main sybmol and launch the simulation. Design attached The Issue i see with gcc-7.4.0 , 32 bit is that the static cast fails as below. You will find in the code i inserted the code of SC_METHOD rather than the macro in order to see where the issue is coming from. Good case where the function is implemented inside systemc.so vs bad case. It looks to me the there is something happens with the static_cast to dispatch this function and cast it. Can anyone help me with this ? (gdb) p tmp2 $1 = (void (sc_core::sc_process_host::*)(sc_core::sc_process_host * const)) 0xf7fc140c <memory::p_memory()>, this adjustment -64 SC_ENTRY_FUNC tmp = static_cast<SC_ENTRY_FUNC>(&memory::p_foo); (gdb) n 46 ::sc_core::sc_process_handle p_foo_handle = sc_core::sc_get_curr_simcontext()->create_method_process( "p_foo", false, tmp, this, 0); (gdb) p tmp $1 = &virtual table offset -134397620, this adjustment -64 stub.c #ifdef __cplusplus #define DPI_LINK_DECL extern "C" #else #define DPI_LINK_DECL #endif #define FOUND_UNDEFINED_SYMBOL(nm) \ DPI_LINK_DECL void nm () {} FOUND_UNDEFINED_SYMBOL(_ZN6memory5p_fooEv) Thanks, Samuel gcc-7.4.0-issue.7z Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.