[gcc r8-10062] Fix link failure with debug info in LTO mode
Eric Botcazou
ebotcazou@gcc.gnu.org
Tue Feb 25 11:47:00 GMT 2020
https://gcc.gnu.org/g:e803bacc36955686a633bfb48d2ee433d503edfa
commit r8-10062-ge803bacc36955686a633bfb48d2ee433d503edfa
Author: Eric Botcazou <ebotcazou@gcc.gnu.org>
Date: Tue Feb 25 12:34:00 2020 +0100
Fix link failure with debug info in LTO mode
This fixes a regression whereby the program fails to link with debug
info in LTO mode because of an undefined reference to a symbol coming
from the object files containing the early debug info.
* dwarf2out.c (dwarf2out_size_function): Run in early-DWARF mode.
Diff:
---
gcc/ChangeLog | 4 ++++
gcc/dwarf2out.c | 1 +
gcc/testsuite/ChangeLog | 6 ++++++
gcc/testsuite/gnat.dg/lto24.adb | 10 ++++++++++
gcc/testsuite/gnat.dg/lto24_pkg1.ads | 17 +++++++++++++++++
gcc/testsuite/gnat.dg/lto24_pkg2.adb | 8 ++++++++
gcc/testsuite/gnat.dg/lto24_pkg2.ads | 5 +++++
7 files changed, 51 insertions(+)
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index fbf5627..e2638bb 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,7 @@
+2019-02-25 Eric Botcazou <ebotcazou@adacore.com>
+
+ * dwarf2out.c (dwarf2out_size_function): Run in early-DWARF mode.
+
2020-02-25 Roman Zhuykov <zhroma@ispras.ru>
Backport from master
diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c
index 12e33c2..23107c0 100644
--- a/gcc/dwarf2out.c
+++ b/gcc/dwarf2out.c
@@ -27627,6 +27627,7 @@ dwarf2out_inline_entry (tree block)
static void
dwarf2out_size_function (tree decl)
{
+ set_early_dwarf s;
function_to_dwarf_procedure (decl);
}
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 09d2cec..8de667f7 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,9 @@
+2019-02-25 Eric Botcazou <ebotcazou@adacore.com>
+
+ * gnat.dg/lto24.adb: New test.
+ * gnat.dg/lto24_pkg1.ads: New helper.
+ * gnat.dg/lto24_pkg2.ad[sb]: Likewise.
+
2020-02-25 Richard Sandiford <richard.sandiford@arm.com>
Backport from mainline
diff --git a/gcc/testsuite/gnat.dg/lto24.adb b/gcc/testsuite/gnat.dg/lto24.adb
new file mode 100644
index 0000000..998b447
--- /dev/null
+++ b/gcc/testsuite/gnat.dg/lto24.adb
@@ -0,0 +1,10 @@
+-- { dg-do link }
+-- { dg-options "-O -g -flto" { target lto } }
+
+with Lto24_Pkg1;
+
+procedure Lto24 is
+ R : Lto24_Pkg1.Rec (False);
+begin
+ R.Empty := True;
+end;
diff --git a/gcc/testsuite/gnat.dg/lto24_pkg1.ads b/gcc/testsuite/gnat.dg/lto24_pkg1.ads
new file mode 100644
index 0000000..abe7e91
--- /dev/null
+++ b/gcc/testsuite/gnat.dg/lto24_pkg1.ads
@@ -0,0 +1,17 @@
+with Lto24_Pkg2;
+
+package Lto24_Pkg1 is
+
+ Max_Elem : constant Natural := Lto24_Pkg2.Get;
+
+ type Arr is array (Natural range <>) of Boolean;
+
+ type Rec (B : Boolean) is record
+ I : Integer;
+ case B is
+ when True => A : Arr (1 .. Max_Elem);
+ when False => Empty : Boolean;
+ end case;
+ end record;
+
+end Lto24_Pkg1;
diff --git a/gcc/testsuite/gnat.dg/lto24_pkg2.adb b/gcc/testsuite/gnat.dg/lto24_pkg2.adb
new file mode 100644
index 0000000..12fb34e
--- /dev/null
+++ b/gcc/testsuite/gnat.dg/lto24_pkg2.adb
@@ -0,0 +1,8 @@
+package body Lto24_Pkg2 is
+
+ function Get return Natural is
+ begin
+ return 16;
+ end;
+
+end Lto24_Pkg2;
diff --git a/gcc/testsuite/gnat.dg/lto24_pkg2.ads b/gcc/testsuite/gnat.dg/lto24_pkg2.ads
new file mode 100644
index 0000000..79a916e
--- /dev/null
+++ b/gcc/testsuite/gnat.dg/lto24_pkg2.ads
@@ -0,0 +1,5 @@
+package Lto24_Pkg2 is
+
+ function Get return Natural;
+
+end Lto24_Pkg2;
More information about the Gcc-cvs
mailing list