aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Biener <rguenther@suse.de>2019-09-11 11:20:35 +0000
committerRichard Biener <rguenth@gcc.gnu.org>2019-09-11 11:20:35 +0000
commit5a307ee54bca63865b6e5e8ad690720adf0b9d78 (patch)
tree94e483c2a7f7db580d29f337e1cd73169eb6a10e
parent46dfa8ad6c18feb45d35734eae38798edb7c38cd (diff)
downloadgcc-5a307ee54bca63865b6e5e8ad690720adf0b9d78.zip
gcc-5a307ee54bca63865b6e5e8ad690720adf0b9d78.tar.gz
gcc-5a307ee54bca63865b6e5e8ad690720adf0b9d78.tar.bz2
lto-opts.c (lto_write_options): Stream -g when debug is enabled.
2019-09-11 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. From-SVN: r275640
-rw-r--r--gcc/ChangeLog8
-rw-r--r--gcc/doc/invoke.texi8
-rw-r--r--gcc/lto-opts.c4
-rw-r--r--gcc/lto-wrapper.c6
4 files changed, 26 insertions, 0 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 21c247b8..85bb9ba 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,5 +1,13 @@
2019-09-11 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.
+
+2019-09-11 Richard Biener <rguenther@suse.de>
+
PR tree-optimization/90387
* vr-values.c (vr_values::extract_range_basic): After inlining
simplify non-constant __builtin_constant_p to false.
diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi
index 234c1b7..6e91a66 100644
--- a/gcc/doc/invoke.texi
+++ b/gcc/doc/invoke.texi
@@ -10339,6 +10339,14 @@ conflicting translation units. Specifically
precedence; and for example @option{-ffp-contract=off} takes precedence
over @option{-ffp-contract=fast}. You can override them at link time.
+To enable debug info generation you need to supply @option{-g} at
+compile-time. If any of the input files at link time were built
+with debug info generation enabled the link will enable debug info
+generation as well. Any elaborate debug info settings
+like the dwarf level @option{-gdwarf-5} need to be explicitely repeated
+at the linker command line and mixing different settings in different
+translation units is discouraged.
+
If LTO encounters objects with C linkage declared with incompatible
types in separate translation units to be linked together (undefined
behavior according to ISO C99 6.2.7), a non-fatal diagnostic may be
diff --git a/gcc/lto-opts.c b/gcc/lto-opts.c
index 494d9c2..0e9f24e 100644
--- a/gcc/lto-opts.c
+++ b/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)
{
diff --git a/gcc/lto-wrapper.c b/gcc/lto-wrapper.c
index 5423adb..9a7bbd0 100644
--- a/gcc/lto-wrapper.c
+++ b/gcc/lto-wrapper.c
@@ -265,6 +265,7 @@ merge_and_complain (struct cl_decoded_option **decoded_options,
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_obstack, struct cl_decoded_option *opts,
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;