[PATCH,V6 02/10] gas: add new command line option --gctf-frame

Indu Bhagat indu.bhagat@oracle.com
Tue Aug 2 08:04:44 GMT 2022


[No changes from V5, V4, V3]

When --gctf-frame is specified, the assembler will generate a .ctf_frame
section from the CFI directives in the assembly.

ChangeLog:
	* gas/as.c (parse_args): Parse args and set flag_gen_ctf_frame.
	* gas/as.h: Introduce skeleton for --gctf-frame.
	* gas/doc/as.texi: document --gctf-frame.
---
 gas/as.c        | 10 +++++++++-
 gas/as.h        |  3 +++
 gas/doc/as.texi |  5 +++++
 3 files changed, 17 insertions(+), 1 deletion(-)

diff --git a/gas/as.c b/gas/as.c
index 6268779cf90..cacf5d6aa48 100644
--- a/gas/as.c
+++ b/gas/as.c
@@ -318,6 +318,8 @@ Options:\n\
 #endif
   fprintf (stream, _("\
                           generate GNU Build notes if none are present in the input\n"));
+  fprintf (stream, _("\
+  --gctf-frame            generate CTF Frame unwind info\n"));
 #endif /* OBJ_ELF */
 
   fprintf (stream, _("\
@@ -491,7 +493,8 @@ parse_args (int * pargc, char *** pargv)
       OPTION_COMPRESS_DEBUG,
       OPTION_NOCOMPRESS_DEBUG,
       OPTION_NO_PAD_SECTIONS,
-      OPTION_MULTIBYTE_HANDLING  /* = STD_BASE + 40 */
+      OPTION_MULTIBYTE_HANDLING,  /* = STD_BASE + 40 */
+      OPTION_CTF_FRAME
     /* When you add options here, check that they do
        not collide with OPTION_MD_BASE.  See as.h.  */
     };
@@ -522,6 +525,7 @@ parse_args (int * pargc, char *** pargv)
     ,{"elf-stt-common", required_argument, NULL, OPTION_ELF_STT_COMMON}
     ,{"sectname-subst", no_argument, NULL, OPTION_SECTNAME_SUBST}
     ,{"generate-missing-build-notes", required_argument, NULL, OPTION_ELF_BUILD_NOTES}
+    ,{"gctf-frame", no_argument, NULL, OPTION_CTF_FRAME}
 #endif
     ,{"fatal-warnings", no_argument, NULL, OPTION_WARN_FATAL}
     ,{"gdwarf-2", no_argument, NULL, OPTION_GDWARF_2}
@@ -987,6 +991,10 @@ This program has absolutely no warranty.\n"));
 		      optarg);
 	  break;
 
+	case OPTION_CTF_FRAME:
+	  flag_gen_ctf_frame = 1;
+	  break;
+
 #endif /* OBJ_ELF */
 
 	case 'Z':
diff --git a/gas/as.h b/gas/as.h
index ff665c75812..92e039b163a 100644
--- a/gas/as.h
+++ b/gas/as.h
@@ -337,6 +337,9 @@ COMMON int flag_execstack;
 /* TRUE if .note.GNU-stack section with SEC_CODE should be created */
 COMMON int flag_noexecstack;
 
+/* TRUE if .ctf_frame section should be created.  */
+COMMON int flag_gen_ctf_frame;
+
 /* name of emitted object file */
 COMMON const char *out_file_name;
 
diff --git a/gas/doc/as.texi b/gas/doc/as.texi
index 09b0ca5f565..c74b9eee3d6 100644
--- a/gas/doc/as.texi
+++ b/gas/doc/as.texi
@@ -245,6 +245,7 @@ gcc(1), ld(1), and the Info entries for @file{binutils} and @file{ld}.
  [@b{--sectname-subst}] [@b{--size-check=[error|warning]}]
  [@b{--elf-stt-common=[no|yes]}]
  [@b{--generate-missing-build-notes=[no|yes]}]
+ [@b{--gctf-frame}]
  [@b{--multibyte-handling=[allow|warn|warn-sym-only]}]
  [@b{--target-help}] [@var{target-options}]
  [@b{--}|@var{files} @dots{}]
@@ -825,6 +826,10 @@ attribute notes if none are present in the input sources.
 The default can be controlled by the @option{--enable-generate-build-notes}
 configure option.
 
+@item --gctf-frame
+@itemx --gctf-frame
+Create @var{.ctf_frame} section from CFI directives.
+
 @end ifset
 
 @item --help
-- 
2.37.1



More information about the Binutils mailing list