[all-commits] [llvm/llvm-project] e4f385: [ELF] Support . and $ in symbol names in expressions
Fangrui Song via All-commits
all-commits at lists.llvm.org
Thu Mar 11 09:34:54 PST 2021
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: e4f385d89448393b4d213339bbbbbbaa42b49489
https://github.com/llvm/llvm-project/commit/e4f385d89448393b4d213339bbbbbbaa42b49489
Author: Fangrui Song <i at maskray.me>
Date: 2021-03-11 (Thu, 11 Mar 2021)
Changed paths:
M lld/ELF/ScriptParser.cpp
M lld/test/ELF/linkerscript/diag3.test
M lld/test/ELF/linkerscript/diag4.test
M lld/test/ELF/linkerscript/diag5.test
A lld/test/ELF/linkerscript/symbol-name.test
Log Message:
-----------
[ELF] Support . and $ in symbol names in expressions
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
More information about the All-commits
mailing list