Solution to the problem provided in: https://gcc.gnu.org/ml/gcc-patches/2013-07/msg01258.html Sorry for the inconvenience. Cheers. 2017-03-10 16:38 GMT+01:00 Pedro Lopes <pedro.fraiao@xxxxxxxxx>: > I'm trying to register a pass in my gcc plugin code. To do so, I first > declare the my_first_pass class which derives from gimple_opt_pass > and, in turn, this class derives from opt_pass and so on... > > class my_first_pass : public gimple_opt_pass > { > public: > my_first_pass(gcc::context * ctx) : > gimple_opt_pass(my_first_pass_data, ctx) > {} > }; > > Then, I try to instantiate a my_first_pass object like in the code > below, while configuring the remaining fields of the > register_pass_info structure. > > struct register_pass_info pass_info; > pass_info.pass = new my_first_pass(g/*gcc related global variable*/); > ... > > To compile the above code, I generate a shared library which is then > loaded by gcc. Whenever I run gcc I get the following error, which I > know is caused by the creation of the my_first_pass object in the > above code: > > cc1plus: error: cannot load plugin ./plugin.so > ./structsizes.so: undefined symbol: _ZTI8opt_pass > > I'm following an online example, but if I run the > $(GCC_SRC)/gcc/testsuite/gcc.dg/plugin/one_time_plugin.c I get the > exact same problem. > > Tried with GCC 4.9.2 and 6.3.0 compiled from source. In both versions, > I tried the testsuite code which register a pass, obtaining the same > error. > > Thanks in advance, Cheers.