[llvm] [Object] Beginnings of SFrame parser and dumper (PR #147294)

James Henderson via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 16 03:03:45 PDT 2025


================
@@ -17,42 +25,48 @@ FileHeader:
   Type:    ET_EXEC
   Machine: EM_X86_64
 Sections:
+  - Name:  .sframe_bad_sh_size
+    Type:  SHT_GNU_SFRAME
+    Flags: [ SHF_ALLOC ]
+    ShSize: 0xfffff
+# CASE1-LABEL:SFrame section '.sframe_bad_sh_size' {
+#       CASE1:{{.*}}: warning: '[[FILE]]': The end of the file was unexpectedly encountered
   - Name:  .sframe_1b
-    Type:  SHT_PROGBITS
+    Type:  SHT_GNU_SFRAME
     Flags: [ SHF_ALLOC ]
     ContentArray: [ 0x00 ]
 # CASE1-LABEL:SFrame section '.sframe_1b' {
-#       CASE1:{{.*}}: warning: {{.*}}: unexpected end of data at offset 0x1 while reading [0x0, 0x4)
+#       CASE1:{{.*}}: warning: '[[FILE]]': unexpected end of data at offset 0x1 while reading [0x0, 0x4)
 
   - Name:  .sframe_bad_magic
-    Type:  SHT_PROGBITS
+    Type:  SHT_GNU_SFRAME
     Flags: [ SHF_ALLOC ]
     ContentArray: [ 0xde, 0xad, 0xbe, 0xef]
 # CASE1-LABEL:SFrame section '.sframe_bad_magic' {
-#       CASE1:{{.*}}: warning: {{.*}}: invalid magic number
+#       CASE1:{{.*}}: warning: '[[FILE]]': invalid magic number
----------------
jh7370 wrote:

Looking at this in context, I wonder if it would be clearer if we said something like "section is not a valid sframe section: invalid magic number (0x1234)".

In particular, I've added the read-in magic number for context, but I think the extra words might also be clearer for those not familiar with the details of the format.

https://github.com/llvm/llvm-project/pull/147294


More information about the llvm-commits mailing list