The compiler may refuse to apply pragma Linker_Section with the same section
name to two different variables, if one is considered constant by the compiler
but not declared as such. Fixed thusly.
Tested on x86_64-suse-linux, applied on the mainline.
2014-01-25 Tristan Gingold <ging...@adacore.com>
* gcc-interface/decl.c (gnat_to_gnu_entity): Always build a variable
for E_Variable with a pragma Linker_Section.
--
Eric Botcazou
Index: gcc-interface/decl.c
===================================================================
--- gcc-interface/decl.c (revision 207071)
+++ gcc-interface/decl.c (working copy)
@@ -575,9 +575,13 @@ gnat_to_gnu_entity (Entity_Id gnat_entit
/* Simple variables, loop variables, Out parameters and exceptions. */
object:
{
+ /* Always create a variable for volatile objects and variables seen
+ constant but with a Linker_Section pragma. */
bool const_flag
= ((kind == E_Constant || kind == E_Variable)
&& Is_True_Constant (gnat_entity)
+ && !(kind == E_Variable
+ && Present (Linker_Section_Pragma (gnat_entity)))
&& !Treat_As_Volatile (gnat_entity)
&& (((Nkind (Declaration_Node (gnat_entity))
== N_Object_Declaration)