[llvm] [RISCV] Improvements to .note.gnu.property section. (PR #151436)
Fangrui Song via llvm-commits
llvm-commits at lists.llvm.org
Thu Jul 31 09:27:55 PDT 2025
================
@@ -83,29 +86,21 @@ void RISCVTargetStreamer::emitNoteGnuPropertySection(
OutStreamer.switchSection(NoteSection);
// Emit the note header
- OutStreamer.emitIntValue(4, 4); // n_namsz
-
- MCSymbol *const NDescBeginSym = Ctx.createTempSymbol();
- MCSymbol *const NDescEndSym = Ctx.createTempSymbol();
- const MCExpr *const NDescSzExpr =
- MCBinaryExpr::createSub(MCSymbolRefExpr::create(NDescEndSym, Ctx),
- MCSymbolRefExpr::create(NDescBeginSym, Ctx), Ctx);
-
- OutStreamer.emitValue(NDescSzExpr, 4); // n_descsz
+ OutStreamer.emitValueToAlignment(NoteAlign);
----------------
MaskRay wrote:
Note sections should be 4- or 8-byte aligned https://groups.google.com/g/generic-abi/c/vT-_QVcckXo/m/Anr17KVUDgAJ
On Linux, NetBSD, Solaris, etc, many systems use 4-byte aligned notes https://reviews.llvm.org/D61296 . `.note.gnu.property`, as a newer section, uses 8-byte alignment in ELFCLASS64.
https://github.com/llvm/llvm-project/pull/151436
More information about the llvm-commits
mailing list