[ELF,test] Add test for -u error message referencing object file (#185938)

When -u creates an undefined symbol and a relocatable file has a weak
reference, the error message references the relocatable file, not
<internal>.
This commit is contained in:
Fangrui Song 2026-03-11 10:38:21 -07:00 committed by GitHub
parent 8fe4b04fc1
commit 3c171f4200
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -33,6 +33,12 @@
# CHECK-U: Section:
# CHECK-U-SAME: .text
## When the definition is not available, the error references the object file,
## not <internal>.
# RUN: not ld.lld -u foo %t1.o -o /dev/null 2>&1 | FileCheck %s --check-prefix=CHECK-UERR
# CHECK-UERR: error: undefined symbol: foo
# CHECK-UERR-NEXT: >>> referenced by {{.*}}1.o
.weak foo
call foo@PLT