* [Ada] Fix relocation problem in DWARF debug info
@ 2009-04-22 22:35 Eric Botcazou
0 siblings, 0 replies; only message in thread
From: Eric Botcazou @ 2009-04-22 22:35 UTC (permalink / raw)
To: gcc-patches
[-- Attachment #1: Type: text/plain, Size: 485 bytes --]
With the 4.3.x series and above the compiler emits (more verbose) debug info
in DWARF for CONST_DECLs. This can bring about problems for constants coming
from other compilation units whose initializer is not absolute.
Tested on i586-suse-linux, applied on all active branches.
2009-04-22 Eric Botcazou <ebotcazou@adacore.com>
* gcc-interface/utils.c (create_var_decl_1): Do not emit debug info
for an external constant whose initializer is not absolute.
--
Eric Botcazou
[-- Attachment #2: p.diff --]
[-- Type: text/x-diff, Size: 872 bytes --]
Index: gcc-interface/utils.c
===================================================================
--- gcc-interface/utils.c (revision 146578)
+++ gcc-interface/utils.c (working copy)
@@ -1348,6 +1348,15 @@ create_var_decl_1 (tree var_name, tree a
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);
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2009-04-22 22:04 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-04-22 22:35 [Ada] Fix relocation problem in DWARF debug info Eric Botcazou
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).