[Lldb-commits] [lldb] d52582b - [LLDB][LoongArch] ObjectFile: add a case for `EM_LOONGARCH`

Weining Lu via lldb-commits lldb-commits at lists.llvm.org
Thu Jan 12 18:18:52 PST 2023


Author: Hui Li
Date: 2023-01-13T10:17:31+08:00
New Revision: d52582b6b7dfff5538008ad1ebb141da283d9206

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

LOG: [LLDB][LoongArch] ObjectFile: add a case for `EM_LOONGARCH`

This adds the jump slot mapping for LoongArch. This is a simple
change that ensures lldb running properly.

 Note that this problem was found only when CMake variables
 "DLLVM_ENABLE_ASSERTIONS=ON" is selected.

Without this patch,

```
$ build/bin/lldb  test

../ELFHeader::GetRelocationJumpSlotType() const: Assertion `false && "architecture not supported"' fail

```
With this patch

```
$ build/bin/lldb  test
(lldb) target create "test"
Current executable set to '../test' (loongarch64).

```

Reviewed By: SixWeining, DavidSpickett

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

Added: 
    

Modified: 
    lldb/source/Plugins/ObjectFile/ELF/ELFHeader.cpp

Removed: 
    


################################################################################
diff  --git a/lldb/source/Plugins/ObjectFile/ELF/ELFHeader.cpp b/lldb/source/Plugins/ObjectFile/ELF/ELFHeader.cpp
index abda0cd0e9a38..a6e385f70709b 100644
--- a/lldb/source/Plugins/ObjectFile/ELF/ELFHeader.cpp
+++ b/lldb/source/Plugins/ObjectFile/ELF/ELFHeader.cpp
@@ -211,6 +211,9 @@ unsigned ELFHeader::GetRelocationJumpSlotType() const {
   case EM_RISCV:
     slot = R_RISCV_JUMP_SLOT;
     break;
+  case EM_LOONGARCH:
+    slot = R_LARCH_JUMP_SLOT;
+    break;
   }
 
   return slot;


        


More information about the lldb-commits mailing list