bool flag_generate_build_notes = DEFAULT_GENERATE_BUILD_NOTES;
#endif
+/* If DEFAULT_SFRAME is 0 instead, flag_gen_sframe gets the default
+ enum value GEN_SFRAME_DEFAULT_NONE. */
+#if DEFAULT_SFRAME
+enum gen_sframe_option flag_gen_sframe = GEN_SFRAME_CONFIG_ENABLED;
+#endif
+
segT reg_section;
segT expr_section;
segT text_section;
generate GNU Build notes if none are present in the input\n"));
fprintf (stream, _("\
--gsframe[={no|yes}] whether to generate SFrame stack trace information\n\
- (default: no)\n"));
+ (default: %s)\n"), DEFAULT_SFRAME ? "yes" : "no");
# if defined (TARGET_USE_SCFI) && defined (TARGET_USE_GINSN)
fprintf (stream, _("\
--scfi=experimental Synthesize DWARF CFI for hand-written asm\n\
/* Define default value for RISC-V -mpriv-spec */
#undef DEFAULT_RISCV_PRIV_SPEC
+/* Define to 1 if you want to emit SFrames by default. */
+#undef DEFAULT_SFRAME
+
/* Define to 1 if you want to check x86 TLS relocation by default. */
#undef DEFAULT_X86_TLS_CHECK
enable_x86_relax_relocations
enable_x86_tls_check
enable_elf_stt_common
+enable_default_sframe
enable_generate_build_notes
enable_mips_fix_loongson3_llsc
enable_x86_used_note
--enable-x86-tls-check check x86 TLS relocation by default
--enable-elf-stt-common generate ELF common symbols with STT_COMMON type by
default
+ --enable-default-sframe generate SFrame by default
--enable-generate-build-notes
generate GNU Build notes if none are provided by the
input
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 10780 "configure"
+#line 10782 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 10886 "configure"
+#line 10888 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
esac
fi
+ac_default_sframe=unset
+# Provide a configure time option to override our default.
+# Check whether --enable-default-sframe was given.
+if test "${enable_default_sframe+set}" = set; then :
+ enableval=$enable_default_sframe; case "${enableval}" in
+ yes) ac_default_sframe=1 ;;
+ no) ac_default_sframe=0 ;;
+esac
+fi
# Decide if the ELF assembler should default to generating
# GNU Build notes if none are provided by the input.
_ACEOF
+if test ${ac_default_sframe} = unset; then
+ ac_default_sframe=0
+fi
+
+cat >>confdefs.h <<_ACEOF
+#define DEFAULT_SFRAME $ac_default_sframe
+_ACEOF
+
+
cat >>confdefs.h <<_ACEOF
#define DEFAULT_GENERATE_BUILD_NOTES $ac_default_generate_build_notes
yes) ac_default_elf_stt_common=1 ;;
esac])dnl
+ac_default_sframe=unset
+# Provide a configure time option to override our default.
+AC_ARG_ENABLE(default-sframe,
+ AS_HELP_STRING([--enable-default-sframe],
+ [generate SFrame by default]),
+[case "${enableval}" in
+ yes) ac_default_sframe=1 ;;
+ no) ac_default_sframe=0 ;;
+esac])dnl
# Decide if the ELF assembler should default to generating
# GNU Build notes if none are provided by the input.
[Define to 1 if you want to generate ELF common symbols with the
STT_COMMON type by default.])
+if test ${ac_default_sframe} = unset; then
+ ac_default_sframe=0
+fi
+AC_DEFINE_UNQUOTED(DEFAULT_SFRAME,
+ $ac_default_sframe,
+ [Define to 1 if you want to emit SFrames by default.])
+
AC_DEFINE_UNQUOTED(DEFAULT_GENERATE_BUILD_NOTES,
$ac_default_generate_build_notes,
[Define to 1 if you want to generate GNU Build attribute notes
@itemx --gsframe=yes
Create @var{.sframe} section from CFI directives. The explicit
@option{--gsframe=yes} option behaves the same as @option{--gsframe}.
-Generation can be suppressed with @option{--gsframe=no}.
+Generation can be suppressed with @option{--gsframe=no}. The default can be
+controlled by a configure option @option{--enable-default-sframe}.
@end ifset
/* Generate SFrame section if the user:
- enables via the command line option, or
+ - default-enabled at configure-time via --enable-default-sframe, or
- specifies .sframe in the .cfi_sections directive and does not disable
via the command line. */
if (flag_gen_sframe == GEN_SFRAME_ENABLED
+ || flag_gen_sframe == GEN_SFRAME_CONFIG_ENABLED
|| ((all_cfi_sections & CFI_EMIT_sframe) != 0
&& flag_gen_sframe != GEN_SFRAME_DISABLED))
{
}
else
#endif
- as_bad (_(".sframe not supported for target"));
+ /* Avoid erroring with DEFAULT_SFRAME for non-default options, like
+ -32 on x86_64. */
+ sframe_as_bad (_(".sframe not supported for target"));
}
if ((all_cfi_sections & CFI_EMIT_debug_frame) != 0)
#ifndef GENSFRAME_H
#define GENSFRAME_H
+/* Errors shouldn't be emitted either if SFrames are default-enabled, as
+ we interpret default-enabled as "opportunistic SFrames". Users don't
+ want to be bothered by something preventing emission of SFrames in
+ such a case. */
+#define sframe_as_bad(format, ...) \
+ do { \
+ if (flag_gen_sframe == GEN_SFRAME_ENABLED) \
+ as_bad (format, ##__VA_ARGS__); \
+ } while (0)
+
#define SFRAME_FRE_ELEM_LOC_REG 0
#define SFRAME_FRE_ELEM_LOC_STACK 1