[04/13] include: gas: bfd: sframe: clean the abstraction

Message ID 20251202073414.200246-5-indu.bhagat@oracle.com
State New
Headers
Series sframe: some refactoring and misc improvements |

Commit Message

Indu Bhagat Dec. 2, 2025, 7:34 a.m. UTC
  ... between specification and implmentation.

Move to definition in the implementation (gas/ld/libsframe) and not the
specification (include/sframe.h).  At this time the implementation in
gas and ld generate the sections in the latest SFrame version only.

bfd/
        * elf-sframe.c: Add definition here.
gas/
        * gen-sframe.c: Likewise.
libsframe/
        * sframe.c: Likewise.
include/
        * sframe.h: Remove the definition.
---
 bfd/elf-sframe.c   | 2 ++
 gas/gen-sframe.c   | 3 +++
 include/sframe.h   | 2 --
 libsframe/sframe.c | 2 ++
 4 files changed, 7 insertions(+), 2 deletions(-)
  

Patch

diff --git a/bfd/elf-sframe.c b/bfd/elf-sframe.c
index 8e4cfdd73d3..37ad0b5b6e8 100644
--- a/bfd/elf-sframe.c
+++ b/bfd/elf-sframe.c
@@ -25,6 +25,8 @@ 
 #include "sframe-api.h"
 #include "sframe-internal.h"
 
+typedef sframe_func_desc_entry_v2 sframe_func_desc_entry;
+
 /* Return TRUE if the function has been marked for deletion during the linking
    process.  */
 
diff --git a/gas/gen-sframe.c b/gas/gen-sframe.c
index f39b4f495b4..a845c20a54e 100644
--- a/gas/gen-sframe.c
+++ b/gas/gen-sframe.c
@@ -54,6 +54,9 @@ 
 # define SFRAME_FRE_TYPE_SELECTION_OPT 1
 #endif
 
+/* gas emits SFrame Version 2 only at this time.  */
+typedef sframe_func_desc_entry_v2 sframe_func_desc_entry;
+
 /* List of SFrame FDE entries.  */
 
 static struct sframe_func_entry *all_sframe_fdes = NULL;
diff --git a/include/sframe.h b/include/sframe.h
index 44000413dce..d2a3c8390bf 100644
--- a/include/sframe.h
+++ b/include/sframe.h
@@ -212,8 +212,6 @@  typedef struct sframe_func_desc_entry_v2
   uint16_t sfde_func_padding2;
 } ATTRIBUTE_PACKED sframe_func_desc_entry_v2;
 
-typedef sframe_func_desc_entry_v2 sframe_func_desc_entry;
-
 /* Macros to compose and decompose function info in FDE.  */
 
 /* Note: Set PAC auth key to SFRAME_AARCH64_PAUTH_KEY_A by default.  */
diff --git a/libsframe/sframe.c b/libsframe/sframe.c
index 0dcc782b1f6..66810f93f35 100644
--- a/libsframe/sframe.c
+++ b/libsframe/sframe.c
@@ -26,6 +26,8 @@ 
 #include "sframe-impl.h"
 #include "swap.h"
 
+typedef sframe_func_desc_entry_v2 sframe_func_desc_entry;
+
 struct sf_fde_tbl
 {
   unsigned int count;