How to insert external global variable declarations and pointer assignment statements through GCC plugin GIMPLE pass
Ian Lance Taylor
iant@google.com
Wed May 25 08:20:00 GMT 2011
"Abhijit Nandy" <abhijit.nandy@gmail.com> writes:
> This is ok but I am unable to figure out how to insert a statement
> like the following in global scope:
> extern char _binary_ccu_start;
>
> or to make an assigment like the following inside main :
> char *p = &_binary_ccu_start;
>
> Is this possible to do using a plugin ?
You need to create a VAR_DECL with TREE_STATIC set to 1 and pass it to
rest_of_decl_compilation. Then you can get an expression which takes it
address by passing the decl to build_fold_addr_expr.
Ian
More information about the Gcc-help
mailing list