[llvm] [llvm-symbolizer] Make symbolizer parse section relative syntax (PR #168524)
Hubert Tong via llvm-commits
llvm-commits at lists.llvm.org
Tue Mar 3 07:40:01 PST 2026
================
@@ -0,0 +1,91 @@
+## Test section-relative address syntax for XCOFF.
+## The syntax (SECTION_TYPE)(+offset) represents: offset from section base.
+## Only TEXT and DATA section types are supported.
+
+# REQUIRES: system-aix
+
+## Create XCOFF object with TEXT section at address 0x100 and DATA at 0x200.
+# RUN: yaml2obj %s --docnum=1 -o %t.xcoff
+
+## Test 1: Symbolize function using TEXT section-relative offset.
+## foo is at 0x100 (TEXT base) + 0x0 offset.
+# RUN: llvm-symbolizer --obj=%t.xcoff '(TEXT)(+0x0)' | FileCheck %s --check-prefix=TEXT-FOO
+
+# TEXT-FOO: foo
+# TEXT-FOO-NEXT: ??:0:0
+
+## Test 2: Symbolize function at offset within TEXT section.
+## bar is at 0x100 (TEXT base) + 0x4 offset = 0x104.
+# RUN: llvm-symbolizer --obj=%t.xcoff '(TEXT)(+0x4)' | FileCheck %s --check-prefix=TEXT-BAR
+
+# TEXT-BAR: bar
+# TEXT-BAR-NEXT: ??:0:0
+
+## Test 3: Symbolize global variable using DATA section-relative offset.
----------------
hubert-reinterpretcast wrote:
Please also add a case for a global constant using a TEXT section-relative offset.
For example: `llvm-symbolizer "DATA %t.xcoff (TEXT)(+0x8)"`
https://github.com/llvm/llvm-project/pull/168524
More information about the llvm-commits
mailing list