"Abhijit Nandy" <abhijit.nandy@xxxxxxxxx> writes: > My C input file is testcode.c and after I compile with the plugin > enabled as : > > gcc -fplugin=./test_plugin.so -Wall -fdump-tree-gimple -fdump-tree-all > testcode.c molen_htx.c -o testcode > > The molen_htx.c has the molen_elfset() > > I get the following linker error : > > root@slax:/mnt/f/Thesis/gcc-pluginelf# make testcode > cc -I/usr/lib/gcc/i486-slackware-linux/4.5.2/plugin/include -fPIC > -Wall -c > -o test_plugin.o test_plugin.c > gcc -shared test_plugin.o -o test_plugin.so > gcc -fplugin=./test_plugin.so -Wall -fdump-tree-gimple -fdump-tree-all > testcode.c molen_htx.c -o testcode > plugin init test_plugin > testcode.c: In function 'main': > testcode.c:26:7: warning: unused variable 'q' > plugin init test_plugin > /tmp/ccLUccsU.o: In function `main': > testcode.c:(.text+0x82): undefined reference to `_binary_ccu_start' > <--------------- > collect2: ld returned 1 exit status > make: *** [testcode] Error 1 > > > A dump file called testcode.c.220t.replace is produced which does not > show the global declaration(if it is being inserted at all) > > But the undefined reference implies that the global extern declaration > was not inserted. A global extern declaration is not a definition. The variable needs to be defined somewhere. If your .c file has "extern char _binary_ccu_start;" you still need to have some .c file which has "char _binary_ccu_start;", right? Ian