[llvm] [RISCV] Emit .note.gnu.property section when Zicfiss-based shadow stack is enabled (PR #127036)
Fangrui Song via llvm-commits
llvm-commits at lists.llvm.org
Sun Feb 23 09:21:11 PST 2025
================
@@ -51,6 +58,67 @@ void RISCVTargetStreamer::emitTextAttribute(unsigned Attribute,
void RISCVTargetStreamer::emitIntTextAttribute(unsigned Attribute,
unsigned IntValue,
StringRef StringValue) {}
+
+void RISCVTargetStreamer::emitNoteGnuPropertySection(
+ const uint32_t Feature1And) {
+ MCStreamer &OutStreamer = getStreamer();
+ MCContext &Ctx = OutStreamer.getContext();
+
+ const Triple &Triple = Ctx.getTargetTriple();
+ Align NoteAlign;
+ if (Triple.isArch64Bit())
+ NoteAlign = Align(8);
+ else if (Triple.isArch32Bit())
+ NoteAlign = Align(4);
+ else
+ report_fatal_error("unsupported arch bit width");
+
+ MCSection *NoteSection;
+ switch (Ctx.getObjectFileType()) {
+ case MCContext::Environment::IsELF:
+ NoteSection =
+ Ctx.getELFSection(".note.gnu.property", ELF::SHT_NOTE, ELF::SHF_ALLOC);
+ break;
+ case MCContext::Environment::IsMachO:
----------------
MaskRay wrote:
non elf object files are unreachable. delete
https://github.com/llvm/llvm-project/pull/127036
More information about the llvm-commits
mailing list