Hi all, I'm new to GCC etc, so I am going to add a lot of info which may not be needed: I'm trying to package gcc-python-plugin[0] for Gentoo on amd64, but after compiling the python.so library, I cannot load it into gcc as a plugin because of the following error: cc1: error: cannot load plugin /var/tmp/portage/dev-util/gcc-python-plugin-0.10/work/gcc-python-plugin-0.10-3.2/python.so /var/tmp/portage/dev-util/gcc-python-plugin-0.10/work/gcc-python-plugin-0.10-3.2/python.so: undefined symbol: warning_at This is happening only in GCC 4.7.1 x86_64-pc-linux-gnu. I am able to compile and load the plugin using GCC 4.6.3 x86_64-pc-linux-gnu and GCC 4.7.1 x86. I have tried a couple of things which have led me to think this is an issue with the symbol table in the python.so library. Here are some (I think) relevant nm outputs: # nm -C python.so | grep -C 5 warning_at U varpool_nodes 0000000000031890 T VEC_edge_as_PyList 0000000000035330 T VEC_tree_as_PyList U walk_gimple_op U warn_format U warning_at 0000000000031e00 T wrtp_mark_for_PyGccBasicBlock 0000000000031680 T wrtp_mark_for_PyGccCallgraphEdge 0000000000031690 T wrtp_mark_for_PyGccCallgraphNode 0000000000031f90 T wrtp_mark_for_PyGccCfg 0000000000031880 T wrtp_mark_for_PyGccEdge ** Notice the warning_at signature; there's actually no function symbol with signature in the whole table # nm -C /usr/lib/debug/usr/libexec/gcc/x86_64-pc-linux-gnu/4.7.1/cc1.debug | grep -C 5 warning_at 000000000090f350 T union_defs(df_ref_d*, web_entry*, unsigned int*, web_entry*, bool (*)(web_entry*, web_entry*)) 00000000007de1a0 T update_ssa(unsigned int) 00000000008e0b60 T vec_member(tree_node const*, VEC_tree_gc*) 00000000008957b0 T verify_ssa(bool) 0000000000775e90 T vinsn_copy(vinsn_def*, bool) 0000000000c18b50 T warning_at(unsigned int, int, char const*, ...) 00000000007effa0 T add_phi_arg(gimple_statement_d*, tree_node*, edge_def*, unsigned int) 000000000057b800 T alloc_block() 000000000080d650 T ao_ref_base(ao_ref_s*) 000000000080d600 T ao_ref_init(ao_ref_s*, tree_node*) 000000000062c910 T app_disable() ** Again, the warning_at symbol, but with signature # nm -C /usr/lib/debug/usr/libexec/gcc/x86_64-pc-linux-gnu/4.6.3/cc1.debug | grep -C 5 warning_at 00000000008b4160 T warn_function_noreturn 00000000006999d0 T warn_if_plugins 00000000004a6800 t warn_if_shadowing 000000000071c060 T warn_if_unused_value 000000000057b9d0 T warning 000000000057b910 T warning_at 00000000004defe0 t warning_candidate_p 00000000006df9f0 T warning_for_asm 00000000004b78a0 t warning_init 00000000010e13b3 b warning_issued.44446 00000000004e3270 T warnings_for_convert_and_chec ** warning_at with no signature in GCC 4.6.3 Compilation flags for the plugin are: CPPFLAGS+= -I$(GCCPLUGINS_DIR)/include -I$(GCCPLUGINS_DIR)/include/c-family -I. $(PYTHON_INCLUDES) CFLAGS?=-O2 -Werror -g CFLAGS+= -fPIC -fno-strict-aliasing -Wall I'm not using any special LDFLAGS. A compilation line of the plugin looks like this: cc -O2 -Werror -g -fPIC -fno-strict-aliasing -Wall -I/usr/lib/gcc/x86_64-pc-linux-gnu/4.7.1/plugin/include -I/usr/lib/gcc/x86_64-pc-linux-gnu/4.7.1/plugin/include/c-family -I. -I/usr/include/python2.7 -I/usr/include/python2.7 -c -o autogenerated-variable.o autogenerated-variable.c Linking looks like this cc -I/usr/lib/gcc/x86_64-pc-linux-gnu/4.7.1/plugin/include -I/usr/lib/gcc/x86_64-pc-linux-gnu/4.7.1/plugin/include/c-family -I. -I/usr/include/python2.7 -I/usr/include/python2.7 -O2 -Werror -g -fPIC -fno-strict-aliasing -Wall -shared gcc-python.o gcc-python-attribute.o gcc-python-callbacks.o gcc-python-callgraph.o gcc-python-cfg.o gcc-python-closure.o gcc-python-diagnostics.o gcc-python-function.o gcc-python-gimple.o gcc-python-location.o gcc-python-option.o gcc-python-parameter.o gcc-python-pass.o gcc-python-pretty-printer.o gcc-python-rtl.o gcc-python-tree.o gcc-python-variable.o gcc-python-version.o gcc-python-wrapper.o autogenerated-callgraph.o autogenerated-cfg.o autogenerated-option.o autogenerated-function.o autogenerated-gimple.o autogenerated-location.o autogenerated-parameter.o autogenerated-pass.o autogenerated-pretty-printer.o autogenerated-rtl.o autogenerated-tree.o autogenerated-variable.o -o python.so -lpthread -ldl -lutil -lm -lpython2.7 I went a bit further and tried out another plugin. I downloaded and built MELT sources and everything runs fine there. These are some nm outputs for that plugin: # nm -C $(gcc -print-file-name=plugin/melt.so) | grep -C 5 warning_at U debug_tree(tree_node*) U gt_ggc_m_S(void const*) 00000000000247d0 T melt_apply(meltclosure_st*, melt_un*, char const*, meltparam_un*, char const*, meltparam_un*) w pragma_lex(tree_node**) U print_node(_IO_FILE*, char const*, tree_node*, int) U warning_at(unsigned int, int, char const*, ...) U fancy_abort(char const*, int, char const*) U fatal_error(char const*, ...) U ggc_collect() U linemap_add(line_maps*, lc_reason, unsigned int, char const*, unsigned int) 0000000000026560 T meltgc_send(melt_un*, melt_un*, char const*, meltparam_un*, char const*, meltparam_un*) ** See the correct signature at warning_at These are my different GCC configurations in x86_64-pc-linux-gnu # gcc -v Using built-in specs. COLLECT_GCC=/usr/x86_64-pc-linux-gnu/gcc-bin/4.7.1/gcc COLLECT_LTO_WRAPPER=/usr/libexec/gcc/x86_64-pc-linux-gnu/4.7.1/lto-wrapper Target: x86_64-pc-linux-gnu Configured with: /var/tmp/portage/sys-devel/gcc-4.7.1/work/gcc-4.7.1/configure --prefix=/usr --bindir=/usr/x86_64-pc-linux-gnu/gcc-bin/4.7.1 --includedir=/usr/lib/gcc/x86_64-pc-linux-gnu/4.7.1/include --datadir=/usr/share/gcc-data/x86_64-pc-linux-gnu/4.7.1 --mandir=/usr/share/gcc-data/x86_64-pc-linux-gnu/4.7.1/man --infodir=/usr/share/gcc-data/x86_64-pc-linux-gnu/4.7.1/info --with-gxx-include-dir=/usr/lib/gcc/x86_64-pc-linux-gnu/4.7.1/include/g++-v4 --host=x86_64-pc-linux-gnu --build=x86_64-pc-linux-gnu --disable-altivec --disable-fixed-point --with-ppl --with-cloog --disable-ppl-version-check --with-cloog-include=/usr/include/cloog-ppl --enable-lto --enable-nls --without-included-gettext --with-system-zlib --enable-obsolete --disable-werror --enable-secureplt --enable-multilib --with-multilib-list=m32,m64 --enable-libmudflap --disable-libssp --enable-libgomp --with-python-dir=/share/gcc-data/x86_64-pc-linux-gnu/4.7.1/python --enable-checking=release --enable-languages=c,c++,java,fortran --enable-shared --enable-threads=posix --enable-__cxa_atexit --enable-clocale=gnu --enable-targets=all --with-bugurl=http://bugs.gentoo.org/ --with-pkgversion='Gentoo 4.7.1 p1.0, pie-0.5.3' Thread model: posix gcc version 4.7.1 (Gentoo 4.7.1 p1.0, pie-0.5.3) # gcc-4.6.3 -v Using built-in specs. COLLECT_GCC=gcc-4.6.3 COLLECT_LTO_WRAPPER=/usr/libexec/gcc/x86_64-pc-linux-gnu/4.6.3/lto-wrapper Target: x86_64-pc-linux-gnu Configured with: /var/tmp/portage/sys-devel/gcc-4.6.3/work/gcc-4.6.3/configure --prefix=/usr --bindir=/usr/x86_64-pc-linux-gnu/gcc-bin/4.6.3 --includedir=/usr/lib/gcc/x86_64-pc-linux-gnu/4.6.3/include --datadir=/usr/share/gcc-data/x86_64-pc-linux-gnu/4.6.3 --mandir=/usr/share/gcc-data/x86_64-pc-linux-gnu/4.6.3/man --infodir=/usr/share/gcc-data/x86_64-pc-linux-gnu/4.6.3/info --with-gxx-include-dir=/usr/lib/gcc/x86_64-pc-linux-gnu/4.6.3/include/g++-v4 --host=x86_64-pc-linux-gnu --build=x86_64-pc-linux-gnu --disable-altivec --disable-fixed-point --with-ppl --with-cloog --disable-ppl-version-check --with-cloog-include=/usr/include/cloog-ppl --enable-lto --enable-nls --without-included-gettext --with-system-zlib --disable-werror --enable-secureplt --enable-multilib --enable-libmudflap --disable-libssp --enable-libgomp --with-python-dir=/share/gcc-data/x86_64-pc-linux-gnu/4.6.3/python --enable-checking=release --enable-languages=c,c++,java,fortran --enable-shared --enable-threads=posix --enable-__cxa_atexit --enable-clocale=gnu --enable-targets=all --with-bugurl=http://bugs.gentoo.org/ --with-pkgversion='Gentoo 4.6.3 p1.0, pie-0.5.1' Thread model: posix gcc version 4.6.3 (Gentoo 4.6.3 p1.0, pie-0.5.1) Any help would be greatly appreciated. Thanks in advance. David E. Narváez