Skip to content

Commit 41ecb67

Browse files
committed
[LLD][COFF] Add ARM64EC support to findLineTable.
1 parent f546b6e commit 41ecb67

File tree

2 files changed

+59
-4
lines changed

2 files changed

+59
-4
lines changed

lld/COFF/PDB.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1735,6 +1735,8 @@ static uint32_t getSecrelReloc(llvm::COFF::MachineTypes machine) {
17351735
case ARMNT:
17361736
return COFF::IMAGE_REL_ARM_SECREL;
17371737
case ARM64:
1738+
case ARM64EC:
1739+
case ARM64X:
17381740
return COFF::IMAGE_REL_ARM64_SECREL;
17391741
default:
17401742
llvm_unreachable("unknown machine type");
@@ -1752,7 +1754,7 @@ static bool findLineTable(const SectionChunk *c, uint32_t addr,
17521754
DebugLinesSubsectionRef &lines,
17531755
uint32_t &offsetInLinetable) {
17541756
ExitOnError exitOnErr;
1755-
const uint32_t secrelReloc = getSecrelReloc(c->file->ctx.config.machine);
1757+
const uint32_t secrelReloc = getSecrelReloc(c->getMachine());
17561758

17571759
for (SectionChunk *dbgC : c->file->getDebugChunks()) {
17581760
if (dbgC->getSectionName() != ".debug$S")

lld/test/COFF/undefined-symbol-cv.s

Lines changed: 56 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,14 @@
1-
# REQUIRES: x86
2-
# RUN: llvm-mc -triple=x86_64-windows-msvc -filetype=obj -o %t.obj %s
3-
# RUN: not lld-link /out:%t.exe %t.obj 2>&1 | FileCheck %s
1+
# REQUIRES: aarch64, x86
2+
# RUN: split-file %s %t.dir && cd %t.dir
3+
4+
# RUN: llvm-mc -triple=x86_64-windows-msvc -filetype=obj -o test-x86_64.obj test-x86_64.s
5+
# RUN: llvm-mc -triple=aarch64-windows-msvc -filetype=obj -o test-aarch64.obj test-aarch64.s
6+
# RUN: llvm-mc -triple=arm64ec-windows-msvc -filetype=obj -o test-arm64ec.obj test-aarch64.s
7+
8+
# RUN: not lld-link -out:test-x86_64.exe test-x86_64.obj 2>&1 | FileCheck %s
9+
# RUN: not lld-link -out:test-aarch64.exe test-aarch64.obj 2>&1 | FileCheck %s
10+
# RUN: not lld-link -out:test-arm64ec.exe -machine:arm64ec test-arm64ec.obj 2>&1 | FileCheck %s
11+
# RUN: not lld-link -out:test-arm64ec2.exe -machine:arm64ec test-x86_64.obj 2>&1 | FileCheck %s
412

513
# CHECK: error: undefined symbol: int __cdecl foo(void)
614
# CHECK-NEXT: >>> referenced by file1.cpp:1
@@ -18,6 +26,7 @@
1826
# CHECK-NEXT: >>> referenced by file1.cpp:5
1927
# CHECK-NEXT: >>> {{.*}}.obj:(f2)
2028

29+
#--- test-x86_64.s
2130
.cv_file 1 "file1.cpp" "EDA15C78BB573E49E685D8549286F33C" 1
2231
.cv_file 2 "file2.cpp" "EDA15C78BB573E49E685D8549286F33D" 1
2332

@@ -60,3 +69,47 @@ f2:
6069
.long 4
6170
.cv_filechecksums
6271
.cv_stringtable
72+
73+
#--- test-aarch64.s
74+
.cv_file 1 "file1.cpp" "EDA15C78BB573E49E685D8549286F33C" 1
75+
.cv_file 2 "file2.cpp" "EDA15C78BB573E49E685D8549286F33D" 1
76+
77+
.section .text,"xr",one_only,main
78+
.globl main
79+
main:
80+
.cv_func_id 0
81+
.cv_loc 0 1 1 0 is_stmt 0
82+
bl "?foo@@YAHXZ"
83+
.cv_loc 0 1 2 0
84+
bl "?foo@@YAHXZ"
85+
.cv_loc 0 2 3 0
86+
b "?bar@@YAHXZ"
87+
.Lfunc_end0:
88+
89+
f1:
90+
.cv_func_id 1
91+
.cv_loc 1 1 4 0 is_stmt 0
92+
bl "?bar@@YAHXZ"
93+
.Lfunc_end1:
94+
95+
.section .text,"xr",one_only,f2
96+
.globl f2
97+
f2:
98+
.cv_func_id 2
99+
.cv_loc 2 1 5 0 is_stmt 0
100+
bl "?baz@@YAHXZ"
101+
.Lfunc_end2:
102+
103+
.section .debug$S,"dr",associative,main
104+
.long 4
105+
.cv_linetable 0, main, .Lfunc_end0
106+
.cv_linetable 1, f1, .Lfunc_end1
107+
108+
.section .debug$S,"dr",associative,f2
109+
.long 4
110+
.cv_linetable 2, f2, .Lfunc_end2
111+
112+
.section .debug$S,"dr"
113+
.long 4
114+
.cv_filechecksums
115+
.cv_stringtable

0 commit comments

Comments
 (0)