From: Segher Boessenkool Date: Tue, 10 Apr 2018 21:09:30 +0000 (+0200) Subject: rs6000: Enable -fasynchronous-unwind-tables by default X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=0359465c703ad3c214c52c772557ef1b3fe52183;p=gcc.git rs6000: Enable -fasynchronous-unwind-tables by default To find out where on-entry register values live at any point in a program, GDB currently tries to parse to parse the executable code. This does not work very well, for example it gets confused if some accesses to the stack use the frame pointer (r31) and some use the stack pointer (r1). A symptom is that backtraces can be cut short. This patch enables -fasynchronous-unwind-tables by default for rs6000, which causes us to emit DWARF unwind tables for all functions, solving these problems. This not do anything for sub-targets without DWARF, and only for ELF sub-targets for now. It increases executable size, but only modestly, and does not change memory use, only the disk image. * common/config/rs6000/rs6000-common.c (rs6000_option_init_struct): Enable -fasynchronous-unwind-tables by default if OBJECT_FORMAT_ELF. gcc/testsuite/ * gcc.target/powerpc/dfmode_off.c: Add -fno-asynchronous-unwind-tables. * gcc.target/powerpc/dimode_off.c: Ditto. * gcc.target/powerpc/tfmode_off.c: Ditto. * gcc.target/powerpc/timode_off.c: Ditto. From-SVN: r259298 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 68b05491bda..2031dc79d41 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2018-04-10 Segher Boessenkool + + * common/config/rs6000/rs6000-common.c (rs6000_option_init_struct): + Enable -fasynchronous-unwind-tables by default if OBJECT_FORMAT_ELF. + 2018-04-10 Segher Boessenkool PR target/85321 diff --git a/gcc/common/config/rs6000/rs6000-common.c b/gcc/common/config/rs6000/rs6000-common.c index 0ddadfd8506..ed348f59dfa 100644 --- a/gcc/common/config/rs6000/rs6000-common.c +++ b/gcc/common/config/rs6000/rs6000-common.c @@ -49,6 +49,15 @@ rs6000_option_init_struct (struct gcc_options *opts) /* Enable section anchors by default. */ if (!TARGET_MACHO) opts->x_flag_section_anchors = 1; + + /* By default, always emit DWARF-2 unwind info. This allows debugging + without maintaining a stack frame back-chain. It also allows the + debugger to find out where on-entry register values are stored at any + point in a function, without having to analyze the executable code (which + isn't even possible to do in the general case). */ +#ifdef OBJECT_FORMAT_ELF + opts->x_flag_asynchronous_unwind_tables = 1; +#endif } /* Implement TARGET_OPTION_DEFAULT_PARAMS. */ diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index de5332e5f9c..8de596e4f6e 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,10 @@ +2018-04-10 Segher Boessenkool + + * gcc.target/powerpc/dfmode_off.c: Add -fno-asynchronous-unwind-tables. + * gcc.target/powerpc/dimode_off.c: Ditto. + * gcc.target/powerpc/tfmode_off.c: Ditto. + * gcc.target/powerpc/timode_off.c: Ditto. + 2018-04-10 Kelvin Nilsen * gcc.target/powerpc/vec-ldl-1.c: New test. diff --git a/gcc/testsuite/gcc.target/powerpc/dfmode_off.c b/gcc/testsuite/gcc.target/powerpc/dfmode_off.c index 1942f484de9..b5940cbde61 100644 --- a/gcc/testsuite/gcc.target/powerpc/dfmode_off.c +++ b/gcc/testsuite/gcc.target/powerpc/dfmode_off.c @@ -1,5 +1,5 @@ /* { dg-do assemble } */ -/* { dg-options "-O2 -fno-align-functions -mtraceback=no -save-temps" } */ +/* { dg-options "-O2 -fno-align-functions -fno-asynchronous-unwind-tables -mtraceback=no -save-temps" } */ void w1 (void *x, double y) { *(double *) (x + 32767) = y; } void w2 (void *x, double y) { *(double *) (x + 32766) = y; } diff --git a/gcc/testsuite/gcc.target/powerpc/dimode_off.c b/gcc/testsuite/gcc.target/powerpc/dimode_off.c index 77a18630a84..19ca40c508b 100644 --- a/gcc/testsuite/gcc.target/powerpc/dimode_off.c +++ b/gcc/testsuite/gcc.target/powerpc/dimode_off.c @@ -1,5 +1,5 @@ /* { dg-do assemble } */ -/* { dg-options "-O2 -fno-align-functions -mtraceback=no -save-temps" } */ +/* { dg-options "-O2 -fno-align-functions -fno-asynchronous-unwind-tables -mtraceback=no -save-temps" } */ void w1 (void *x, long long y) { *(long long *) (x + 32767) = y; } void w2 (void *x, long long y) { *(long long *) (x + 32766) = y; } diff --git a/gcc/testsuite/gcc.target/powerpc/tfmode_off.c b/gcc/testsuite/gcc.target/powerpc/tfmode_off.c index cbb3d75b8e1..f19e7592fd4 100644 --- a/gcc/testsuite/gcc.target/powerpc/tfmode_off.c +++ b/gcc/testsuite/gcc.target/powerpc/tfmode_off.c @@ -2,7 +2,7 @@ /* { dg-skip-if "" { powerpc-ibm-aix* } } */ /* { dg-skip-if "no TFmode" { powerpc-*-eabi* } } */ /* { dg-require-effective-target longdouble128 } */ -/* { dg-options "-O2 -fno-align-functions -mtraceback=no -save-temps" } */ +/* { dg-options "-O2 -fno-align-functions -fno-asynchronous-unwind-tables -mtraceback=no -save-temps" } */ typedef float TFmode __attribute__ ((mode (TF))); diff --git a/gcc/testsuite/gcc.target/powerpc/timode_off.c b/gcc/testsuite/gcc.target/powerpc/timode_off.c index efeffa7d8d6..b63595347b5 100644 --- a/gcc/testsuite/gcc.target/powerpc/timode_off.c +++ b/gcc/testsuite/gcc.target/powerpc/timode_off.c @@ -1,6 +1,6 @@ /* { dg-do assemble { target { lp64 } } } */ /* { dg-skip-if "do not override -mcpu" { powerpc*-*-* } { "-mcpu=*" } { "-mcpu=power5" } } */ -/* { dg-options "-O2 -fno-align-functions -mtraceback=no -save-temps -mcpu=power5" } */ +/* { dg-options "-O2 -fno-align-functions -fno-asynchronous-unwind-tables -mtraceback=no -save-temps -mcpu=power5" } */ typedef int TImode __attribute__ ((mode (TI)));