summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4>2015-09-17 09:47:43 +0000
committerrguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4>2015-09-17 09:47:43 +0000
commit6f86992324477d3ef11f116d96d8e7eacf854187 (patch)
tree6e2ef835fcb80c96a6f0fdaa4402ece9839684f0
parent32c2c7e7511f862990dc12a733df1f85ba738e1e (diff)
downloadgcc-6f86992324477d3ef11f116d96d8e7eacf854187.tar.gz
2015-09-17 Richard Biener <rguenther@suse.de>
* passes.c (rest_of_decl_compilation): Always call early_global_decl debug hook when we created a varpool node. * dwarf2out.c (dwarf2out_late_global_decl): When in LTO call dwarf2out_early_global_decl, when not just add location or value attributes to existing DIEs. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@227857 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/ChangeLog8
-rw-r--r--gcc/dwarf2out.c18
-rw-r--r--gcc/passes.c12
3 files changed, 31 insertions, 7 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index dcc6f2f4347..ffa966e00fb 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,11 @@
+2015-09-17 Richard Biener <rguenther@suse.de>
+
+ * passes.c (rest_of_decl_compilation): Always call early_global_decl
+ debug hook when we created a varpool node.
+ * dwarf2out.c (dwarf2out_late_global_decl): When in LTO call
+ dwarf2out_early_global_decl, when not just add location or
+ value attributes to existing DIEs.
+
2015-09-17 James Greenhalgh <james.greenhalgh@arm.com>
* config/aarch64/aarch64.md (copysigndf3): New.
diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c
index 7d098d8cb0e..04d593b16a2 100644
--- a/gcc/dwarf2out.c
+++ b/gcc/dwarf2out.c
@@ -21626,14 +21626,20 @@ dwarf2out_early_global_decl (tree decl)
static void
dwarf2out_late_global_decl (tree decl)
{
- /* Output any global decls we missed or fill-in any location
- information we were unable to determine on the first pass.
+ /* We have to generate early debug late for LTO. */
+ if (in_lto_p)
+ dwarf2out_early_global_decl (decl);
- Skip over functions because they were handled by the
- debug_hooks->function_decl() call in rest_of_handle_final. */
- if ((TREE_CODE (decl) != FUNCTION_DECL || !DECL_INITIAL (decl))
+ /* Fill-in any location information we were unable to determine
+ on the first pass. */
+ if (TREE_CODE (decl) == VAR_DECL
&& !POINTER_BOUNDS_P (decl))
- dwarf2out_decl (decl);
+ {
+ dw_die_ref die = lookup_decl_die (decl);
+ if (die)
+ add_location_or_const_value_attribute (die, decl, false,
+ DW_AT_location);
+ }
}
/* Output debug information for type decl DECL. Called from toplev.c
diff --git a/gcc/passes.c b/gcc/passes.c
index 1b677ac5a67..274e508f62d 100644
--- a/gcc/passes.c
+++ b/gcc/passes.c
@@ -318,7 +318,17 @@ rest_of_decl_compilation (tree decl,
&& !decl_function_context (decl)
&& !current_function_decl
&& DECL_SOURCE_LOCATION (decl) != BUILTINS_LOCATION
- && !decl_type_context (decl)
+ && (!decl_type_context (decl)
+ /* If we created a varpool node for the decl make sure to
+ call early_global_decl. Otherwise we miss changes
+ introduced by member definitions like
+ struct A { static int staticdatamember; };
+ int A::staticdatamember;
+ and thus have incomplete early debug and late debug
+ called from varpool node removal fails to handle it
+ properly. */
+ || (TREE_CODE (decl) == VAR_DECL
+ && TREE_STATIC (decl) && !DECL_EXTERNAL (decl)))
/* Avoid confusing the debug information machinery when there are
errors. */
&& !seen_error ())