aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/gcc-interface/utils.c
diff options
context:
space:
mode:
authorEric Botcazou <ebotcazou@gcc.gnu.org>2009-04-22 22:01:57 +0000
committerEric Botcazou <ebotcazou@gcc.gnu.org>2009-04-22 22:01:57 +0000
commit5225a1389d0058ac8f64153efa64c8e07ec13c9a (patch)
tree8d659d6b9745a45328c35d5aa08f6b9fea4c07b2 /gcc/ada/gcc-interface/utils.c
parent89043e8ac1a763e9791944acc993c6ef1d642e2a (diff)
downloadgcc-5225a1389d0058ac8f64153efa64c8e07ec13c9a.zip
gcc-5225a1389d0058ac8f64153efa64c8e07ec13c9a.tar.gz
gcc-5225a1389d0058ac8f64153efa64c8e07ec13c9a.tar.bz2
utils.c (create_var_decl_1): Do not emit debug info for an external constant whose initializer is not absolute.
* gcc-interface/utils.c (create_var_decl_1): Do not emit debug info for an external constant whose initializer is not absolute. From-SVN: r146620
Diffstat (limited to 'gcc/ada/gcc-interface/utils.c')
-rw-r--r--gcc/ada/gcc-interface/utils.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/gcc/ada/gcc-interface/utils.c b/gcc/ada/gcc-interface/utils.c
index 088c83a..6ea9138 100644
--- a/gcc/ada/gcc-interface/utils.c
+++ b/gcc/ada/gcc-interface/utils.c
@@ -1347,6 +1347,15 @@ create_var_decl_1 (tree var_name, tree asm_name, tree type, tree var_init,
TREE_STATIC (var_decl)
= !extern_flag && (public_flag || static_flag || global_bindings_p ());
+ /* 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);