]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
readelf/objdump: Display SFrame fixed RA offset as 'f' in dump
authorJens Remus <jremus@linux.ibm.com>
Thu, 4 Jul 2024 08:34:12 +0000 (10:34 +0200)
committerJens Remus <jremus@linux.ibm.com>
Thu, 4 Jul 2024 08:34:12 +0000 (10:34 +0200)
For the SFrame FRE frame-pointer (FP) offset from CFA a 'u' is displayed
if it is unavailable.

For the SFrame FRE return-address (RA) offset from CFA a 'u' was
displayed if the ABI uses a fixed RA offset from CFA. By chance a
'u' was also displayed if the RA offset is unavailable, as the string
buffer was not initialized after formatting the FP offset. Note that it
could not occur that the FP offset was erroneously displayed as RA
offset, as the SFrame format cannot have a FRE with FP offset without
RA offset.

For the FRE RA offset display 'f' if the ABI uses a fixed RA offset
from CFA. Display a 'u' if it is unavailable.

libsframe/
* sframe-dump.c: Display SFrame fixed RA offset as 'f' in dump.

gas/testsuite/
* gas/cfi-sframe/cfi-sframe-common-4.d: Test for RA displayed
either as 'u' (if RA tracking) or as 'f' (fixed RA offset if no
RA tracking).
* gas/cfi-sframe/cfi-sframe-common-5.d: Likewise.
* gas/cfi-sframe/cfi-sframe-common-6.d: Likewise.
* gas/cfi-sframe/cfi-sframe-common-7.d: Likewise.
* gas/cfi-sframe/cfi-sframe-common-8.d: Likewise.
* gas/cfi-sframe/cfi-sframe-x86_64-1.d: Test for RA displayed
as 'f' (fixed RA offset), as x86-64 does not use RA tracking.
* gas/scfi/x86_64/scfi-cfi-sections-1.d: Likewise.
* gas/scfi/x86_64/scfi-dyn-stack-1.d: Likewise.

ld/testsuite/
* ld-x86-64/sframe-plt-1.d: Test for RA displayed as 'f' (fixed
RA offset), as x86-64 does not use RA tracking.
* ld-x86-64/sframe-simple-1.d: Likewise.

Signed-off-by: Jens Remus <jremus@linux.ibm.com>
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-x86_64-1.d
gas/testsuite/gas/scfi/x86_64/scfi-cfi-sections-1.d
gas/testsuite/gas/scfi/x86_64/scfi-dyn-stack-1.d
ld/testsuite/ld-x86-64/sframe-plt-1.d
ld/testsuite/ld-x86-64/sframe-simple-1.d
libsframe/sframe-dump.c

index ca559bd0a029179ed20b50c8fd76041e0147ca4e..8632613f532f52cfd0bc657784d5648a9b910988 100644 (file)
@@ -17,7 +17,7 @@ Contents of the SFrame section .sframe:
     func idx \[0\]: pc = 0x0, size = 12 bytes
     STARTPC + CFA + FP + RA +
 #...
-    0+0004 +sp\+16 +u +u +
-    0+0008 +sp\+32 +u +u +
+    0+0004 +sp\+16 +u +[uf] +
+    0+0008 +sp\+32 +u +[uf] +
 
 #pass
index ee82053e13db9ab4f3d03135e6db6008e1b646c8..dd2c32d3d9fcc491ccb675cb52063123dbf293cf 100644 (file)
@@ -17,7 +17,7 @@ Contents of the SFrame section .sframe:
     func idx \[0\]: pc = 0x0, size = 12 bytes
     STARTPC + CFA + FP + RA +
 #...
-    0+0004 +sp\+16 +u +u +
-    0+0008 +sp\+24 +u +u +
+    0+0004 +sp\+16 +u +[uf] +
+    0+0008 +sp\+24 +u +[uf] +
 
 #pass
index 9d54b98552bfac4067d52f494caf645ca558ea64..34390c46a0743f8c2f9a710d9097ffb79c34097b 100644 (file)
@@ -17,7 +17,7 @@ Contents of the SFrame section .sframe:
     func idx \[0\]: pc = 0x0, size = 12 bytes
     STARTPC + CFA + FP + RA +
 #...
-    0+0004 +sp\+8 +u +u +
-    0+0008 +sp\+8 +u +u +
+    0+0004 +sp\+8 +u +[uf] +
+    0+0008 +sp\+8 +u +[uf] +
 
 #pass
index 2b7fe3aec8f49b1f3afeb4b3ae96a2c432e0ea98..61efb9c4ed129221486d35b2b69f74bf735b7717 100644 (file)
@@ -17,7 +17,7 @@ Contents of the SFrame section .sframe:
     func idx \[0\]: pc = 0x0, size = 12 bytes
     STARTPC + CFA + FP + RA +
 #...
-    0+0004 +sp\+8 +u +u +
-    0+0008 +sp\+8 +u +u +
+    0+0004 +sp\+8 +u +[uf] +
+    0+0008 +sp\+8 +u +[uf] +
 
 #pass
index d654e1d0bcd4b25e713c41bba65b18f51769126f..d77645636b36aee3382e2cfe42d7ff6a14ba6617 100644 (file)
@@ -17,6 +17,6 @@ Contents of the SFrame section .sframe:
     func idx \[0\]: pc = 0x0, size = 8 bytes
     STARTPC + CFA + FP + RA +
 #...
-    0+0004 +sp\+16 +u +u +
+    0+0004 +sp\+16 +u +[uf] +
 
 #pass
index c8b5e6adfea038ccdb532b724855b3740cf82c6e..88b4cc63dbaa00d39e17910ec2a6f36bc1b75127 100644 (file)
@@ -16,8 +16,8 @@ Contents of the SFrame section .sframe:
 
     func idx \[0\]: pc = 0x0, size = 25 bytes
     STARTPC +CFA +FP +RA +
-    0+0000 +sp\+8 +u +u +
-    0+0001 +sp\+16 +c\-16 +u +
-    0+0004 +fp\+16 +c\-16 +u +
-    0+0018 +sp\+8 +c\-16 +u +
+    0+0000 +sp\+8 +u +f +
+    0+0001 +sp\+16 +c\-16 +f +
+    0+0004 +fp\+16 +c\-16 +f +
+    0+0018 +sp\+8 +c\-16 +f +
 #pass
index c45933b72edc96a5bade25837fa0d96066e0d653..7c247e33a6e80a49858c7d518808b8e20d45ef13 100644 (file)
@@ -16,10 +16,10 @@ Contents of the SFrame section .sframe:
 
     func idx \[0\]: pc = 0x0, size = 12 bytes
     STARTPC + CFA + FP + RA +
-    0+0000 +sp\+8 +u +u +
-    0+0001 +sp\+16 +c\-16 +u +
-    0+0004 +fp\+16 +c-16 +u +
-    0+000a +sp\+16 +c\-16 +u +
-    0+000b +sp\+8 +u +u +
+    0+0000 +sp\+8 +u +f +
+    0+0001 +sp\+16 +c\-16 +f +
+    0+0004 +fp\+16 +c-16 +f +
+    0+000a +sp\+16 +c\-16 +f +
+    0+000b +sp\+8 +u +f +
 
 #pass
index 6cd0484d57934328390e23041bb39ed391362e73..c6a9b53f4e09f02f883f64f4167a9c28bc46d7a8 100644 (file)
@@ -16,10 +16,10 @@ Contents of the SFrame section .sframe:
   Function Index :
 
     func idx \[0\]: pc = 0x0, size = 87 bytes
-    STARTPC + CFA + FP + RA           
-    0+0000 + sp\+8 + u + u            
-    0+0001 + sp\+16 + c-16 + u            
-    0+0004 + fp\+16 + c-16 + u            
-    0+0056 + sp\+8 + u + u            
+    STARTPC + CFA + FP + RA +
+    0+0000 + sp\+8 + u + f +
+    0+0001 + sp\+16 + c-16 + f +
+    0+0004 + fp\+16 + c-16 + f +
+    0+0056 + sp\+8 + u + f +
 
 #pass
index 6aea5f424690b7f21d9b6384b63b8281ec375c40..52bca18d4c086d999236b65507dcf99a93877133 100644 (file)
@@ -19,12 +19,12 @@ Contents of the SFrame section .sframe:
 
     func idx \[0\]: pc = 0x1000, size = 16 bytes
     STARTPC +CFA +FP +RA +
-    0+1000 +sp\+16 +u +u +
-    0+1006 +sp\+24 +u +u +
+    0+1000 +sp\+16 +u +f +
+    0+1006 +sp\+24 +u +f +
 
     func idx \[1\]: pc = 0x1010, size = 16 bytes
     STARTPC\[m\] +CFA +FP +RA +
-    0+0000 +sp\+8 +u +u +
-    0+000b +sp\+16 +u +u +
+    0+0000 +sp\+8 +u +f +
+    0+000b +sp\+16 +u +f +
 
 #...
index 5ffd0ca78187fc5d98504fead90222d59e876aa2..7d88419226f10ba866289eae51823a0214dbbe65 100644 (file)
@@ -23,14 +23,14 @@ Contents of the SFrame section .sframe:
 
     func idx \[2\]: pc = 0x1020, size = 53 bytes
     STARTPC +CFA +FP +RA +
-    0+1020 +sp\+8 +u +u +
-    0+1021 +sp\+16 +c-16 +u +
-    0+1024 +fp\+16 +c-16 +u +
-    0+1054 +sp\+8 +c-16 +u +
+    0+1020 +sp\+8 +u +f +
+    0+1021 +sp\+16 +c-16 +f +
+    0+1024 +fp\+16 +c-16 +f +
+    0+1054 +sp\+8 +c-16 +f +
 
     func idx \[3\]: pc = 0x1055, size = 37 bytes
     STARTPC +CFA +FP +RA +
-    0+1055 +sp\+8 +u +u +
-    0+1056 +sp\+16 +c-16 +u +
-    0+1059 +fp\+16 +c-16 +u +
-    0+1079 +sp\+8 +c-16 +u +
+    0+1055 +sp\+8 +u +f +
+    0+1056 +sp\+16 +c-16 +f +
+    0+1059 +fp\+16 +c-16 +f +
+    0+1079 +sp\+8 +c-16 +f +
index 493d052ce91fe9dbf71914697b29b38514fef5ef..69633d53a33a859e607afe65873b6b7ceb4dd9cb 100644 (file)
@@ -181,13 +181,15 @@ dump_sframe_func_with_fres (sframe_decoder_ctx *sfd_ctx,
       printf ("%-10s", temp);
 
       /* Dump RA info.
-        If an ABI does not track RA offset, e.g., AMD64, display a 'u',
+        If an ABI does not track RA offset, e.g., AMD64, display 'f',
         else display the offset d as 'c+-d'.  */
-      if (sframe_decoder_get_fixed_ra_offset(sfd_ctx)
+      if (sframe_decoder_get_fixed_ra_offset (sfd_ctx)
          != SFRAME_CFA_FIXED_RA_INVALID)
-       strcpy (temp, "u");
+       strcpy (temp, "f");
       else if (err[2] == 0)
        sprintf (temp, "c%+d", ra_offset);
+      else
+       strcpy (temp, "u");
 
       /* Mark SFrame FRE's RA information with "[s]" if the RA is mangled
         with signature bits.  */