using plugin and lto: problem linking c-pragma symbol
Pierre Vittet
piervit@pvittet.com
Mon May 30 15:53:00 GMT 2011
Hello,
I try to use the plugin pragma-plugin.c which is given in the testsuite
(gcc/testsuite/g++.dg/plugin/pragma_plugin.c), I have compiled it as a
shared library.
If I try it on a simple c file it works, however, if I use -flto it
causes an error:
gcc -fplugin=./pragma_plugin.so -flto test.c
lto1: error: cannot load plugin ../pragma_plugin.so
../pragma_plugin.so: undefined symbol: c_register_pragma
lto-wrapper: /usr/bin/gcc returned 1 exit status
/usr/lib/gcc/i486-slackware-linux/4.7.0/../../../../i486-slackware-linux/bin/ld:
lto-wrapper failed
collect2: error: ld returned 1 exit status
I don't know much about LTO but I guess it is important to be able to
use langage specific function (such as c_register_pragma) in plugin even
when using lto. I have this need in others plugins (I would like to have
pragma support in MELT). Maybe a solution could be to define
c_register_pragma and others related functions as weak references
(however it mights not works for all plateform).
What would be the better way to patch this?
Pierre Vittet
More information about the Gcc
mailing list