This is the mail archive of the
mailing list for the GCC project.
Re: Injecting data declarations?
Reuben Harris wrote:
I would like to modify GCC to inject a link-once word-sized data
declaration into the object file, i.e. to behave AS IF there were
extra declarations in the source code, e.g.:
Builtin functions are a good source for how to create decls, but they
create mostly type decls. See for instance c_register_builtin_type in
c-common.c. The profilers are another good choice, and they create
variables. See for instance tree_init_ic_make_global_vars in
tree-profile.c. These aren't link-once variables though. I think all
you need for that is a call to make_decl_one_only, but you might want to
look for examples.