GNU ld supports `.` and `$` in symbol names while LLD doesn't support them in `readPrimary` expressions. Using `.` can result in such an error: ``` https://github.com/ClangBuiltLinux/linux/issues/1318 ld.lld: error: ./arch/powerpc/kernel/vmlinux.lds:255: malformed number: .TOC. >>> __toc_ptr = (DEFINED (.TOC.) ? .TOC. : ADDR (.got)) + 0x8000; ``` Allow `.` (ppc64 special symbol `.TOC.`) and `$` (RISC-V special symbol `__global_pointer$`). Change `diag[3-5].test` to use an invalid character `^`. Note: GNU ld allows `~` in non-leading positions of a symbol name. `~` is not used in practice, conflicts with the unary operator, and can cause some parsing difficulty, so this patch does not add it. Differential Revision: https://reviews.llvm.org/D98306
14 lines
390 B
Plaintext
14 lines
390 B
Plaintext
# REQUIRES: x86
|
|
# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux /dev/null -o %t.o
|
|
# RUN: not ld.lld -shared %t.o -o /dev/null --script %s 2>&1 | FileCheck -strict-whitespace %s
|
|
|
|
SECTIONS {
|
|
.text : { *(.text) }
|
|
.keep : { *(.keep) }
|
|
boom ^temp : { *(.temp) }
|
|
}
|
|
|
|
# CHECK: 8: malformed number: ^temp
|
|
# CHECK-NEXT: >>> boom ^temp : { *(.temp) }
|
|
# CHECK-NEXT: >>> ^
|