summaryrefslogtreecommitdiff
path: root/debian/patches/gcc-lto-pick-compile-time-g.diff
diff options
context:
space:
mode:
authorIgor Pashev <pashev.igor@gmail.com>2019-11-18 15:53:29 +0300
committerIgor Pashev <pashev.igor@gmail.com>2019-11-18 15:53:29 +0300
commit8f6c4b0033c72f8ac14694c419a99458339dd6a9 (patch)
tree06c106e622a58100aa85a381b9b65d222b076df4 /debian/patches/gcc-lto-pick-compile-time-g.diff
parent42156b5190f4fa150e1fab6777eb81e69d4db8c9 (diff)
downloadgcc-9-debian.tar.gz
Import gcc-9 (9.2.1-19)debian/9.2.1-19debian
Diffstat (limited to 'debian/patches/gcc-lto-pick-compile-time-g.diff')
-rw-r--r--debian/patches/gcc-lto-pick-compile-time-g.diff54
1 files changed, 54 insertions, 0 deletions
diff --git a/debian/patches/gcc-lto-pick-compile-time-g.diff b/debian/patches/gcc-lto-pick-compile-time-g.diff
new file mode 100644
index 0000000..3cbf48e
--- /dev/null
+++ b/debian/patches/gcc-lto-pick-compile-time-g.diff
@@ -0,0 +1,54 @@
+# DP: Make LTO link pick up compile-time -g
+
+https://gcc.gnu.org/ml/gcc-patches/2019-09/msg00501.html
+
+2019-09-09 Richard Biener <rguenther@suse.de>
+
+ * lto-opts.c (lto_write_options): Stream -g when debug is enabled.
+ * lto-wrapper.c (merge_and_complain): Pick up -g.
+ (append_compiler_options): Likewise.
+ (run_gcc): Re-instantiate handling -g0 at link-time.
+ * doc/invoke.texi (flto): Document debug info generation.
+
+--- a/src/gcc/lto-opts.c
++++ b/src/gcc/lto-opts.c
+@@ -94,6 +94,10 @@ lto_write_options (void)
+ : "-fno-pie");
+ }
+
++ /* If debug info is enabled append -g. */
++ if (debug_info_level > DINFO_LEVEL_NONE)
++ append_to_collect_gcc_options (&temporary_obstack, &first_p, "-g");
++
+ /* Append options from target hook and store them to offload_lto section. */
+ if (lto_stream_offload_p)
+ {
+--- a/src/gcc/lto-wrapper.c
++++ b/src/gcc/lto-wrapper.c
+@@ -265,6 +265,7 @@ merge_and_complain (struct cl_decoded_op
+ case OPT_fshow_column:
+ case OPT_fcommon:
+ case OPT_fgnu_tm:
++ case OPT_g:
+ /* Do what the old LTO code did - collect exactly one option
+ setting per OPT code, we pick the first we encounter.
+ ??? This doesn't make too much sense, but when it doesn't
+@@ -617,6 +618,7 @@ append_compiler_options (obstack *argv_o
+ case OPT_fopenacc:
+ case OPT_fopenacc_dim_:
+ case OPT_foffload_abi_:
++ case OPT_g:
+ case OPT_O:
+ case OPT_Ofast:
+ case OPT_Og:
+@@ -1399,6 +1401,10 @@ run_gcc (unsigned argc, char *argv[])
+ linker_output_rel = !strcmp (option->arg, "rel");
+ break;
+
++ case OPT_g:
++ /* Recognize -g0. */
++ skip_debug = option->arg && !strcmp (option->arg, "0");
++ break;
+
+ default:
+ break;