summaryrefslogtreecommitdiff
path: root/lib/Object/ELFObjectFile.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Object/ELFObjectFile.cpp')
-rw-r--r--lib/Object/ELFObjectFile.cpp16
1 files changed, 14 insertions, 2 deletions
diff --git a/lib/Object/ELFObjectFile.cpp b/lib/Object/ELFObjectFile.cpp
index 0aad1c89a2d8..e806c8f28b15 100644
--- a/lib/Object/ELFObjectFile.cpp
+++ b/lib/Object/ELFObjectFile.cpp
@@ -76,8 +76,7 @@ ObjectFile::createELFObjectFile(MemoryBufferRef Obj) {
SubtargetFeatures ELFObjectFileBase::getMIPSFeatures() const {
SubtargetFeatures Features;
- unsigned PlatformFlags;
- getPlatformFlags(PlatformFlags);
+ unsigned PlatformFlags = getPlatformFlags();
switch (PlatformFlags & ELF::EF_MIPS_ARCH) {
case ELF::EF_MIPS_ARCH_1:
@@ -239,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();
}