[lld] [clang] [llvm] [SHT_LLVM_BB_ADDR_MAP] Allow basic-block-sections and labels be used together by decoupling the handling of the two features. (PR #74128)

Aiden Grossman via cfe-commits cfe-commits at lists.llvm.org
Fri Jan 26 01:06:27 PST 2024


================
@@ -73,68 +83,89 @@ FileHeader:
 Sections:
   - Name:    .text.foo
     Type:    SHT_PROGBITS
-    Address: [[FOO_ADDR]]
+    Address: 0x4000
     Flags:   [SHF_ALLOC, SHF_EXECINSTR]
-    Content: '503b0505200000907d02ebf5c3'
+    Content: '503b0505300000907d08ebf50f8dee1f0000c3'
   - Name:    .text.bar
     Type:    SHT_PROGBITS
-    Address: [[BAR_ADDR]]
+    Address: 0x5000
     Flags:   [SHF_ALLOC, SHF_EXECINSTR]
     Content: '5089d0740231f6e8f4ffffffc3'
+  - Name:    .text.split
+    Type:    SHT_PROGBITS
+    Address: 0x6000
+    Flags:   [SHF_ALLOC, SHF_EXECINSTR]
+    Content: 'c3'
   - Name:    .data
     Type:    SHT_PROGBITS
     Flags:   [SHF_ALLOC, SHF_WRITE]
-    Address: 0x6000
+    Address: 0x7000
   - Name:   .llvm_bb_addr_map.foo
     Type:   SHT_LLVM_BB_ADDR_MAP
     Link:   .text.foo
     Entries:
       - Version: 2
-        Address: [[FOO_ADDR]]
-        BBEntries:
-          - ID:            3
-            AddressOffset: 0x0
-            Size:          0x1
-            Metadata:      0x1
-          - ID:            1
-            AddressOffset: 0x0
-            Size:          0x6
-            Metadata:      0x0
-          - ID:            2
-            AddressOffset: 0x1
-            Size:          0x4
-            Metadata:      0x0
-          - ID:            5
-            AddressOffset: 0x0
-            Size:          0x1
-            Metadata:      0x2
+        Feature: 0x8
+        BBRanges:
+          - BaseAddress: 0x4000
+            BBEntries:
+             - ID:            3
+               AddressOffset: 0x0
----------------
boomanaiden154 wrote:

Why do all of these BBs except for one have an address offset of zero? The symbolization seems fine, but given the address offset is relative to the base address of the range, it seems like these should all map to the same object? Unless the code in `yaml2obj` automatically takes into account the size and the AddressOffset is additional?

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


More information about the cfe-commits mailing list