aboutsummaryrefslogtreecommitdiff
path: root/gas/as.c
diff options
context:
space:
mode:
authorIndu Bhagat <indu.bhagat@oracle.com>2024-01-15 01:00:13 -0800
committerIndu Bhagat <indu.bhagat@oracle.com>2024-01-15 03:31:35 -0800
commitad9bd833d48cd56697406f82ff2769a6a1dc5db7 (patch)
treefb2f17bc25c3affd840ffd9f2f4d5022ab46ce78 /gas/as.c
parent5802d3f47387f176380e143ee1a9ec202a679f5c (diff)
downloadgdb-ad9bd833d48cd56697406f82ff2769a6a1dc5db7.zip
gdb-ad9bd833d48cd56697406f82ff2769a6a1dc5db7.tar.gz
gdb-ad9bd833d48cd56697406f82ff2769a6a1dc5db7.tar.bz2
gas: add new command line option --scfi=experimental
When the command line option --scfi=experimenta is passed to the GNU assembler, it will synthesize DWARF call frame information (CFI) for the input assembly. The option --scfi=experimental will also ignore most of the existing .cfi_* directives, if already contained in the provided input file. Only the following CFI directives will not be ignored: - .cfi_sections, - .cfi_label, - .cfi_signal_frame To use SCFI, a target will need to: - define TARGET_USE_SCFI and TARGET_USE_GINSN, and other necessary definitions, - provide means to help GAS understand the target specific instruction semantics by creating ginsns. The upcoming support for SCFI is inteded to be experimental, hence the option --scfi=experimental. The --scfi= may see more options like --scfi=[all,none] added in future, once the SCFI support in GAS is mature and robust. The offering may also see for example, an --scfi=inline option for dealing with inline asm may be added in the future. In --scfi=inline option, the GNU assembler may consume (and not ignore) the compiler generated CFI for the code surrounding the inline asm. Also document the option. gas/ * as.c (show_usage): Add support for --scfi=experimental. (parse_args): Likewise. * as.h (enum synth_cfi_type): Define new type. * doc/as.texi: Document the new option.
Diffstat (limited to 'gas/as.c')
-rw-r--r--gas/as.c23
1 files changed, 21 insertions, 2 deletions
diff --git a/gas/as.c b/gas/as.c
index b83f0c6..659da18 100644
--- a/gas/as.c
+++ b/gas/as.c
@@ -321,6 +321,11 @@ Options:\n\
generate GNU Build notes if none are present in the input\n"));
fprintf (stream, _("\
--gsframe generate SFrame stack trace information\n"));
+# if defined (TARGET_USE_SCFI) && defined (TARGET_USE_GINSN)
+ fprintf (stream, _("\
+ --scfi=experimental Synthesize DWARF CFI for hand-written asm\n\
+ (experimental support)\n"));
+# endif
#endif /* OBJ_ELF */
fprintf (stream, _("\
@@ -511,7 +516,8 @@ parse_args (int * pargc, char *** pargv)
OPTION_NOCOMPRESS_DEBUG,
OPTION_NO_PAD_SECTIONS,
OPTION_MULTIBYTE_HANDLING, /* = STD_BASE + 40 */
- OPTION_SFRAME
+ OPTION_SFRAME,
+ OPTION_SCFI
/* When you add options here, check that they do
not collide with OPTION_MD_BASE. See as.h. */
};
@@ -543,7 +549,10 @@ parse_args (int * pargc, char *** pargv)
,{"sectname-subst", no_argument, NULL, OPTION_SECTNAME_SUBST}
,{"generate-missing-build-notes", required_argument, NULL, OPTION_ELF_BUILD_NOTES}
,{"gsframe", no_argument, NULL, OPTION_SFRAME}
-#endif
+# if defined (TARGET_USE_SCFI) && defined (TARGET_USE_GINSN)
+ ,{"scfi", required_argument, NULL, OPTION_SCFI}
+# endif
+#endif /* OBJ_ELF || OBJ_MAYBE_ELF. */
,{"fatal-warnings", no_argument, NULL, OPTION_WARN_FATAL}
,{"gdwarf-2", no_argument, NULL, OPTION_GDWARF_2}
,{"gdwarf-3", no_argument, NULL, OPTION_GDWARF_3}
@@ -982,6 +991,16 @@ This program has absolutely no warranty.\n"));
flag_execstack = 0;
break;
+# if defined (TARGET_USE_SCFI) && defined (TARGET_USE_GINSN)
+ case OPTION_SCFI:
+ if (optarg && strcasecmp (optarg, "experimental") == 0)
+ flag_synth_cfi = SYNTH_CFI_EXPERIMENTAL;
+ else
+ as_fatal (_("Invalid --scfi= option: `%s'; suggested option: experimental"),
+ optarg);
+ break;
+# endif
+
case OPTION_SIZE_CHECK:
if (strcasecmp (optarg, "error") == 0)
flag_allow_nonconst_size = false;