[Lldb-commits] [PATCH] D145550: [LLDB][ObjectFileELF] Correct the return type of RelocOffset64 and RelocAddend64

Lu Weining via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Wed Mar 8 01:51:45 PST 2023


SixWeining updated this revision to Diff 503264.
SixWeining added a comment.

Address @DavidSpickett's comments.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D145550/new/

https://reviews.llvm.org/D145550

Files:
  lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
  lldb/test/Shell/ObjectFile/ELF/loongarch64-relocations.yaml


Index: lldb/test/Shell/ObjectFile/ELF/loongarch64-relocations.yaml
===================================================================
--- lldb/test/Shell/ObjectFile/ELF/loongarch64-relocations.yaml
+++ 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 @@
     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 @@
       - 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
Index: lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
===================================================================
--- lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
+++ lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
@@ -116,11 +116,11 @@
 
   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 @@
     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 @@
     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


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D145550.503264.patch
Type: text/x-patch
Size: 2705 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20230308/7eea41fa/attachment.bin>


More information about the lldb-commits mailing list