[llvm-branch-commits] [llvm] IR: Introduce !elf_section_properties for setting section properties. (PR #149260)
Fangrui Song via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Fri Apr 17 10:13:09 PDT 2026
MaskRay wrote:
When two globals specify the same explicit section but with different sectin properties, what's the suggested behavior?
```
; entsize differs -> calcUniqueIDUpdateFlagsAndSize bumps the ID, two foo sections, fine
@a = global i32 1, section "foo", !elf_section_properties !{i32 1879002126, i32 4}
@b = global i32 2, section "foo", !elf_section_properties !{i32 1879002126, i32 8}
; implicit sections -> the new `if (hasMetadata(...)) EmitUniqueSection = true;`
; forces unique IDs, so these get .text.a / .text.b and never collide
define void @a() !elf_section_properties !{i32 1879002126, i32 4} { ret void }
define void @b() !elf_section_properties !{i32 5, i32 4} { ret void }
```
@efriedma-quic raised optimizer-interaction concerns that have been partly addressed (ConstantMerge was already safe, GlobalMerge was fixed in the follow-up #175875).
https://github.com/llvm/llvm-project/pull/149260
More information about the llvm-branch-commits
mailing list