]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
[SFrame-V3] sframe: gas: bfd: ld: format bump to version 3
authorIndu Bhagat <indu.bhagat@oracle.com>
Fri, 24 Oct 2025 16:39:01 +0000 (09:39 -0700)
committerIndu Bhagat <indu.bhagat@oracle.com>
Tue, 9 Dec 2025 08:26:12 +0000 (00:26 -0800)
Bump version to SFRAME_VERSION_3.  Introduce a new definition of SFrame
FDE for version 3, which is a duplicate of SFrame FDE in V2, for now.
In other words, no changes to the format specification yet.

GNU as emits SFrame V3 by default.  SFrame encoder (ld) emits SFrame V3
sections.  In a later commit, we will add a new command line option to
gas: --gsframe-3 which will bind the implementation in gas to emit
SFrame V3.

Also, adjust the testcases for the new version string
"SFRAME_VERSION_3".

bfd/
        * elf-sframe.c (_bfd_elf_merge_section_sframe): Linker emits
the latest version by default.
* elf64-s390.c (_bfd_s390_elf_create_sframe_plt): Linker emitted
PLT sections are also SFRAME_VERSION_3.
        * elfxx-x86.c (_bfd_x86_elf_create_sframe_plt): Likewise.
gas/
        * gen-sframe.c (sframe_set_version): GAS emits SFrame V3 by
default.
        (output_sframe): Likewise.
include/ChangeLog:
        * sframe.h (SFRAME_VERSION_3): New definition.
        (SFRAME_VERSION): Current version is now SFRAME_VERSION_3.
        (SFRAME_V3_FUNC_INFO): New definition.
        (SFRAME_V3_FUNC_FRE_TYPE): Likewise.
        (SFRAME_V3_FUNC_FDE_TYPE): Likewise.
        (SFRAME_V3_FUNC_PAUTH_KEY): Likewise.
        (SFRAME_V3_FUNC_INFO_UPDATE_PAUTH_KEY): Likewise.
binutils/testsuite/
* all affected tests: Replace SFRAME_VERSION_2 with
SFRAME_VERSION_3.
gas/testsuite/
* all affected tests: Likewise.
ld/testsuite/
* all affected tests: Likewise.
libsframe/testsuite/
* all affected tests: Likewise.

64 files changed:
bfd/elf-sframe.c
bfd/elf64-s390.c
bfd/elfxx-x86.c
binutils/testsuite/binutils-all/x86-64/objdump-sframe-01.d
binutils/testsuite/binutils-all/x86-64/readelf-sframe-01.d
gas/gen-sframe.c
gas/testsuite/gas/cfi-sframe/cfi-sframe-aarch64-1.d
gas/testsuite/gas/cfi-sframe/cfi-sframe-aarch64-2.d
gas/testsuite/gas/cfi-sframe/cfi-sframe-aarch64-3.d
gas/testsuite/gas/cfi-sframe/cfi-sframe-aarch64-4.d
gas/testsuite/gas/cfi-sframe/cfi-sframe-aarch64-pac-ab-key-1.d
gas/testsuite/gas/cfi-sframe/cfi-sframe-aarch64-ra-undefined-1.d
gas/testsuite/gas/cfi-sframe/cfi-sframe-common-1.d
gas/testsuite/gas/cfi-sframe/cfi-sframe-common-10.d
gas/testsuite/gas/cfi-sframe/cfi-sframe-common-11.d
gas/testsuite/gas/cfi-sframe/cfi-sframe-common-12.d
gas/testsuite/gas/cfi-sframe/cfi-sframe-common-2.d
gas/testsuite/gas/cfi-sframe/cfi-sframe-common-3.d
gas/testsuite/gas/cfi-sframe/cfi-sframe-common-4.d
gas/testsuite/gas/cfi-sframe/cfi-sframe-common-5.d
gas/testsuite/gas/cfi-sframe/cfi-sframe-common-6.d
gas/testsuite/gas/cfi-sframe/cfi-sframe-common-7.d
gas/testsuite/gas/cfi-sframe/cfi-sframe-common-8.d
gas/testsuite/gas/cfi-sframe/cfi-sframe-common-9.d
gas/testsuite/gas/cfi-sframe/cfi-sframe-s390x-1.d
gas/testsuite/gas/cfi-sframe/cfi-sframe-s390x-2.d
gas/testsuite/gas/cfi-sframe/cfi-sframe-s390x-3.d
gas/testsuite/gas/cfi-sframe/cfi-sframe-s390x-err-1.d
gas/testsuite/gas/cfi-sframe/cfi-sframe-s390x-err-2.d
gas/testsuite/gas/cfi-sframe/cfi-sframe-s390x-err-3.d
gas/testsuite/gas/cfi-sframe/cfi-sframe-s390x-fpra-offset-1.d
gas/testsuite/gas/cfi-sframe/cfi-sframe-s390x-fpra-offset-2.d
gas/testsuite/gas/cfi-sframe/cfi-sframe-s390x-fpra-register-1.d
gas/testsuite/gas/cfi-sframe/cfi-sframe-s390x-fpra-register-2.d
gas/testsuite/gas/cfi-sframe/cfi-sframe-s390x-ra-undefined-1.d
gas/testsuite/gas/cfi-sframe/cfi-sframe-x86_64-1.d
gas/testsuite/gas/cfi-sframe/cfi-sframe-x86_64-2.d
gas/testsuite/gas/cfi-sframe/cfi-sframe-x86_64-3.d
gas/testsuite/gas/cfi-sframe/cfi-sframe-x86_64-empty-1.d
gas/testsuite/gas/cfi-sframe/cfi-sframe-x86_64-empty-2.d
gas/testsuite/gas/cfi-sframe/cfi-sframe-x86_64-empty-3.d
gas/testsuite/gas/cfi-sframe/cfi-sframe-x86_64-empty-4.d
gas/testsuite/gas/cfi-sframe/cfi-sframe-x86_64-empty-5.d
gas/testsuite/gas/cfi-sframe/cfi-sframe-x86_64-empty-pr33277.d
gas/testsuite/gas/cfi-sframe/cfi-sframe-x86_64-pr33170.d
gas/testsuite/gas/cfi-sframe/cfi-sframe-x86_64-ra-undefined-1.d
gas/testsuite/gas/cfi-sframe/common-empty-1.d
gas/testsuite/gas/cfi-sframe/common-empty-2.d
gas/testsuite/gas/cfi-sframe/common-empty-3.d
gas/testsuite/gas/scfi/x86_64/scfi-cfi-sections-1.d
gas/testsuite/gas/scfi/x86_64/scfi-dyn-stack-1.d
include/sframe.h
ld/testsuite/ld-aarch64/sframe-simple-1.d
ld/testsuite/ld-s390/sframe-plt-1.d
ld/testsuite/ld-s390/sframe-simple-1.d
ld/testsuite/ld-x86-64/sframe-ibt-plt-1.d
ld/testsuite/ld-x86-64/sframe-plt-1.d
ld/testsuite/ld-x86-64/sframe-pltgot-1.d
ld/testsuite/ld-x86-64/sframe-pltgot-2.d
ld/testsuite/ld-x86-64/sframe-reloc-1.d
ld/testsuite/ld-x86-64/sframe-simple-1.d
libsframe/sframe-dump.c
libsframe/sframe.c
libsframe/testsuite/libsframe.decode/DATA2

index 37ad0b5b6e8a51c2f1619e69d645c5265d138811..5c7941b3ea30e33076f0f7963ba544cc081b7fe6 100644 (file)
@@ -25,7 +25,7 @@
 #include "sframe-api.h"
 #include "sframe-internal.h"
 
-typedef sframe_func_desc_entry_v2 sframe_func_desc_entry;
+typedef sframe_func_desc_entry_v3 sframe_func_desc_entry;
 
 /* Return TRUE if the function has been marked for deletion during the linking
    process.  */
@@ -398,7 +398,7 @@ _bfd_elf_merge_section_sframe (bfd *abfd,
         SFRAME_V2_GNU_AS_LD_ENCODING_FLAGS, it is enforced that the provided
         input sections also have this flag set.  */
       tflags |= SFRAME_F_FDE_FUNC_START_PCREL;
-      htab->sfe_info.sfe_ctx = sframe_encode (SFRAME_VERSION_2,
+      htab->sfe_info.sfe_ctx = sframe_encode (SFRAME_VERSION_3,
                                              tflags, /* SFrame flags.  */
                                              sfd_ctx_abi_arch,
                                              sfd_ctx_fixed_fp_offset,
@@ -440,7 +440,7 @@ _bfd_elf_merge_section_sframe (bfd *abfd,
   /* Check that all .sframe sections being linked have the same version.  */
   dctx_version = sframe_decoder_get_version (sfd_ctx);
   ectx_version = sframe_encoder_get_version (sfe_ctx);
-  if (dctx_version != SFRAME_VERSION_2 || dctx_version != ectx_version)
+  if (dctx_version != SFRAME_VERSION_3 || dctx_version != ectx_version)
     {
       _bfd_error_handler
        (_("input SFrame sections with different format versions prevent"
index 440e60af5be57528c41762f1bcb1dcefc91df2f6..aaa2d327d7e25e82ac3fde8a72f6e9ad0c832f92 100644 (file)
@@ -1595,7 +1595,7 @@ _bfd_s390_elf_create_sframe_plt (struct bfd_link_info *info)
   num_pltn_fres = htab->sframe_plt->pltn_num_fres;
   num_pltn_entries = (dpltsec->size - plt0_entry_size) / plt_entry_size;
 
-  *ectx = sframe_encode (SFRAME_VERSION_2,
+  *ectx = sframe_encode (SFRAME_VERSION_3,
                         SFRAME_F_FDE_FUNC_START_PCREL,
                         SFRAME_ABI_S390X_ENDIAN_BIG,
                         SFRAME_CFA_FIXED_FP_INVALID,
index 4495b3eb00bd4e2c9afddbedf954559b7f7ad634..f0b021f15495dbda5bf7524ef10bcb5db142eb51 100644 (file)
@@ -1906,7 +1906,7 @@ _bfd_x86_elf_create_sframe_plt (bfd *output_bfd,
       break;
     }
 
-  *ectx = sframe_encode (SFRAME_VERSION_2,
+  *ectx = sframe_encode (SFRAME_VERSION_3,
                         SFRAME_F_FDE_FUNC_START_PCREL,
                         SFRAME_ABI_AMD64_ENDIAN_LITTLE,
                         SFRAME_CFA_FIXED_FP_INVALID,
index cca83cbf09b61b7cf52e85c4c39d89d46a6dae2e..5fb28b43b3440d0d681d0ca976273dfee9470f47 100644 (file)
@@ -10,7 +10,7 @@
 #...
   Header :
 
-    Version: SFRAME_VERSION_2
+    Version: SFRAME_VERSION_3
     Flags: SFRAME_F_FDE_FUNC_START_PCREL
     CFA fixed RA offset: -8
     Num FDEs: 1
index a6973d832a4fa66011008eccdac6007877778097..bcb8cc047431fa107f91b4b894abe7f32af67fcc 100644 (file)
@@ -10,7 +10,7 @@
 #...
   Header :
 
-    Version: SFRAME_VERSION_2
+    Version: SFRAME_VERSION_3
     Flags: SFRAME_F_FDE_FUNC_START_PCREL
     CFA fixed RA offset: -8
     Num FDEs: 1
index 3ac42d02be927119edb7a8af3cca8598d257daa1..46e5fa2c92adfa45e70f411ad1a88a8d14186fce 100644 (file)
@@ -54,8 +54,8 @@
 # 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;
+/* gas emits SFrame Version 3 only at this time.  */
+typedef sframe_func_desc_entry_v3 sframe_func_desc_entry;
 
 /* List of SFrame FDE entries.  */
 
@@ -310,10 +310,10 @@ sframe_v1_set_func_info (unsigned int fde_type, unsigned int fre_type,
 static void
 sframe_set_version (uint32_t sframe_version ATTRIBUTE_UNUSED)
 {
-  sframe_ver_ops.format_version = SFRAME_VERSION_2;
+  sframe_ver_ops.format_version = SFRAME_VERSION_3;
 
-  /* These operations remain the same for SFRAME_VERSION_2 as fre_info and
-     func_info have not changed from SFRAME_VERSION_1.  */
+  /* These operations remain the same for SFRAME_VERSION_3 as fre_info and
+     func_info have not changed from SFRAME_VERSION_2 and SFRAME_VERSION_1.  */
 
   sframe_ver_ops.set_fre_info = sframe_v1_set_fre_info;
 
@@ -2103,7 +2103,7 @@ output_sframe (segT sframe_seg)
   (void) sframe_seg;
 
   /* Setup the version specific access functions.  */
-  sframe_set_version (SFRAME_VERSION_2);
+  sframe_set_version (SFRAME_VERSION_3);
 
   /* Process all fdes and create SFrame stack trace information.  */
   create_sframe_all ();
index 830a652662850263e3d94d36dd48a4276d37ed8c..38fcdf86e370f5ea935ee302ce590f95bb302a7b 100644 (file)
@@ -5,7 +5,7 @@
 Contents of the SFrame section .sframe:
   Header :
 
-    Version: SFRAME_VERSION_2
+    Version: SFRAME_VERSION_3
     Flags: SFRAME_F_FDE_FUNC_START_PCREL
     Num FDEs: 1
     Num FREs: 3
index a6ee2ae7cdc95a14696c89ee3b9656cd794ba281..9d918c0d6010cbf85ec96bea286af305a5000b13 100644 (file)
@@ -6,7 +6,7 @@ Contents of the SFrame section .sframe:
 
   Header :
 
-    Version: SFRAME_VERSION_2
+    Version: SFRAME_VERSION_3
     Flags: SFRAME_F_FDE_FUNC_START_PCREL
     Num FDEs: 1
     Num FREs: 2
index c8ace34e375ef8241ba540d68e9e22685e4a170d..948fa0c60aba74d2fefe0cf152f0cea08e7712ba 100644 (file)
@@ -6,7 +6,7 @@ Contents of the SFrame section .sframe:
 
   Header :
 
-    Version: SFRAME_VERSION_2
+    Version: SFRAME_VERSION_3
     Flags: SFRAME_F_FDE_FUNC_START_PCREL
     Num FDEs: 1
     Num FREs: 2
index fc753799ac0acdfe13bd0a12097dde49ce1276cc..cf870147b74579751d09700442a00db4a803b789 100644 (file)
@@ -15,7 +15,7 @@ Contents of the SFrame section .sframe:
 
   Header :
 
-    Version: SFRAME_VERSION_2
+    Version: SFRAME_VERSION_3
     Flags: SFRAME_F_FDE_FUNC_START_PCREL
     Num FDEs: 0
     Num FREs: 0
index 4f14e390107a4dd5fe55caf433eddbca6880eeed..270ec89d3837bc742eb53563445d30423990bd3f 100644 (file)
@@ -6,7 +6,7 @@ Contents of the SFrame section .sframe:
 
   Header :
 
-    Version: SFRAME_VERSION_2
+    Version: SFRAME_VERSION_3
     Flags: SFRAME_F_FDE_FUNC_START_PCREL
     Num FDEs: 2
     Num FREs: 6
index f6bd6d71008bcba331b1c247385be7445c72ca3e..c8493fb544273f8c7f649bcbe914cd61b920124e 100644 (file)
@@ -5,7 +5,7 @@
 Contents of the SFrame section .sframe:
   Header :
 
-    Version: SFRAME_VERSION_2
+    Version: SFRAME_VERSION_3
     Flags: SFRAME_F_FDE_FUNC_START_PCREL
     Num FDEs: 1
     Num FREs: 4
index 9c341b49b4acc53ab34d42c681ed20c7933025ca..f6b4d348222d459ba37d34f3f7d26befa6cd226a 100644 (file)
@@ -6,7 +6,7 @@ Contents of the SFrame section .sframe:
 
   Header :
 
-    Version: SFRAME_VERSION_2
+    Version: SFRAME_VERSION_3
     Flags: SFRAME_F_FDE_FUNC_START_PCREL
 #?    CFA fixed FP offset: \-?\d+
 #?    CFA fixed RA offset: \-?\d+
index a91b1fe33363cda85480d64f4a7ddbbf2fbc1625..8cf9796b7f791523501bebce84ed00930ffb66c0 100644 (file)
@@ -6,7 +6,7 @@ Contents of the SFrame section .sframe:
 
   Header :
 
-    Version: SFRAME_VERSION_2
+    Version: SFRAME_VERSION_3
     Flags: SFRAME_F_FDE_FUNC_START_PCREL
 #?    CFA fixed FP offset: \-?\d+
 #?    CFA fixed RA offset: \-?\d+
index 2173ddbd4a23bbb782125aafea238c774d2230f7..b9a4fb066a3c8cc358c5825b41d75d1e4cc17366 100644 (file)
@@ -6,7 +6,7 @@ Contents of the SFrame section .sframe:
 
   Header :
 
-    Version: SFRAME_VERSION_2
+    Version: SFRAME_VERSION_3
     Flags: SFRAME_F_FDE_FUNC_START_PCREL
 #?    CFA fixed FP offset: \-?\d+
 #?    CFA fixed RA offset: \-?\d+
index c91ce7b10117519cec7716534ba2ad4d0542fbc1..f607a7106b941ea84b52b65c8b66c60457865580 100644 (file)
@@ -6,7 +6,7 @@ Contents of the SFrame section .sframe:
 
   Header :
 
-    Version: SFRAME_VERSION_2
+    Version: SFRAME_VERSION_3
     Flags: SFRAME_F_FDE_FUNC_START_PCREL
 #?    CFA fixed FP offset: \-?\d+
 #?    CFA fixed RA offset: \-?\d+
index 146b78918545f001ba77c90dbd5fbb59fef18cf5..87c21e2ef4bcfe44f657ac5da65c1665e1ed6771 100644 (file)
@@ -6,7 +6,7 @@ Contents of the SFrame section .sframe:
 
   Header :
 
-    Version: SFRAME_VERSION_2
+    Version: SFRAME_VERSION_3
     Flags: SFRAME_F_FDE_FUNC_START_PCREL
 #?    CFA fixed FP offset: \-?\d+
 #?    CFA fixed RA offset: \-?\d+
index 8c065f8c1c96e5227dd31174d75236352bfff7ac..40817e5385628c5862b7767cc6b81b3ca22c5fd4 100644 (file)
@@ -6,7 +6,7 @@ Contents of the SFrame section .sframe:
 
   Header :
 
-    Version: SFRAME_VERSION_2
+    Version: SFRAME_VERSION_3
     Flags: SFRAME_F_FDE_FUNC_START_PCREL
 #?    CFA fixed FP offset: \-?\d+
 #?    CFA fixed RA offset: \-?\d+
index 0aed15c0c7008d6306f032ade13c0d6d1b803127..fb22f46438890444b8ab0691975f62d28ab924af 100644 (file)
@@ -6,7 +6,7 @@ Contents of the SFrame section .sframe:
 
   Header :
 
-    Version: SFRAME_VERSION_2
+    Version: SFRAME_VERSION_3
     Flags: SFRAME_F_FDE_FUNC_START_PCREL
 #?    CFA fixed FP offset: \-?\d+
 #?    CFA fixed RA offset: \-?\d+
index d7cedb388ac85d7f746149799097d585a510a849..1c2937514127666cb9b7f7da14bae2a8b21b9f63 100644 (file)
@@ -6,7 +6,7 @@ Contents of the SFrame section .sframe:
 
   Header :
 
-    Version: SFRAME_VERSION_2
+    Version: SFRAME_VERSION_3
     Flags: SFRAME_F_FDE_FUNC_START_PCREL
 #?    CFA fixed FP offset: \-?\d+
 #?    CFA fixed RA offset: \-?\d+
index 41074c78a35452505661acebb085220485fe7df9..9d3276f1a06f5de6f0343aad9a7a6e74c46d61a8 100644 (file)
@@ -6,7 +6,7 @@ Contents of the SFrame section .sframe:
 
   Header :
 
-    Version: SFRAME_VERSION_2
+    Version: SFRAME_VERSION_3
     Flags: SFRAME_F_FDE_FUNC_START_PCREL
 #?    CFA fixed FP offset: \-?\d+
 #?    CFA fixed RA offset: \-?\d+
index e68a9a302c4accd95f3e4caad5e97f372df8de84..f82d21a40053d4c4dc0f5a70243ddff41cae49b9 100644 (file)
@@ -6,7 +6,7 @@ Contents of the SFrame section .sframe:
 
   Header :
 
-    Version: SFRAME_VERSION_2
+    Version: SFRAME_VERSION_3
     Flags: SFRAME_F_FDE_FUNC_START_PCREL
 #?    CFA fixed FP offset: \-?\d+
 #?    CFA fixed RA offset: \-?\d+
index 11a15bfc07c49125a920c52cf5780429c4a86b19..f82407b7c3de4e3b6bdc0a5d7a24ff0826fed1d3 100644 (file)
@@ -6,7 +6,7 @@ Contents of the SFrame section .sframe:
 
   Header :
 
-    Version: SFRAME_VERSION_2
+    Version: SFRAME_VERSION_3
     Flags: SFRAME_F_FDE_FUNC_START_PCREL
 #?    CFA fixed FP offset: \-?\d+
 #?    CFA fixed RA offset: \-?\d+
index ef588ea14969196c1e2af9765fa7ba8f966473ca..0bb883a9b2d17a05be48b067efa61f9578c9aa18 100644 (file)
@@ -6,7 +6,7 @@ Contents of the SFrame section .sframe:
 
   Header :
 
-    Version: SFRAME_VERSION_2
+    Version: SFRAME_VERSION_3
     Flags: SFRAME_F_FDE_FUNC_START_PCREL
 #?    CFA fixed FP offset: \-?\d+
 #?    CFA fixed RA offset: \-?\d+
index df315df23f2bd1e07ae5226bcd4992a0acddf546..0a27cd5a7c033f2ce38d52f675f180ea11cbea4e 100644 (file)
@@ -5,7 +5,7 @@ Contents of the SFrame section .sframe:
 
   Header :
 
-    Version: SFRAME_VERSION_2
+    Version: SFRAME_VERSION_3
     Flags: SFRAME_F_FDE_FUNC_START_PCREL
     Num FDEs: 1
     Num FREs: 6
index a772c2bd0557a65c96a80a896f607116b02f5601..7ab16531567035652db1832d8ed15bf5a64bc19a 100644 (file)
@@ -5,7 +5,7 @@ Contents of the SFrame section .sframe:
 
   Header :
 
-    Version: SFRAME_VERSION_2
+    Version: SFRAME_VERSION_3
     Flags: SFRAME_F_FDE_FUNC_START_PCREL
     Num FDEs: 1
     Num FREs: 6
index f775fe54ed7f1723b73f37462b8caf1e50d6ffa2..76fd2b4814fa194d8bb60a560468f64e21a29140 100644 (file)
@@ -6,7 +6,7 @@ Contents of the SFrame section .sframe:
 
   Header :
 
-    Version: SFRAME_VERSION_2
+    Version: SFRAME_VERSION_3
     Flags: SFRAME_F_FDE_FUNC_START_PCREL
     Num FDEs: 1
     Num FREs: 1
index 14f2382e145db2e35255f8c009bf9d2804132a92..5cd31c7da00cc141e7f4651ccdbec9c15f8eb8f6 100644 (file)
@@ -7,7 +7,7 @@ Contents of the SFrame section .sframe:
 
   Header :
 
-    Version: SFRAME_VERSION_2
+    Version: SFRAME_VERSION_3
     Flags: SFRAME_F_FDE_FUNC_START_PCREL
     Num FDEs: 0
     Num FREs: 0
index 0d3b47573c26e19b9ded7f7c6648f807ef872160..0397cd84c05d634158ae4000403d7a810d296dcd 100644 (file)
@@ -7,7 +7,7 @@ Contents of the SFrame section .sframe:
 
   Header :
 
-    Version: SFRAME_VERSION_2
+    Version: SFRAME_VERSION_3
     Flags: SFRAME_F_FDE_FUNC_START_PCREL
     Num FDEs: 0
     Num FREs: 0
index 519c235305941a76fa5ed1d3bf4808b9f6a4dbaf..7cdb764a7d4d5ec647358b0472e3e42de6428546 100644 (file)
@@ -7,7 +7,7 @@ Contents of the SFrame section .sframe:
 
   Header :
 
-    Version: SFRAME_VERSION_2
+    Version: SFRAME_VERSION_3
     Flags: SFRAME_F_FDE_FUNC_START_PCREL
     Num FDEs: 0
     Num FREs: 0
index e5eac75d3f28b148118c2ffaf9d1205cdf446a78..581f977fbc6253a3255a6ef9d573df4be873301d 100644 (file)
@@ -5,7 +5,7 @@ Contents of the SFrame section .sframe:
 
   Header :
 
-    Version: SFRAME_VERSION_2
+    Version: SFRAME_VERSION_3
     Flags: SFRAME_F_FDE_FUNC_START_PCREL
     Num FDEs: 1
     Num FREs: 5
index 305a917e325582089a43bf7deee6acf80cf66105..ca249eb4c17b3a15cb8cd87c70cfd279856f109b 100644 (file)
@@ -5,7 +5,7 @@ Contents of the SFrame section .sframe:
 
   Header :
 
-    Version: SFRAME_VERSION_2
+    Version: SFRAME_VERSION_3
     Flags: SFRAME_F_FDE_FUNC_START_PCREL
     Num FDEs: 1
     Num FREs: 5
index aa1b19511a96feb813c41fce329699eac13f77f0..c53b2477cdc77e4e182b565f3b6d9012279dd451 100644 (file)
@@ -5,7 +5,7 @@ Contents of the SFrame section .sframe:
 
   Header :
 
-    Version: SFRAME_VERSION_2
+    Version: SFRAME_VERSION_3
     Flags: SFRAME_F_FDE_FUNC_START_PCREL
     Num FDEs: 1
     Num FREs: 5
index 7b719fd979fbc369d45d3f883b9e2cd248d566d2..f781fb1dee97859de39bcb6108ebf938f5dbbe33 100644 (file)
@@ -5,7 +5,7 @@ Contents of the SFrame section .sframe:
 
   Header :
 
-    Version: SFRAME_VERSION_2
+    Version: SFRAME_VERSION_3
     Flags: SFRAME_F_FDE_FUNC_START_PCREL
     Num FDEs: 1
     Num FREs: 5
index dfd47e30bbe9caba9b39350efecbcb65a225ec63..aeef6969f21ef2e0be1b30c5df5e68d1e808b71a 100644 (file)
@@ -6,7 +6,7 @@ Contents of the SFrame section .sframe:
 
   Header :
 
-    Version: SFRAME_VERSION_2
+    Version: SFRAME_VERSION_3
     Flags: SFRAME_F_FDE_FUNC_START_PCREL
     Num FDEs: 1
     Num FREs: 4
index 7850db2c774a802e98a6d5d7b1ad7ba6cdddbd3a..f08354926019bdebbc4fc8e8a71ed164ae90ad61 100644 (file)
@@ -6,7 +6,7 @@ Contents of the SFrame section .sframe:
 
   Header :
 
-    Version: SFRAME_VERSION_2
+    Version: SFRAME_VERSION_3
     Flags: SFRAME_F_FDE_FUNC_START_PCREL
     CFA fixed RA offset: \-8
     Num FDEs: 1
index c3841aa0aebb2ac2f965e1da29cb2ac6175d2f92..233a43e1434ed1534996fe9015159c22ae01ce1a 100644 (file)
@@ -6,7 +6,7 @@ Contents of the SFrame section .sframe:
 
   Header :
 
-    Version: SFRAME_VERSION_2
+    Version: SFRAME_VERSION_3
     Flags: SFRAME_F_FDE_FUNC_START_PCREL
 #?    CFA fixed FP offset: \-?\d+
 #?    CFA fixed RA offset: \-?\d+
index 0e495159c01d33590572ff2c30619143301a7858..cd5c3e3a0a84926f3de2639989ca8631fbbd141c 100644 (file)
@@ -6,7 +6,7 @@ Contents of the SFrame section .sframe:
 
   Header :
 
-    Version: SFRAME_VERSION_2
+    Version: SFRAME_VERSION_3
     Flags: SFRAME_F_FDE_FUNC_START_PCREL
 #?    CFA fixed FP offset: \-?\d+
 #?    CFA fixed RA offset: \-?\d+
index a63231e6b87d60b0162ff59cf8913ffb5b8bc322..7e31bf530942c39099a2aab85d643a94cf38ab42 100644 (file)
@@ -7,7 +7,7 @@ Contents of the SFrame section .sframe:
 
   Header :
 
-    Version: SFRAME_VERSION_2
+    Version: SFRAME_VERSION_3
     Flags: SFRAME_F_FDE_FUNC_START_PCREL
 #?    CFA fixed FP offset: \-?\d+
 #?    CFA fixed RA offset: \-?\d+
index c3b4c4cea9fc6e7a29e7a2ea118a1e764a6126ce..c844a26a245f897776906efdf545efa92856a818 100644 (file)
@@ -7,7 +7,7 @@ Contents of the SFrame section .sframe:
 
   Header :
 
-    Version: SFRAME_VERSION_2
+    Version: SFRAME_VERSION_3
     Flags: SFRAME_F_FDE_FUNC_START_PCREL
 #?    CFA fixed FP offset: \-?\d+
 #?    CFA fixed RA offset: \-?\d+
index 29a6d0c75950d4d17199279d487005ec5841cda0..928c6b2d078fecf19ddacdbc299da6405ac4ae33 100644 (file)
@@ -7,7 +7,7 @@ Contents of the SFrame section .sframe:
 
   Header :
 
-    Version: SFRAME_VERSION_2
+    Version: SFRAME_VERSION_3
     Flags: SFRAME_F_FDE_FUNC_START_PCREL
 #?    CFA fixed FP offset: \-?\d+
 #?    CFA fixed RA offset: \-?\d+
index 1a718af943500f5977a058968cc0427f2f8c3c01..89972cf4c842fb028e955513b8e32b0c6959ec50 100644 (file)
@@ -7,7 +7,7 @@ Contents of the SFrame section .sframe:
 
   Header :
 
-    Version: SFRAME_VERSION_2
+    Version: SFRAME_VERSION_3
     Flags: SFRAME_F_FDE_FUNC_START_PCREL
 #?    CFA fixed FP offset: \-?\d+
 #?    CFA fixed RA offset: \-?\d+
index ce1fd3861cf5035145744cc17009f85d3d74a1c2..a086e6e1483771f2673e5e10f18c14be9c4e6eea 100644 (file)
@@ -7,7 +7,7 @@ Contents of the SFrame section .sframe:
 
   Header :
 
-    Version: SFRAME_VERSION_2
+    Version: SFRAME_VERSION_3
     Flags: SFRAME_F_FDE_FUNC_START_PCREL
 #?    CFA fixed FP offset: \-?\d+
 #?    CFA fixed RA offset: \-?\d+
index a04d84d7cc34d4b3b7d6d72172b79a034a3fafb1..a2d5b2cdf6c2e05ba9826253b355fd4bc3937139 100644 (file)
@@ -7,7 +7,7 @@ Contents of the SFrame section .sframe:
 
   Header :
 
-    Version: SFRAME_VERSION_2
+    Version: SFRAME_VERSION_3
     Flags: SFRAME_F_FDE_FUNC_START_PCREL
 #?    CFA fixed FP offset: \-?\d+
 #?    CFA fixed RA offset: \-?\d+
index 85c358fa30f0a137bf261e095e0428d6938f80d5..a11682c77677eb64bff7d7331e4523b484eb57e3 100644 (file)
@@ -5,7 +5,7 @@
 Contents of the SFrame section .sframe:
   Header :
 
-    Version: SFRAME_VERSION_2
+    Version: SFRAME_VERSION_3
     Flags: SFRAME_F_FDE_FUNC_START_PCREL
     CFA fixed RA offset: \-8
     Num FDEs: 1
index a635c3cd9cbf273afc0fd0c70ffbf4cb8b6bdc9f..3342495d94a4c7e5030f677a76cf596503e45ca7 100644 (file)
@@ -6,7 +6,7 @@ Contents of the SFrame section .sframe:
 
   Header :
 
-    Version: SFRAME_VERSION_2
+    Version: SFRAME_VERSION_3
     Flags: SFRAME_F_FDE_FUNC_START_PCREL
     CFA fixed RA offset: \-8
     Num FDEs: 1
index c64dd92e00348330de4ba34ffc690ad8d886e736..dc4cf51c682aa062658761bcb32a4417de882da4 100644 (file)
@@ -7,7 +7,7 @@ Contents of the SFrame section .sframe:
 
   Header :
 
-    Version: SFRAME_VERSION_2
+    Version: SFRAME_VERSION_3
     Flags: SFRAME_F_FDE_FUNC_START_PCREL
 #?    CFA fixed FP offset: \-?\d+
 #?    CFA fixed RA offset: \-?\d+
index 8174b32292083c76801ef4d11bcc0fba98f55376..c80ea50c75f90c94a877518645d6be04cf339de6 100644 (file)
@@ -7,7 +7,7 @@ Contents of the SFrame section .sframe:
 
   Header :
 
-    Version: SFRAME_VERSION_2
+    Version: SFRAME_VERSION_3
     Flags: SFRAME_F_FDE_FUNC_START_PCREL
 #?    CFA fixed FP offset: \-?\d+
 #?    CFA fixed RA offset: \-?\d+
index c01498852e83ad1daebfce9da3c0931f3cb32d5f..6b8b26e1f14db757f92704ed72afa04c4902797b 100644 (file)
@@ -7,7 +7,7 @@ Contents of the SFrame section .sframe:
 
   Header :
 
-    Version: SFRAME_VERSION_2
+    Version: SFRAME_VERSION_3
     Flags: SFRAME_F_FDE_FUNC_START_PCREL
 #?    CFA fixed FP offset: \-?\d+
 #?    CFA fixed RA offset: \-?\d+
index 52ff74c923af80a8fd416341c0ec711d29c00689..d99a779e358ac82c3b3a97d3b3f4e6d76ee9dd53 100644 (file)
@@ -6,7 +6,7 @@
 Contents of the SFrame section .sframe:
   Header :
 
-    Version: SFRAME_VERSION_2
+    Version: SFRAME_VERSION_3
     Flags: SFRAME_F_FDE_FUNC_START_PCREL
     CFA fixed RA offset: \-8
     Num FDEs: 1
index d4054201be6440808dad3465f0e851d6c05c0622..86cfe9ecf2e8ab4c43882e4770752264eb130261 100644 (file)
@@ -7,7 +7,7 @@
 Contents of the SFrame section .sframe:
   Header :
 
-    Version: SFRAME_VERSION_2
+    Version: SFRAME_VERSION_3
     Flags: SFRAME_F_FDE_FUNC_START_PCREL
     CFA fixed RA offset: \-8
     Num FDEs: 1
index d90440330cdeb6ec834112dfe9d159dfa17a9617..8d08aefcc0413b2a414cf2b1d129ca5932d8b5ef 100644 (file)
@@ -74,10 +74,11 @@ extern "C"
 /* SFrame format versions.  */
 #define SFRAME_VERSION_1       1
 #define SFRAME_VERSION_2       2
+#define SFRAME_VERSION_3        3
 /* SFrame magic number.  */
 #define SFRAME_MAGIC           0xdee2
 /* Current version of SFrame format.  */
-#define SFRAME_VERSION SFRAME_VERSION_2
+#define SFRAME_VERSION SFRAME_VERSION_3
 
 /* Various flags for SFrame.  */
 
@@ -239,6 +240,47 @@ typedef struct sframe_func_desc_entry_v2
 #define SFRAME_V2_FUNC_INFO_UPDATE_PAUTH_KEY(pauth_key, fde_info) \
   SFRAME_V1_FUNC_INFO_UPDATE_PAUTH_KEY (pauth_key, fde_info)
 
+typedef struct sframe_func_desc_entry_v3
+{
+  /* Function start address.  Encoded as a signed offset, relative to the
+     beginning of the current FDE.  */
+  int32_t sfde_func_start_address;
+  /* Size of the function in bytes.  */
+  uint32_t sfde_func_size;
+  /* Offset of the first SFrame Frame Row Entry of the function, relative to the
+     beginning of the SFrame Frame Row Entry sub-section.  */
+  uint32_t sfde_func_start_fre_off;
+  /* Number of frame row entries for the function.  */
+  uint32_t sfde_func_num_fres;
+  /* Additional information for stack tracing from the function:
+     - 4-bits: Identify the FRE type used for the function.
+     - 1-bit: Identify the FDE type of the function - mask or inc.
+     - 1-bit: PAC authorization A/B key (aarch64).
+     - 2-bits: Unused.
+     --------------------------------------------------------------------------
+     |     Unused    |  PAC auth A/B key (aarch64) |  FDE type |   FRE type   |
+     |               |     Unused (amd64, s390x)   |           |              |
+     --------------------------------------------------------------------------
+     8               6                             5           4              0     */
+  uint8_t sfde_func_info;
+  /* Size of the block of repeating insns.  Used for SFrame FDEs of type
+     SFRAME_FDE_TYPE_PCMASK.  */
+  uint8_t sfde_func_rep_size;
+  uint16_t sfde_func_padding2;
+} ATTRIBUTE_PACKED sframe_func_desc_entry_v3;
+
+/* SFrame V3 FDE.  TBD comment.  */
+
+#define SFRAME_V3_FUNC_INFO(fde_type, fre_enc_type) \
+  (SFRAME_V2_FUNC_INFO (fde_type, fre_enc_type))
+
+#define SFRAME_V3_FUNC_FRE_TYPE(data)    (SFRAME_V2_FUNC_FRE_TYPE (data))
+#define SFRAME_V3_FUNC_FDE_TYPE(data)    (SFRAME_V2_FUNC_FDE_TYPE (data))
+#define SFRAME_V3_FUNC_PAUTH_KEY(data)   (SFRAME_V2_FUNC_PAUTH_KEY (data))
+
+#define SFRAME_V3_FUNC_INFO_UPDATE_PAUTH_KEY(pauth_key, fde_info) \
+  SFRAME_V2_FUNC_INFO_UPDATE_PAUTH_KEY (pauth_key, fde_info)
+
 /* Size of stack frame offsets in an SFrame Frame Row Entry.  A single
    SFrame FRE has all offsets of the same size.  Offset size may vary
    across frame row entries.  */
index 1ae73de28281e6c34f720c8ee486b7a2a8a1cb3a..2b2fc0ef4ae2ab3073ed91c2f4399bea311feebc 100644 (file)
@@ -10,7 +10,7 @@
 Contents of the SFrame section .sframe:
   Header :
 
-    Version: SFRAME_VERSION_2
+    Version: SFRAME_VERSION_3
     Flags: SFRAME_F_FDE_SORTED,
            SFRAME_F_FDE_FUNC_START_PCREL
     Num FDEs: 2
index db09030cdc8dd71c19304dcd1aa352468eee4a39..beaeb2cc3cdac4656c79a84748cf7a4e67bfd1fb 100644 (file)
@@ -10,7 +10,7 @@
 Contents of the SFrame section .sframe:
   Header :
 
-    Version: SFRAME_VERSION_2
+    Version: SFRAME_VERSION_3
     Flags: SFRAME_F_FDE_SORTED,
            SFRAME_F_FDE_FUNC_START_PCREL
     Num FDEs: 4
index 1c1bf324690a950dece63a1ebcf907b8e36324ff..7a2f4c820518c4434160b1570b7ce189bdf33fce 100644 (file)
@@ -10,7 +10,7 @@
 Contents of the SFrame section .sframe:
   Header :
 
-    Version: SFRAME_VERSION_2
+    Version: SFRAME_VERSION_3
     Flags: SFRAME_F_FDE_SORTED,
            SFRAME_F_FDE_FUNC_START_PCREL
     Num FDEs: 4
index 45bf99a5e42fac99f626fc3c2568335541baccef..531ea135495cfdfd26e44c406ea7a66c412170bc 100644 (file)
@@ -9,7 +9,7 @@
 Contents of the SFrame section .sframe:
   Header :
 
-    Version: SFRAME_VERSION_2
+    Version: SFRAME_VERSION_3
     Flags: SFRAME_F_FDE_SORTED,
            SFRAME_F_FDE_FUNC_START_PCREL
     CFA fixed RA offset: \-8
index d23540ea907f7c31d4dec966f955ea8df7c99b25..7880c2b773f71d50dda084b8101c99c747a1d45c 100644 (file)
@@ -10,7 +10,7 @@
 Contents of the SFrame section .sframe:
   Header :
 
-    Version: SFRAME_VERSION_2
+    Version: SFRAME_VERSION_3
     Flags: SFRAME_F_FDE_SORTED,
            SFRAME_F_FDE_FUNC_START_PCREL
     CFA fixed RA offset: \-8
index e2255b0ca0bc8d56593e30ff1eaf0bbf30596381..f28512540203f6530d7be4e143591c6e3fcf8367 100644 (file)
@@ -9,7 +9,7 @@
 Contents of the SFrame section .sframe:
   Header :
 
-    Version: SFRAME_VERSION_2
+    Version: SFRAME_VERSION_3
     Flags: SFRAME_F_FDE_SORTED,
            SFRAME_F_FDE_FUNC_START_PCREL
     CFA fixed RA offset: \-8
index 52e712b4a822fdfe942f22438c3cfdd32b969b55..e8373ee5a1f0ecb3b231e6c675d3a5a049df2a32 100644 (file)
@@ -9,7 +9,7 @@
 Contents of the SFrame section .sframe:
   Header :
 
-    Version: SFRAME_VERSION_2
+    Version: SFRAME_VERSION_3
     Flags: SFRAME_F_FDE_SORTED,
            SFRAME_F_FDE_FUNC_START_PCREL
     CFA fixed RA offset: \-8
index 19725e8bf09c98757b435c9c671f9c830b5bf4fb..5e9c2fbf8d12e403784c6202f066c5227e1e1c23 100644 (file)
@@ -10,7 +10,7 @@
 Contents of the SFrame section .sframe:
   Header :
 
-    Version: SFRAME_VERSION_2
+    Version: SFRAME_VERSION_3
     Flags: SFRAME_F_FDE_SORTED,
            SFRAME_F_FDE_FUNC_START_PCREL
     CFA fixed RA offset: \-8
index bb4142ff560b78a2b375b10c5bcb8f26f96a41f6..981fc4815d5420c41574121e2e89ecd38924b6dc 100644 (file)
@@ -10,7 +10,7 @@
 Contents of the SFrame section .sframe:
   Header :
 
-    Version: SFRAME_VERSION_2
+    Version: SFRAME_VERSION_3
     Flags: SFRAME_F_FDE_SORTED,
            SFRAME_F_FDE_FUNC_START_PCREL
     CFA fixed RA offset: \-8
index 592b1298b9dd826be4da9a73b925ab68c86aae75..4837b456e3501d4a64b3850d0f3ee52885759a05 100644 (file)
@@ -90,7 +90,8 @@ dump_sframe_header (const sframe_decoder_ctx *sfd_ctx)
   const char *version_names[]
     = { "NULL",
        "SFRAME_VERSION_1",
-       "SFRAME_VERSION_2" };
+       "SFRAME_VERSION_2",
+       "SFRAME_VERSION_3" };
 
   ver = sframe_decoder_get_version (sfd_ctx);
   if (ver <= SFRAME_VERSION)
index 6c534796207ad442312647e9868e1ed50b6cb70e..44b04d090c809bce161b8c9f073c05147272e0a8 100644 (file)
@@ -141,14 +141,13 @@ static int
 sframe_fde_tbl_init (sf_fde_tbl *fde_tbl, const char *fde_buf,
                     size_t *fidx_size, unsigned int num_fdes, uint8_t ver)
 {
-  sframe_func_desc_entry_v2 *fdep = NULL;
-
-  if (ver == SFRAME_VERSION_2 && SFRAME_VERSION == SFRAME_VERSION_2)
+  if (ver == SFRAME_VERSION_3 && SFRAME_VERSION == SFRAME_VERSION_3)
     {
-      *fidx_size = num_fdes * sizeof (sframe_func_desc_entry_int);
+      *fidx_size = num_fdes * sizeof (sframe_func_desc_entry_v3);
       for (unsigned int i = 0; i < num_fdes; i++)
        {
-         fdep = (sframe_func_desc_entry_v2 *)fde_buf + i;
+         const sframe_func_desc_entry_v3 *fdep
+           = (sframe_func_desc_entry_v3 *)fde_buf + i;
          fde_tbl->entry[i].func_start_addr = fdep->sfde_func_start_address;
          fde_tbl->entry[i].func_size = fdep->sfde_func_size;
          fde_tbl->entry[i].func_start_fre_off = fdep->sfde_func_start_fre_off;
@@ -160,6 +159,22 @@ sframe_fde_tbl_init (sf_fde_tbl *fde_tbl, const char *fde_buf,
     }
   /* If ver is not the latest, read buffer manually and upgrade from
      sframe_func_desc_entry_v2 to populate the sf_fde_tbl entries.  */
+  else if (ver == SFRAME_VERSION_2 && SFRAME_VERSION == SFRAME_VERSION_3)
+    {
+      *fidx_size = num_fdes * sizeof (sframe_func_desc_entry_v2);
+      for (unsigned int i = 0; i < num_fdes; i++)
+       {
+         const sframe_func_desc_entry_v2 *fdep
+           = (sframe_func_desc_entry_v2 *)fde_buf + i;
+         fde_tbl->entry[i].func_start_addr = fdep->sfde_func_start_address;
+         fde_tbl->entry[i].func_size = fdep->sfde_func_size;
+         fde_tbl->entry[i].func_start_fre_off = fdep->sfde_func_start_fre_off;
+         fde_tbl->entry[i].func_num_fres = fdep->sfde_func_num_fres;
+         fde_tbl->entry[i].func_info = fdep->sfde_func_info;
+         fde_tbl->entry[i].func_rep_size = fdep->sfde_func_rep_size;
+       }
+      fde_tbl->count = num_fdes;
+    }
   else
     {
       /* Not possible ATM.  */
@@ -291,8 +306,17 @@ flip_header (char *buf, uint8_t ver ATTRIBUTE_UNUSED)
 static int
 flip_fde (char *buf, size_t buf_size, uint8_t ver, size_t *fde_size)
 {
+  if (ver == SFRAME_VERSION_3)
+    {
+      sframe_func_desc_entry_v3 *fdep = (sframe_func_desc_entry_v3 *) buf;
+      swap_thing (fdep->sfde_func_start_address);
+      swap_thing (fdep->sfde_func_size);
+      swap_thing (fdep->sfde_func_start_fre_off);
+      swap_thing (fdep->sfde_func_num_fres);
 
-  if (ver == SFRAME_VERSION_2)
+      *fde_size = sizeof (sframe_func_desc_entry_v3);
+    }
+  else if (ver == SFRAME_VERSION_2)
     {
       if (buf_size < sizeof (sframe_func_desc_entry_v2))
        return SFRAME_ERR;
@@ -319,7 +343,8 @@ sframe_header_sanity_check_p (const sframe_header *hp)
   /* Check preamble is valid.  */
   if (hp->sfh_preamble.sfp_magic != SFRAME_MAGIC
       || (hp->sfh_preamble.sfp_version != SFRAME_VERSION_1
-         && hp->sfh_preamble.sfp_version != SFRAME_VERSION_2)
+         && hp->sfh_preamble.sfp_version != SFRAME_VERSION_2
+         && hp->sfh_preamble.sfp_version != SFRAME_VERSION_3)
       || (hp->sfh_preamble.sfp_flags & ~SFRAME_V2_F_ALL_FLAGS))
     return false;
 
@@ -545,7 +570,19 @@ sframe_decode_fde (const char *buf, size_t buf_size, uint8_t ver,
                   uint32_t *num_fres, uint32_t *fre_type,
                   uint32_t *fre_offset, size_t *fde_size)
 {
-  if (ver == SFRAME_VERSION_2)
+  if (ver == SFRAME_VERSION_3)
+    {
+      if (buf_size < sizeof (sframe_func_desc_entry_v3))
+       return SFRAME_ERR;
+
+      sframe_func_desc_entry_v3 *fdep = (sframe_func_desc_entry_v3 *) buf;
+      *num_fres = fdep->sfde_func_num_fres;
+      *fre_type = SFRAME_V1_FUNC_FRE_TYPE (fdep->sfde_func_info);
+      *fre_offset = fdep->sfde_func_start_fre_off;
+
+      *fde_size = sizeof (sframe_func_desc_entry_v3);
+    }
+  else if (ver == SFRAME_VERSION_2)
     {
       if (buf_size < sizeof (sframe_func_desc_entry_v2))
        return SFRAME_ERR;
@@ -1295,9 +1332,18 @@ sframe_decoder_get_offsetof_fde_start_addr (const sframe_decoder_ctx *dctx,
   else if (errp)
     *errp = 0;
 
-  return (sframe_decoder_get_hdr_size (dctx)
-         + func_idx * sizeof (sframe_func_desc_entry_v2)
-         + offsetof (sframe_func_desc_entry_v2, sfde_func_start_address));
+  if (sframe_decoder_get_version (dctx) == SFRAME_VERSION_3)
+    return (sframe_decoder_get_hdr_size (dctx)
+           + func_idx * sizeof (sframe_func_desc_entry_v3)
+           + offsetof (sframe_func_desc_entry_v3, sfde_func_start_address));
+  else if (sframe_decoder_get_version (dctx) == SFRAME_VERSION_2)
+    return (sframe_decoder_get_hdr_size (dctx)
+           + func_idx * sizeof (sframe_func_desc_entry_v2)
+           + offsetof (sframe_func_desc_entry_v2, sfde_func_start_address));
+  else
+    sframe_ret_set_errno (errp, SFRAME_ERR_INVAL);
+
+  return 0;
 }
 
 /* Find the function descriptor entry starting which contains the specified
@@ -1700,8 +1746,8 @@ sframe_encoder_get_offsetof_fde_start_addr (sframe_encoder_ctx *ectx,
     *errp = 0;
 
   return (sframe_encoder_get_hdr_size (ectx)
-         + func_idx * sizeof (sframe_func_desc_entry_v2)
-         + offsetof (sframe_func_desc_entry_v2, sfde_func_start_address));
+         + func_idx * sizeof (sframe_func_desc_entry_v3)
+         + offsetof (sframe_func_desc_entry_v3, sfde_func_start_address));
 }
 
 /* Add an SFrame FRE to function at FUNC_IDX'th function descriptor entry in
@@ -2017,7 +2063,7 @@ sframe_encoder_write_fde (const sframe_header *sfhp ATTRIBUTE_UNUSED,
                          char *contents, sframe_func_desc_entry_int *fde,
                          size_t *fde_write_size)
 {
-  sframe_func_desc_entry_v2 *fdep = (sframe_func_desc_entry_v2 *)contents;
+  sframe_func_desc_entry_v3 *fdep = (sframe_func_desc_entry_v3 *)contents;
 
   fdep->sfde_func_start_address = (int32_t)fde->func_start_addr;
   fdep->sfde_func_size = fde->func_size;
@@ -2027,7 +2073,7 @@ sframe_encoder_write_fde (const sframe_header *sfhp ATTRIBUTE_UNUSED,
   fdep->sfde_func_rep_size = fde->func_rep_size;
   fdep->sfde_func_padding2 = 0;
 
-  *fde_write_size = sizeof (sframe_func_desc_entry_v2);
+  *fde_write_size = sizeof (sframe_func_desc_entry_v3);
 
   return 0;
 }
@@ -2059,7 +2105,7 @@ sframe_encoder_write_sframe (sframe_encoder_ctx *ectx)
   contents = ectx->sfe_data;
   buf_size = ectx->sfe_data_size;
   num_fdes = sframe_encoder_get_num_fidx (ectx);
-  all_fdes_size = num_fdes * sizeof (sframe_func_desc_entry_v2);
+  all_fdes_size = num_fdes * sizeof (sframe_func_desc_entry_v3);
   ehp = sframe_encoder_get_header (ectx);
   hdr_size = sframe_get_hdr_size (ehp);
 
@@ -2165,7 +2211,7 @@ sframe_encoder_write (sframe_encoder_ctx *ectx,
 
   ehp = sframe_encoder_get_header (ectx);
   hdrsize = sframe_get_hdr_size (ehp);
-  fsz = sframe_encoder_get_num_fidx (ectx) * sizeof (sframe_func_desc_entry_v2);
+  fsz = sframe_encoder_get_num_fidx (ectx) * sizeof (sframe_func_desc_entry_v3);
   fresz = ectx->sfe_fre_nbytes;
 
   /* Encoder writes out data in the latest SFrame format version.  */
index 90649e2716947e16bd51f42d8cb58ab75a69fd4f..aa62398b2ca115660338a00b76b4bcb351cedf3d 100644 (file)
Binary files a/libsframe/testsuite/libsframe.decode/DATA2 and b/libsframe/testsuite/libsframe.decode/DATA2 differ