[llvm] [Object] Handle SHT_CREL relocation sections when resolving relocation data (PR #141843)

David Blaikie via llvm-commits llvm-commits at lists.llvm.org
Tue Jun 3 09:56:10 PDT 2025


dwblaikie wrote:

> I found that [b3457d8](https://github.com/llvm/llvm-project/commit/b3457d823e5e08462f7bb73b9c667da542e76a45) is the easiest way I can think about to test it. Otherwise, I need to manually create the .debug_info, .debug_abbrev, .debug_str, .debug_str_offsets sections to create a meaningful test (when llvm-dwarfdump prints strings inside .debug_info with .debug_abbrev, it needs to access the string from crel relocation sections)

Have you looked at existing test files, that cover the functionality of relocation handling, and could be extended with a new RUN line to cover crel?

For instance, this seems to work:
```
diff --git a/llvm/test/tools/llvm-dwarfdump/X86/debug_info_addrx.s b/llvm/test/tools/llvm-dwarfdump/X86/debug_info_addrx.s
index ec1ad227bd56..51f61496d71f 100644
--- a/llvm/test/tools/llvm-dwarfdump/X86/debug_info_addrx.s
+++ b/llvm/test/tools/llvm-dwarfdump/X86/debug_info_addrx.s
@@ -1,6 +1,8 @@
 # RUN: llvm-mc %s -filetype obj -triple x86_64-pc-linux -o %t.o
 # RUN: llvm-dwarfdump -debug-info %t.o | FileCheck %s
 # RUN: llvm-dwarfdump -debug-info %t.o -v | FileCheck --check-prefix=VERBOSE %s
+# RUN: llvm-mc %s -filetype obj -triple x86_64-pc-linux -o %t.o -crel
+# RUN: llvm-dwarfdump -debug-info %t.o | FileCheck %s

 # CHECK: DW_TAG_compile_unit
 # CHECK:   DW_AT_low_pc                                              (0x0000000000000000)
 ```

https://github.com/llvm/llvm-project/pull/141843


More information about the llvm-commits mailing list