aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Object/ELFObjectFile.cpp
diff options
context:
space:
mode:
authorCraig Topper <craig.topper@sifive.com>2024-02-07 08:23:57 -0800
committerGitHub <noreply@github.com>2024-02-07 08:23:57 -0800
commit8c37e3e64bb1432f771ec4d191837e6b3be5bf0c (patch)
treee28f1f4ac7c01372f92e00a5b95ad301238c7df4 /llvm/lib/Object/ELFObjectFile.cpp
parent934ba0d59e650644fe69462935982318b265ad2c (diff)
downloadllvm-8c37e3e64bb1432f771ec4d191837e6b3be5bf0c.zip
llvm-8c37e3e64bb1432f771ec4d191837e6b3be5bf0c.tar.gz
llvm-8c37e3e64bb1432f771ec4d191837e6b3be5bf0c.tar.bz2
[RISCV] Only set Zca flag for EF_RISCV_RVC in ELFObjectFileBase::getRISCVFeatures(). (#80928)
This code appears to be a hack to set the features to include compressed instructions if the ELF EFLAGS flags bit is present, but the ELF attribute for the ISA string is no present or not accurate. We can't remove the hack because llvm-mc doesn't create ELF attributes by default so a lot of tests fail to disassembler properly. Using clang as the assembler does set the attributes. This patch changes the hack to only set Zca since that is the minimum implied by the flag. Setting anything else potentially conflicts with the ISA string containing Zcmp or Zcmt. JITLink also needs to be updated to recognize Zca in addition to C.
Diffstat (limited to 'llvm/lib/Object/ELFObjectFile.cpp')
-rw-r--r--llvm/lib/Object/ELFObjectFile.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/llvm/lib/Object/ELFObjectFile.cpp b/llvm/lib/Object/ELFObjectFile.cpp
index 8f7eead..38a9e0e 100644
--- a/llvm/lib/Object/ELFObjectFile.cpp
+++ b/llvm/lib/Object/ELFObjectFile.cpp
@@ -292,7 +292,7 @@ Expected<SubtargetFeatures> ELFObjectFileBase::getRISCVFeatures() const {
unsigned PlatformFlags = getPlatformFlags();
if (PlatformFlags & ELF::EF_RISCV_RVC) {
- Features.AddFeature("c");
+ Features.AddFeature("zca");
}
RISCVAttributeParser Attributes;