summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Object/ELFObjectFile.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/lib/Object/ELFObjectFile.cpp')
-rw-r--r--llvm/lib/Object/ELFObjectFile.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/llvm/lib/Object/ELFObjectFile.cpp b/llvm/lib/Object/ELFObjectFile.cpp
index 3c1bdf5a1de..e806c8f28b1 100644
--- a/llvm/lib/Object/ELFObjectFile.cpp
+++ b/llvm/lib/Object/ELFObjectFile.cpp
@@ -238,12 +238,25 @@ SubtargetFeatures ELFObjectFileBase::getARMFeatures() const {
return Features;
}
+SubtargetFeatures ELFObjectFileBase::getRISCVFeatures() const {
+ SubtargetFeatures Features;
+ unsigned PlatformFlags = getPlatformFlags();
+
+ if (PlatformFlags & ELF::EF_RISCV_RVC) {
+ Features.AddFeature("c");
+ }
+
+ return Features;
+}
+
SubtargetFeatures ELFObjectFileBase::getFeatures() const {
switch (getEMachine()) {
case ELF::EM_MIPS:
return getMIPSFeatures();
case ELF::EM_ARM:
return getARMFeatures();
+ case ELF::EM_RISCV:
+ return getRISCVFeatures();
default:
return SubtargetFeatures();
}
OpenPOWER on IntegriCloud