[lld] [LLD] Fix crash on parsing ':ALIGN' in linker script (PR #146723)
Peter Smith via llvm-commits
llvm-commits at lists.llvm.org
Wed Jul 2 09:54:43 PDT 2025
================
@@ -1229,6 +1229,9 @@ SymbolAssignment *ScriptParser::readSymbolAssignment(StringRef name) {
// This is an operator-precedence parser to parse a linker
// script expression.
Expr ScriptParser::readExpr() {
+ // Do not try to read expression if an error has already been encountered.
+ if (atEOF())
----------------
smithp35 wrote:
Looking at the CI this may have caused a problem with
FAIL: lld :: ELF/linkerscript/custom-section-type.s (1500 of 3105)
```
2025-07-02T15:45:44.9280956Z ld.lld: warning: section type mismatch for progbits
2025-07-02T15:45:44.9282076Z >>> /home/gha/actions-runner/_work/llvm-project/llvm-project/build/tools/lld/test/ELF/linkerscript/Output/custom-section-type.s.tmp/mismatch.o:(progbits): SHT_NOTE
2025-07-02T15:45:44.9283202Z >>> output section progbits: SHT_PROGBITS
2025-07-02T15:45:44.9283407Z
2025-07-02T15:45:44.9283520Z ld.lld: warning: section type mismatch for expr
2025-07-02T15:45:44.9284363Z >>> /home/gha/actions-runner/_work/llvm-project/llvm-project/build/tools/lld/test/ELF/linkerscript/Output/custom-section-type.s.tmp/mismatch.o:(expr): Unknown
2025-07-02T15:45:44.9285740Z >>> output section expr: Unknown
```
Assuming this is related to the patch. It may be that we've terminated too early before enough context for the error message can be accumulated. Which may mean that the check needs to be put closer to the point where an infinite loop may occur. Or we need a different approach.
https://github.com/llvm/llvm-project/pull/146723
More information about the llvm-commits
mailing list