From: Ian Lance Taylor <iant@google.com>
To: "Abhijit Nandy" <abhijit.nandy@gmail.com>
Cc: "gcc" <gcc-help@gcc.gnu.org>
Subject: Re: How to insert external global variable declarations and pointer assignment statements through GCC plugin GIMPLE pass
Date: Tue, 14 Jun 2011 20:03:00 -0000 [thread overview]
Message-ID: <mcrd3igpb33.fsf@coign.corp.google.com> (raw)
In-Reply-To: <84220E2299EC44BBBB8A67D9B09BBBE1@abhiPC> (Abhijit Nandy's message of "Tue, 14 Jun 2011 19:31:31 +0200")
"Abhijit Nandy" <abhijit.nandy@gmail.com> 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
next prev parent reply other threads:[~2011-06-14 17:39 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-05-25 0:41 Abhijit Nandy
2011-05-25 8:20 ` Ian Lance Taylor
2011-05-31 12:47 ` Abhijit Nandy
2011-05-31 19:40 ` Ian Lance Taylor
2011-06-14 17:29 ` Abhijit Nandy
2011-06-14 17:39 ` Ian Lance Taylor
2011-06-14 18:36 ` Abhijit Nandy
2011-06-14 20:03 ` Ian Lance Taylor [this message]
2011-06-15 7:25 ` Abhijit Nandy
2011-06-15 9:14 ` Ian Lance Taylor
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=mcrd3igpb33.fsf@coign.corp.google.com \
--to=iant@google.com \
--cc=abhijit.nandy@gmail.com \
--cc=gcc-help@gcc.gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).