[llvm] [RISCV] Move the emitValueToAlignment before the header in emitNoteGnuPropertySection. (PR #151436)
via llvm-commits
llvm-commits at lists.llvm.org
Wed Jul 30 19:22:20 PDT 2025
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-backend-risc-v
Author: Craig Topper (topperc)
<details>
<summary>Changes</summary>
I assume the feature_1_and should appear immediately after the header so we should align the header to avoid a gap.
---
Full diff: https://github.com/llvm/llvm-project/pull/151436.diff
2 Files Affected:
- (modified) llvm/lib/Target/RISCV/MCTargetDesc/RISCVTargetStreamer.cpp (+1-1)
- (modified) llvm/test/CodeGen/RISCV/note-gnu-property-zicfiss.ll (+2-2)
``````````diff
diff --git a/llvm/lib/Target/RISCV/MCTargetDesc/RISCVTargetStreamer.cpp b/llvm/lib/Target/RISCV/MCTargetDesc/RISCVTargetStreamer.cpp
index 36558613d9172..6cb0d6843f965 100644
--- a/llvm/lib/Target/RISCV/MCTargetDesc/RISCVTargetStreamer.cpp
+++ b/llvm/lib/Target/RISCV/MCTargetDesc/RISCVTargetStreamer.cpp
@@ -83,6 +83,7 @@ void RISCVTargetStreamer::emitNoteGnuPropertySection(
OutStreamer.switchSection(NoteSection);
// Emit the note header
+ OutStreamer.emitValueToAlignment(NoteAlign);
OutStreamer.emitIntValue(4, 4); // n_namsz
MCSymbol *const NDescBeginSym = Ctx.createTempSymbol();
@@ -97,7 +98,6 @@ void RISCVTargetStreamer::emitNoteGnuPropertySection(
// Emit n_desc field
OutStreamer.emitLabel(NDescBeginSym);
- OutStreamer.emitValueToAlignment(NoteAlign);
// Emit the feature_1_and property
OutStreamer.emitIntValue(ELF::GNU_PROPERTY_RISCV_FEATURE_1_AND, 4); // pr_type
diff --git a/llvm/test/CodeGen/RISCV/note-gnu-property-zicfiss.ll b/llvm/test/CodeGen/RISCV/note-gnu-property-zicfiss.ll
index 24d63cbebc7af..ee31c762c1be1 100644
--- a/llvm/test/CodeGen/RISCV/note-gnu-property-zicfiss.ll
+++ b/llvm/test/CodeGen/RISCV/note-gnu-property-zicfiss.ll
@@ -7,13 +7,13 @@
; ASM: .section ".note.GNU-stack","", at progbits
; ASM-NEXT: .section .note.gnu.property,"a", at note
+; ASM32-NEXT: .p2align 2, 0x0
+; ASM64-NEXT: .p2align 3, 0x0
; ASM-NEXT: .word 4
; ASM-NEXT: .word .Ltmp1-.Ltmp0
; ASM-NEXT: .word 5
; ASM-NEXT: .asciz "GNU"
; ASM-NEXT: .Ltmp0:
-; ASM32-NEXT: .p2align 2, 0x0
-; ASM64-NEXT: .p2align 3, 0x0
; ASM-NEXT: .word 3221225472
; ASM-NEXT: .word 4
; ASM-NEXT: .word 2
``````````
</details>
https://github.com/llvm/llvm-project/pull/151436
More information about the llvm-commits
mailing list