]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
utils.c (create_var_decl_1): Do not emit debug info for an external constant whose...
authorEric Botcazou <ebotcazou@adacore.com>
Wed, 22 Apr 2009 22:03:39 +0000 (22:03 +0000)
committerEric Botcazou <ebotcazou@gcc.gnu.org>
Wed, 22 Apr 2009 22:03:39 +0000 (22:03 +0000)
* utils.c (create_var_decl_1): Do not emit debug info for an external
constant whose initializer is not absolute.

From-SVN: r146623

gcc/ada/ChangeLog
gcc/ada/utils.c

index 2f303f777bd68824e03c386df9675cbd8c7e017e..ecaae56eed58c8bfdebb78ad99d304fc38c35948 100644 (file)
@@ -1,3 +1,8 @@
+2009-04-22  Eric Botcazou  <ebotcazou@adacore.com>
+
+       * utils.c (create_var_decl_1): Do not emit debug info for an external
+       constant whose initializer is not absolute.
+
 2009-03-31  Eric Botcazou  <ebotcazou@adacore.com>
 
        * system-linux-alpha.ads (Functions_Return_By_DSP): Remove.
index 5caf5666dffeb2f556d4500255bbd43747d32581..2d4b90a873d37adb2a7e2f0bbf01aaaff7680c97 100644 (file)
@@ -1455,6 +1455,15 @@ create_var_decl_1 (tree var_name, tree asm_name, tree type, tree var_init,
   TREE_STATIC (var_decl)
     = public_flag || (global_bindings_p () ? !extern_flag : static_flag);
 
+  /* For an external constant whose initializer is not absolute, do not emit
+     debug info.  In DWARF this would mean a global relocation in a read-only
+     section which runs afoul of the PE-COFF runtime relocation mechanism.  */
+  if (extern_flag
+      && constant_p
+      && initializer_constant_valid_p (var_init, TREE_TYPE (var_init))
+          != null_pointer_node)
+    DECL_IGNORED_P (var_decl) = 1;
+
   if (asm_name && VAR_OR_FUNCTION_DECL_P (var_decl))
     SET_DECL_ASSEMBLER_NAME (var_decl, asm_name);