This is the mail archive of the
mailing list for the GCC project.
Creating a global string constant node.
- From: Matt Davis <mattdavis9 at gmail dot com>
- To: gcc at gcc dot gnu dot org
- Date: Sat, 4 Aug 2012 12:52:20 +1000
- Subject: Creating a global string constant node.
I need to create a global string constant node. In the past, I have
always been able to add global variables, but I have always left them
uninitialized. I know the trick is to build_decl() of VAR_DECL and, I
guess in this case the type char_node_type. However, I want the
global decl initialized and referring to a string literal. I know of
build_string_literal() but that does not create a decl node that I am
aware of. I am unsure as to how to set that literal to my VAR_DECL
instance, so that it is in the read-only section of the resulting
binary, and referred to by the identifier I pass to build_decl(). Is
there an example in the code my grep-foo has failed me for this