[clang] [lld] [llvm] [RISCV] Support .note.gnu.property for enable Zicfiss and Zicfilp extension (PR #77414)
@@ -35,6 +35,8 @@ class RISCVTargetStreamer : public MCTargetStreamer { RISCVABI::ABI TargetABI = RISCVABI::ABI_Unknown; bool HasRVC = false; bool HasTSO = false; + bool HasZICFILP = false; jrtc27 wrote: Make the fields and methods all Zifoo https://github.com/llvm/llvm-project/pull/77414 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [lld] [llvm] [RISCV] Support .note.gnu.property for enable Zicfiss and Zicfilp extension (PR #77414)
@@ -118,6 +147,19 @@ void RISCVTargetELFStreamer::finish() { } MCA.setELFHeaderEFlags(EFlags); + + unsigned GNUNoteFlags = 0; + + // check ZICFILP or ZICFISS with features jrtc27 wrote: Not sure this adds anything, but if it's staying please properly style it (e.g. start with a capital letter) https://github.com/llvm/llvm-project/pull/77414 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [lld] [llvm] [RISCV] Support .note.gnu.property for enable Zicfiss and Zicfilp extension (PR #77414)
@@ -118,6 +147,19 @@ void RISCVTargetELFStreamer::finish() { } MCA.setELFHeaderEFlags(EFlags); + + unsigned GNUNoteFlags = 0; + + // check ZICFILP or ZICFISS with features + // TODO should we check with codegen enable ex. -mllvm jrtc27 wrote: This seems like it should be resolved before merging? https://github.com/llvm/llvm-project/pull/77414 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [lld] [llvm] [RISCV] Support .note.gnu.property for enable Zicfiss and Zicfilp extension (PR #77414)
@@ -5283,14 +5291,21 @@ static std::string getGNUProperty(uint32_t Type, uint32_t DataSize, OS << ""; return OS.str(); } + if (Type == GNU_PROPERTY_AARCH64_FEATURE_1_AND) { - DumpBit(GNU_PROPERTY_AARCH64_FEATURE_1_BTI, "BTI"); - DumpBit(GNU_PROPERTY_AARCH64_FEATURE_1_PAC, "PAC"); - DumpBit(GNU_PROPERTY_AARCH64_FEATURE_1_GCS, "GCS"); + if (Target == ELF::EM_RISCV) { +DumpBit(GNU_PROPERTY_RISCV_FEATURE_1_CFI_LP_SIMPLE, "ZICFILP"); +DumpBit(GNU_PROPERTY_RISCV_FEATURE_1_CFI_SS, "ZICFISS"); jrtc27 wrote: ```suggestion DumpBit(GNU_PROPERTY_RISCV_FEATURE_1_CFI_LP_SIMPLE, "Zicfilp"); DumpBit(GNU_PROPERTY_RISCV_FEATURE_1_CFI_SS, "Zicfiss"); ``` I assume the others are all-caps because that's what their canonical names are, not because that's desirable https://github.com/llvm/llvm-project/pull/77414 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [lld] [llvm] [RISCV] Support .note.gnu.property for enable Zicfiss and Zicfilp extension (PR #77414)
@@ -85,6 +85,35 @@ void RISCVTargetELFStreamer::finishAttributeSection() { ELF::SHT_RISCV_ATTRIBUTES, AttributeSection); } +void RISCVTargetELFStreamer::emitNoteSection(unsigned Flags) { jrtc27 wrote: I know this is what AArch64 calls it, but it's a very vague name that could cover any number of note sections. Can we do better and make ours specific to what it's actually doing, i.e. something about it being a GNU properties note? https://github.com/llvm/llvm-project/pull/77414 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [lld] [llvm] [RISCV] Support .note.gnu.property for enable Zicfiss and Zicfilp extension (PR #77414)
@@ -5272,8 +5272,16 @@ static std::string getGNUProperty(uint32_t Type, uint32_t DataSize, return OS.str(); case GNU_PROPERTY_AARCH64_FEATURE_1_AND: case GNU_PROPERTY_X86_FEATURE_1_AND: -OS << ((Type == GNU_PROPERTY_AARCH64_FEATURE_1_AND) ? "aarch64 feature: " -: "x86 feature: "); + jrtc27 wrote: ```suggestion ``` https://github.com/llvm/llvm-project/pull/77414 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [lld] [llvm] [RISCV] Support .note.gnu.property for enable Zicfiss and Zicfilp extension (PR #77414)
topperc wrote: > Unless `lld/test/ELF` tests will get a failure, the `lld/` part should > ideally be dropped from this PR. This separation is a convention. > > Otherwise (a) with just a `[RISCV]` tag and (b) with many RISCV-specific > changes, lld folks (like I) might not notice this patch. Are you saying that lld changes should be a different PR? https://github.com/llvm/llvm-project/pull/77414 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [lld] [llvm] [RISCV] Support .note.gnu.property for enable Zicfiss and Zicfilp extension (PR #77414)
@@ -0,0 +1,29 @@ +// When -march with zicfiss0p4 or zicfilp0p4 add GNU property to file object MaskRay wrote: This directory is for driver tests. Codegen tests should use `%clang_cc1` and be moved elsewhere (e.g. test/CodeGen) https://github.com/llvm/llvm-project/pull/77414 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [lld] [llvm] [RISCV] Support .note.gnu.property for enable Zicfiss and Zicfilp extension (PR #77414)
MaskRay wrote: Unless `lld/test/ELF` tests will get a failure, the `lld/` part should ideally be dropped from this PR. lld folks (like I) might not notice this patch if there is just a `[RISCV]` tag. https://github.com/llvm/llvm-project/pull/77414 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [lld] [llvm] [RISCV] Support .note.gnu.property for enable Zicfiss and Zicfilp extension (PR #77414)
@@ -468,6 +468,13 @@ static void checkOptions() { error("-z pauth-report only supported on AArch64"); } + if (config->emachine != EM_RISCV) { +if (config->zZicfilpReport != "none") + error("-z zicfilip-report only support on RISCV32/RISCV64"); topperc wrote: support -> supported RISCV32/RISCV64 -> RISC-V https://github.com/llvm/llvm-project/pull/77414 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [lld] [llvm] [RISCV] Support .note.gnu.property for enable Zicfiss and Zicfilp extension (PR #77414)
@@ -5272,8 +5272,16 @@ static std::string getGNUProperty(uint32_t Type, uint32_t DataSize, return OS.str(); case GNU_PROPERTY_AARCH64_FEATURE_1_AND: case GNU_PROPERTY_X86_FEATURE_1_AND: -OS << ((Type == GNU_PROPERTY_AARCH64_FEATURE_1_AND) ? "aarch64 feature: " -: "x86 feature: "); + +if (Type == GNU_PROPERTY_AARCH64_FEATURE_1_AND) { topperc wrote: Add a static_assert that GNU_PROPERTY_AARCH64_FEATURE_1_AND and GNU_PROPERTY_RISCV_FEATURE_1_AND have the same value. https://github.com/llvm/llvm-project/pull/77414 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [lld] [llvm] [RISCV] Support .note.gnu.property for enable Zicfiss and Zicfilp extension (PR #77414)
yetingk wrote: I am sorry that I missed the commit for a long time. Very sorry about it. https://github.com/llvm/llvm-project/pull/77414 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [lld] [llvm] [RISCV] Support .note.gnu.property for enable Zicfiss and Zicfilp extension (PR #77414)
@@ -188,6 +188,8 @@ struct Config { StringRef zBtiReport = "none"; StringRef zCetReport = "none"; StringRef zPauthReport = "none"; + llvm::StringRef zZicfilpReport = "none"; yetingk wrote: Use `StringRef` instead of `llvm::StringRef`. https://github.com/llvm/llvm-project/pull/77414 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [lld] [llvm] [RISCV] Support .note.gnu.property for enable Zicfiss and Zicfilp extension (PR #77414)
@@ -7884,10 +7902,11 @@ template void LLVMELFDumper::printNotes() { W.printString("Type", "Unknown (" + to_string(format_hex(Type, 10)) + ")"); +uint16_t Target = this->Obj.getHeader().e_machine; yetingk wrote: Move this definition into `if (Name == "Gnu") {` scope. https://github.com/llvm/llvm-project/pull/77414 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [lld] [llvm] [RISCV] Support .note.gnu.property for enable Zicfiss and Zicfilp extension (PR #77414)
@@ -7884,10 +7902,11 @@ template void LLVMELFDumper::printNotes() { W.printString("Type", "Unknown (" + to_string(format_hex(Type, 10)) + ")"); +uint16_t Target = this->Obj.getHeader().e_machine; yetingk wrote: Is it better to use `EMachine` for the naming? https://github.com/llvm/llvm-project/pull/77414 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [lld] [llvm] [RISCV] Support .note.gnu.property for enable Zicfiss and Zicfilp extension (PR #77414)
@@ -954,9 +954,18 @@ void readGnuProperty(const InputSection , ObjFile ) { continue; } -uint32_t featureAndType = config->emachine == EM_AARCH64 - ? GNU_PROPERTY_AARCH64_FEATURE_1_AND - : GNU_PROPERTY_X86_FEATURE_1_AND; +uint32_t featureAndType = 0; +switch (config->emachine) { +default: yetingk wrote: Is it better to add case `EM_CASE_X86` and set unreachable for default case? https://github.com/llvm/llvm-project/pull/77414 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [lld] [llvm] [RISCV] Support .note.gnu.property for enable Zicfiss and Zicfilp extension (PR #77414)
https://github.com/SuHo-llrr ready_for_review https://github.com/llvm/llvm-project/pull/77414 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [lld] [llvm] [RISCV] Support .note.gnu.property for enable Zicfiss and Zicfilp extension (PR #77414)
SuHo-llrr wrote: @yetingk I have updated to the latest version. If you have any suggestions, please let me know. https://github.com/llvm/llvm-project/pull/77414 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [lld] [llvm] [RISCV] Support .note.gnu.property for enable Zicfiss and Zicfilp extension (PR #77414)
https://github.com/SuHo-llrr updated https://github.com/llvm/llvm-project/pull/77414 >From 61aaf8df2fbd0abfa4dfcd807f3366ce67f5603d Mon Sep 17 00:00:00 2001 From: SuHsien Ho Date: Thu, 23 Nov 2023 14:36:43 +0800 Subject: [PATCH 1/5] [RISCV][ELF] Add RISCV GNU property label --- llvm/include/llvm/BinaryFormat/ELF.h | 7 +++ 1 file changed, 7 insertions(+) diff --git a/llvm/include/llvm/BinaryFormat/ELF.h b/llvm/include/llvm/BinaryFormat/ELF.h index f296acc2ca4bb..c8da286fc9588 100644 --- a/llvm/include/llvm/BinaryFormat/ELF.h +++ b/llvm/include/llvm/BinaryFormat/ELF.h @@ -1737,6 +1737,7 @@ enum : unsigned { GNU_PROPERTY_AARCH64_FEATURE_1_AND = 0xc000, GNU_PROPERTY_AARCH64_FEATURE_PAUTH = 0xc001, GNU_PROPERTY_X86_FEATURE_1_AND = 0xc002, + GNU_PROPERTY_RISCV_FEATURE_1_AND = 0xc000, GNU_PROPERTY_X86_UINT32_OR_LO = 0xc0008000, GNU_PROPERTY_X86_FEATURE_2_NEEDED = GNU_PROPERTY_X86_UINT32_OR_LO + 1, @@ -1796,6 +1797,12 @@ enum : unsigned { GNU_PROPERTY_X86_ISA_1_V4 = 1 << 3, }; +// riscv processor feature bits. +enum : unsigned { + GNU_PROPERTY_RISCV_FEATURE_1_CFI_LP_SIMPLE = 1 << 0, + GNU_PROPERTY_RISCV_FEATURE_1_CFI_SS = 1 << 1, +}; + // FreeBSD note types. enum { NT_FREEBSD_ABI_TAG = 1, >From 40b81f066e9a7c1789e4c0c1e92715a0569a77eb Mon Sep 17 00:00:00 2001 From: SuHsien Ho Date: Thu, 23 Nov 2023 14:38:34 +0800 Subject: [PATCH 2/5] [RISCV][ELF] Emit .gnu.note.property for Zicfiss/Zicfilip(CFI extension) --- .../RISCV/MCTargetDesc/RISCVELFStreamer.cpp | 42 +++ .../RISCV/MCTargetDesc/RISCVELFStreamer.h | 1 + .../MCTargetDesc/RISCVTargetStreamer.cpp | 2 + .../RISCV/MCTargetDesc/RISCVTargetStreamer.h | 4 ++ 4 files changed, 49 insertions(+) diff --git a/llvm/lib/Target/RISCV/MCTargetDesc/RISCVELFStreamer.cpp b/llvm/lib/Target/RISCV/MCTargetDesc/RISCVELFStreamer.cpp index ae7ce476fff22..7164a191bd41f 100644 --- a/llvm/lib/Target/RISCV/MCTargetDesc/RISCVELFStreamer.cpp +++ b/llvm/lib/Target/RISCV/MCTargetDesc/RISCVELFStreamer.cpp @@ -85,6 +85,35 @@ void RISCVTargetELFStreamer::finishAttributeSection() { ELF::SHT_RISCV_ATTRIBUTES, AttributeSection); } +void RISCVTargetELFStreamer::emitNoteSection(unsigned Flags) { + if (Flags == 0) +return; + + MCStreamer = getStreamer(); + MCContext = OutStreamer.getContext(); + MCSectionELF *Nt = Context.getELFSection(".note.gnu.property", ELF::SHT_NOTE, + ELF::SHF_ALLOC); + MCSection *Cur = OutStreamer.getCurrentSectionOnly(); + OutStreamer.switchSection(Nt); + + // Emit the note header. + OutStreamer.emitValueToAlignment(Align(8)); + OutStreamer.emitIntValue(4, 4); // data size for note name + OutStreamer.emitIntValue(4 * 4, 4); // data size + OutStreamer.emitIntValue(ELF::NT_GNU_PROPERTY_TYPE_0, 4); // note type + OutStreamer.emitBytes(StringRef("GNU", 4)); // note name + + // Emit the CFI(ZICFILP/ZICFISS) properties. + OutStreamer.emitIntValue(ELF::GNU_PROPERTY_RISCV_FEATURE_1_AND, + 4);// and property + OutStreamer.emitIntValue(4, 4); // data size + OutStreamer.emitIntValue(Flags, 4); // data + OutStreamer.emitIntValue(0, 4); // pad + + OutStreamer.endSection(Nt); + OutStreamer.switchSection(Cur); +} + void RISCVTargetELFStreamer::finish() { RISCVTargetStreamer::finish(); MCAssembler = getStreamer().getAssembler(); @@ -118,6 +147,19 @@ void RISCVTargetELFStreamer::finish() { } MCA.setELFHeaderEFlags(EFlags); + + unsigned GNUNoteFlags = 0; + + // check ZICFILP or ZICFISS with features + // TODO should we check with codegen enable ex. -mllvm + // -riscv-hardware-shadow-stack=true ? + if (hasZICFILP()) +GNUNoteFlags |= ELF::GNU_PROPERTY_RISCV_FEATURE_1_CFI_LP_SIMPLE; + + if (hasZICFISS()) +GNUNoteFlags |= ELF::GNU_PROPERTY_RISCV_FEATURE_1_CFI_SS; + + emitNoteSection(GNUNoteFlags); } void RISCVTargetELFStreamer::reset() { diff --git a/llvm/lib/Target/RISCV/MCTargetDesc/RISCVELFStreamer.h b/llvm/lib/Target/RISCV/MCTargetDesc/RISCVELFStreamer.h index 212d731889f1a..06ee170500c59 100644 --- a/llvm/lib/Target/RISCV/MCTargetDesc/RISCVELFStreamer.h +++ b/llvm/lib/Target/RISCV/MCTargetDesc/RISCVELFStreamer.h @@ -70,6 +70,7 @@ class RISCVTargetELFStreamer : public RISCVTargetStreamer { void emitDirectiveVariantCC(MCSymbol ) override; void finish() override; + void emitNoteSection(unsigned Flags); }; MCELFStreamer *createRISCVELFStreamer(MCContext , diff --git a/llvm/lib/Target/RISCV/MCTargetDesc/RISCVTargetStreamer.cpp b/llvm/lib/Target/RISCV/MCTargetDesc/RISCVTargetStreamer.cpp index 0f92e9ed6a64d..9f142b4d25463 100644 --- a/llvm/lib/Target/RISCV/MCTargetDesc/RISCVTargetStreamer.cpp +++ b/llvm/lib/Target/RISCV/MCTargetDesc/RISCVTargetStreamer.cpp @@ -52,6 +52,8 @@ void RISCVTargetStreamer::setFlagsFromFeatures(const MCSubtargetInfo ) { HasRVC = STI.hasFeature(RISCV::FeatureStdExtC)
[clang] [lld] [llvm] [RISCV] Support .note.gnu.property for enable Zicfiss and Zicfilp extension (PR #77414)
llvmbot wrote: @llvm/pr-subscribers-backend-risc-v Author: None (SuHo-llrr) Changes Emit Zicfiss/Zicfilp to .note.gnu.property sections 1. for spec v0.4.0 Zicifss/Zicfilp is AND feature means that all objects need to have this feature. 2. Emit note section when Zicifss/Zicfilp extension is enabled. 3. Checking all objects enable Zicifss/Zicfilp when linking. 4. Add -zforce-zicfilp/-zforce-zicfiss options to force emit Zicifss/Zicfilp flags on in .note.gnu.property Ref: https://github.com/riscv-non-isa/riscv-elf-psabi-doc/pull/417 --- Patch is 20.21 KiB, truncated to 20.00 KiB below, full version: https://github.com/llvm/llvm-project/pull/77414.diff 10 Files Affected: - (added) clang/test/Driver/riscv-cfi-property.c (+29) - (modified) lld/ELF/Config.h (+4) - (modified) lld/ELF/Driver.cpp (+40-2) - (modified) lld/ELF/InputFiles.cpp (+12-3) - (modified) lld/ELF/SyntheticSections.cpp (+12-3) - (added) lld/test/ELF/riscv-force-cfi-property.s (+35) - (modified) llvm/include/llvm/BinaryFormat/ELF.h (+7) - (modified) llvm/lib/Target/RISCV/MCTargetDesc/RISCVELFStreamer.cpp (+43) - (modified) llvm/lib/Target/RISCV/MCTargetDesc/RISCVELFStreamer.h (+1) - (modified) llvm/tools/llvm-readobj/ELFDumper.cpp (+34-15) ``diff diff --git a/clang/test/Driver/riscv-cfi-property.c b/clang/test/Driver/riscv-cfi-property.c new file mode 100644 index 00..7a4044c9328dc4 --- /dev/null +++ b/clang/test/Driver/riscv-cfi-property.c @@ -0,0 +1,29 @@ +// When -march with zicfiss0p4 or zicfilp0p4 add GNU property to file object + +// RUN: %clang --target=riscv32-linux-gnu -menable-experimental-extensions -march=rv32gc_zicfiss0p4 -c -o - %s | llvm-readobj -n - | FileCheck -check-prefix=CHECK -check-prefix=CHECK_ZICFISS %s +// RUN: %clang --target=riscv64-linux-gnu -menable-experimental-extensions -march=rv64gc_zicfiss0p4 -c -o - %s | llvm-readobj -n - | FileCheck -check-prefix=CHECK -check-prefix=CHECK_ZICFISS %s +// RUN: %clang --target=riscv32-linux-gnu -menable-experimental-extensions -march=rv32gc_zicfilp0p4 -c -o - %s | llvm-readobj -n - | FileCheck -check-prefix=CHECK -check-prefix=CHECK_ZICFILP %s +// RUN: %clang --target=riscv64-linux-gnu -menable-experimental-extensions -march=rv64gc_zicfilp0p4 -c -o - %s | llvm-readobj -n - | FileCheck -check-prefix=CHECK -check-prefix=CHECK_ZICFILP %s +// RUN: %clang --target=riscv32-linux-gnu -menable-experimental-extensions -march=rv32gc_zicfilp0p4_zicfiss0p4 -c -o - %s | llvm-readobj -n - | FileCheck -check-prefix=CHECK -check-prefix=CHECK_ZICFILP_ZICFISS %s +// RUN: %clang --target=riscv64-linux-gnu -menable-experimental-extensions -march=rv64gc_zicfilp0p4_zicfiss0p4 -c -o - %s | llvm-readobj -n - | FileCheck -check-prefix=CHECK -check-prefix=CHECK_ZICFILP_ZICFISS %s + + +// CHECK: Name: .note.gnu.property +// CHECK: Type: NT_GNU_PROPERTY_TYPE_0 +// CHECK: Property [ +// CHECK_ZICFISS: riscv feature: ZICFISS +// CHECK_ZICFILP: riscv feature: ZICFILP +// CHECK_ZICFILP_ZICFISS: riscv feature: ZICFILP, ZICFISS +// CHECK: ] + +// GNU Note Section Example +/*.section .note.gnu.property, "a"; +.balign 8; +.long 0x4; +.long 0x10; +.long 0x5 +.asciz "GNU" +.long 0xc000 +.long 4 +.long 3 +.long 0*/ diff --git a/lld/ELF/Config.h b/lld/ELF/Config.h index fcca8c42b29b71..552a5060452729 100644 --- a/lld/ELF/Config.h +++ b/lld/ELF/Config.h @@ -187,6 +187,8 @@ struct Config { llvm::StringRef cmseOutputLib; StringRef zBtiReport = "none"; StringRef zCetReport = "none"; + llvm::StringRef zZicfilpReport = "none"; + llvm::StringRef zZicfissReport = "none"; bool ltoBBAddrMap; llvm::StringRef ltoBasicBlockSections; std::pair thinLTOObjectSuffixReplace; @@ -324,6 +326,8 @@ struct Config { bool zText; bool zRetpolineplt; bool zWxneeded; + bool zForceZicfilp; + bool zForceZicfiss; DiscardPolicy discard; GnuStackKind zGnustack; ICFLevel icf; diff --git a/lld/ELF/Driver.cpp b/lld/ELF/Driver.cpp index 4bb9b7a0b2a983..1791d275a4d00c 100644 --- a/lld/ELF/Driver.cpp +++ b/lld/ELF/Driver.cpp @@ -463,6 +463,13 @@ static void checkOptions() { error("-z bti-report only supported on AArch64"); } + if (config->emachine != EM_RISCV) { +if (config->zZicfilpReport != "none") + error("-z zicfilip-report only support on RISCV32/RISCV64"); +if (config->zZicfissReport != "none") + error("-z zicfiss-report only support on RISCV32/RISCV64"); + } + if (config->emachine != EM_386 && config->emachine != EM_X86_64 && config->zCetReport != "none") error("-z cet-report only supported on X86 and X86_64"); @@ -1455,6 +1462,8 @@ static void readConfigs(opt::InputArgList ) { config->zWxneeded = hasZOption(args, "wxneeded"); setUnresolvedSymbolPolicy(args); config->power10Stubs = args.getLastArgValue(OPT_power10_stubs_eq) != "no"; + config->zForceZicfilp = hasZOption(args, "force-zicfilp"); + config->zForceZicfiss = hasZOption(args, "force-zicfiss"); if (opt::Arg *arg =
[clang] [lld] [llvm] [RISCV] Support .note.gnu.property for enable Zicfiss and Zicfilp extension (PR #77414)
https://github.com/kito-cheng edited https://github.com/llvm/llvm-project/pull/77414 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits