[llvm] d1057f9 - [VE] Support R_VE_RELATIVE

Kazushi Marukawa via llvm-commits llvm-commits at lists.llvm.org
Mon Dec 13 03:28:42 PST 2021


Author: Kazushi (Jam) Marukawa
Date: 2021-12-13T20:28:35+09:00
New Revision: d1057f9604713ca157e7d3a04dea4d5fc42313ed

URL: https://github.com/llvm/llvm-project/commit/d1057f9604713ca157e7d3a04dea4d5fc42313ed
DIFF: https://github.com/llvm/llvm-project/commit/d1057f9604713ca157e7d3a04dea4d5fc42313ed.diff

LOG: [VE] Support R_VE_RELATIVE

Change getELFRelativeRelocationType() to return R_VE_RELATIVE
as a preparation of lld for VE.

Reviewed By: simoll

Differential Revision: https://reviews.llvm.org/D115592

Added: 
    

Modified: 
    llvm/lib/Object/ELF.cpp
    llvm/unittests/Object/ELFTest.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Object/ELF.cpp b/llvm/lib/Object/ELF.cpp
index 84181ae5e501d..6e56da1a31f3e 100644
--- a/llvm/lib/Object/ELF.cpp
+++ b/llvm/lib/Object/ELF.cpp
@@ -210,6 +210,8 @@ uint32_t llvm::object::getELFRelativeRelocationType(uint32_t Machine) {
     return ELF::R_SPARC_RELATIVE;
   case ELF::EM_CSKY:
     return ELF::R_CKCORE_RELATIVE;
+  case ELF::EM_VE:
+    return ELF::R_VE_RELATIVE;
   case ELF::EM_AMDGPU:
     break;
   case ELF::EM_BPF:

diff  --git a/llvm/unittests/Object/ELFTest.cpp b/llvm/unittests/Object/ELFTest.cpp
index f85e866deeb5a..17868331890a4 100644
--- a/llvm/unittests/Object/ELFTest.cpp
+++ b/llvm/unittests/Object/ELFTest.cpp
@@ -53,7 +53,7 @@ TEST(ELFTest, getELFRelocationTypeNameForVE) {
 }
 
 TEST(ELFTest, getELFRelativeRelocationType) {
-  EXPECT_EQ(0U, getELFRelativeRelocationType(EM_VE));
+  EXPECT_EQ(ELF::R_VE_RELATIVE, getELFRelativeRelocationType(EM_VE));
 }
 
 // This is a test for the DataRegion helper struct, defined in ELF.h header.


        


More information about the llvm-commits mailing list