aboutsummaryrefslogtreecommitdiff
path: root/lldb
diff options
context:
space:
mode:
authorWeining Lu <luweining@loongson.cn>2023-03-13 15:44:56 +0800
committerTobias Hieta <tobias@hieta.se>2023-03-23 15:33:03 +0100
commit7d28293f17fab8a6307158ec36c27ee11b4b404e (patch)
tree3d972422442ee3d5dc7f852da712724b8ddd5180 /lldb
parent6d3b7679ef212fce3291af97eea625f252b4829b (diff)
downloadllvm-7d28293f17fab8a6307158ec36c27ee11b4b404e.zip
llvm-7d28293f17fab8a6307158ec36c27ee11b4b404e.tar.gz
llvm-7d28293f17fab8a6307158ec36c27ee11b4b404e.tar.bz2
[LLDB][ObjectFileELF] Correct the return type of RelocOffset64 and RelocAddend64
According to `/usr/include/elf.h` and `lldb/source/Plugins/ObjectFile/ELF/ELFHeader.h`. For ELF64 relocation, types of `offset` and `addend` should be `elf_addr` and `elf_sxword`. Reviewed By: DavidSpickett Differential Revision: https://reviews.llvm.org/D145550 (cherry picked from commit 174a38f9c3167573e060493b94135cf453d27879)
Diffstat (limited to 'lldb')
-rw-r--r--lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp8
-rw-r--r--lldb/test/Shell/ObjectFile/ELF/loongarch64-relocations.yaml12
2 files changed, 12 insertions, 8 deletions
diff --git a/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp b/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
index d91b350..6281cfa 100644
--- a/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
+++ b/lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
@@ -116,11 +116,11 @@ public:
static unsigned RelocOffset32(const ELFRelocation &rel);
- static unsigned RelocOffset64(const ELFRelocation &rel);
+ static elf_addr RelocOffset64(const ELFRelocation &rel);
static unsigned RelocAddend32(const ELFRelocation &rel);
- static unsigned RelocAddend64(const ELFRelocation &rel);
+ static elf_sxword RelocAddend64(const ELFRelocation &rel);
bool IsRela() { return (reloc.is<ELFRela *>()); }
@@ -192,7 +192,7 @@ unsigned ELFRelocation::RelocOffset32(const ELFRelocation &rel) {
return rel.reloc.get<ELFRela *>()->r_offset;
}
-unsigned ELFRelocation::RelocOffset64(const ELFRelocation &rel) {
+elf_addr ELFRelocation::RelocOffset64(const ELFRelocation &rel) {
if (rel.reloc.is<ELFRel *>())
return rel.reloc.get<ELFRel *>()->r_offset;
else
@@ -206,7 +206,7 @@ unsigned ELFRelocation::RelocAddend32(const ELFRelocation &rel) {
return rel.reloc.get<ELFRela *>()->r_addend;
}
-unsigned ELFRelocation::RelocAddend64(const ELFRelocation &rel) {
+elf_sxword ELFRelocation::RelocAddend64(const ELFRelocation &rel) {
if (rel.reloc.is<ELFRel *>())
return 0;
else
diff --git a/lldb/test/Shell/ObjectFile/ELF/loongarch64-relocations.yaml b/lldb/test/Shell/ObjectFile/ELF/loongarch64-relocations.yaml
index 1be6387..8fcc4d3 100644
--- a/lldb/test/Shell/ObjectFile/ELF/loongarch64-relocations.yaml
+++ b/lldb/test/Shell/ObjectFile/ELF/loongarch64-relocations.yaml
@@ -6,9 +6,9 @@
# CHECK: Name: .debug_info
# CHECK: Data: (
## Before relocation:
-## 0000: 00000000 00000000 00000000
+## 0000: 00000000 00000000 00000000 00000000 00000000
## After relocation:
-# CHECK-NEXT: 0000: 34120000 78560000 00000000
+# CHECK-NEXT: 0000: 34120000 88776655 44332211 8899AABB CCDDEEFF
# CHECK-NEXT: )
--- !ELF
@@ -22,7 +22,7 @@ Sections:
Type: SHT_PROGBITS
- Name: .debug_info
Type: SHT_PROGBITS
- Content: 000000000000000000000000
+ Content: 0000000000000000000000000000000000000000
- Name: .rela.debug_info
Type: SHT_RELA
Info: .debug_info
@@ -34,7 +34,11 @@ Sections:
- Offset: 0x0000000000000004
Symbol: .debug_str
Type: R_LARCH_64
- Addend: 0x5678
+ Addend: 0x1122334455667788
+ - Offset: 0x000000000000000C
+ Symbol: .debug_str
+ Type: R_LARCH_64
+ Addend: 0xFFEEDDCCBBAA9988
Symbols:
- Name: .debug_str
Type: STT_SECTION