gas: add new command line option --gsframe

When --gsframe is specified, the assembler will generate a .sframe
section from the CFI directives in the assembly.

ChangeLog:

	* gas/as.c (parse_args): Parse args and set flag_gen_sframe.
	* gas/as.h: Introduce skeleton for --gsframe.
	* gas/doc/as.texi: document --gsframe.
This commit is contained in:
Indu Bhagat
2022-11-15 15:06:39 -08:00
parent 972d23ddbd
commit b07a297816
3 changed files with 18 additions and 1 deletions

View File

@ -315,6 +315,8 @@ Options:\n\
#endif #endif
fprintf (stream, _("\ fprintf (stream, _("\
generate GNU Build notes if none are present in the input\n")); generate GNU Build notes if none are present in the input\n"));
fprintf (stream, _("\
--gsframe generate SFrame unwind info\n"));
#endif /* OBJ_ELF */ #endif /* OBJ_ELF */
fprintf (stream, _("\ fprintf (stream, _("\
@ -499,7 +501,8 @@ parse_args (int * pargc, char *** pargv)
OPTION_COMPRESS_DEBUG, OPTION_COMPRESS_DEBUG,
OPTION_NOCOMPRESS_DEBUG, OPTION_NOCOMPRESS_DEBUG,
OPTION_NO_PAD_SECTIONS, OPTION_NO_PAD_SECTIONS,
OPTION_MULTIBYTE_HANDLING /* = STD_BASE + 40 */ OPTION_MULTIBYTE_HANDLING, /* = STD_BASE + 40 */
OPTION_SFRAME
/* When you add options here, check that they do /* When you add options here, check that they do
not collide with OPTION_MD_BASE. See as.h. */ not collide with OPTION_MD_BASE. See as.h. */
}; };
@ -530,6 +533,7 @@ parse_args (int * pargc, char *** pargv)
,{"elf-stt-common", required_argument, NULL, OPTION_ELF_STT_COMMON} ,{"elf-stt-common", required_argument, NULL, OPTION_ELF_STT_COMMON}
,{"sectname-subst", no_argument, NULL, OPTION_SECTNAME_SUBST} ,{"sectname-subst", no_argument, NULL, OPTION_SECTNAME_SUBST}
,{"generate-missing-build-notes", required_argument, NULL, OPTION_ELF_BUILD_NOTES} ,{"generate-missing-build-notes", required_argument, NULL, OPTION_ELF_BUILD_NOTES}
,{"gsframe", no_argument, NULL, OPTION_SFRAME}
#endif #endif
,{"fatal-warnings", no_argument, NULL, OPTION_WARN_FATAL} ,{"fatal-warnings", no_argument, NULL, OPTION_WARN_FATAL}
,{"gdwarf-2", no_argument, NULL, OPTION_GDWARF_2} ,{"gdwarf-2", no_argument, NULL, OPTION_GDWARF_2}
@ -993,6 +997,10 @@ This program has absolutely no warranty.\n"));
optarg); optarg);
break; break;
case OPTION_SFRAME:
flag_gen_sframe = 1;
break;
#endif /* OBJ_ELF */ #endif /* OBJ_ELF */
case 'Z': case 'Z':

View File

@ -337,6 +337,9 @@ COMMON int flag_execstack;
/* TRUE if .note.GNU-stack section with SEC_CODE should be created */ /* TRUE if .note.GNU-stack section with SEC_CODE should be created */
COMMON int flag_noexecstack; COMMON int flag_noexecstack;
/* TRUE if .sframe section should be created. */
COMMON int flag_gen_sframe;
/* name of emitted object file */ /* name of emitted object file */
COMMON const char *out_file_name; COMMON const char *out_file_name;

View File

@ -240,6 +240,7 @@ gcc(1), ld(1), and the Info entries for @file{binutils} and @file{ld}.
[@b{--gdwarf-<N>}] [@b{--gdwarf-sections}] [@b{--gdwarf-<N>}] [@b{--gdwarf-sections}]
[@b{--gdwarf-cie-version}=@var{VERSION}] [@b{--gdwarf-cie-version}=@var{VERSION}]
[@b{--generate-missing-build-notes=[no|yes]}] [@b{--generate-missing-build-notes=[no|yes]}]
[@b{--gsframe}]
[@b{--hash-size}=@var{N}] [@b{--hash-size}=@var{N}]
[@b{--help}] [@b{--target-help}] [@b{--help}] [@b{--target-help}]
[@b{-I} @var{dir}] [@b{-I} @var{dir}]
@ -847,6 +848,11 @@ These options control whether the ELF assembler should generate GNU Build
attribute notes if none are present in the input sources. attribute notes if none are present in the input sources.
The default can be controlled by the @option{--enable-generate-build-notes} The default can be controlled by the @option{--enable-generate-build-notes}
configure option. configure option.
@item --gsframe
@itemx --gsframe
Create @var{.sframe} section from CFI directives.
@end ifset @end ifset
@item --hash-size @var{N} @item --hash-size @var{N}