[all-commits] [llvm/llvm-project] 343428: MC: Detect cyclic dependency for variable symbols
Fangrui Song via All-commits
all-commits at lists.llvm.org
Mon May 26 15:08:34 PDT 2025
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: 343428c666f9293ae260bbcf79130562b830b268
https://github.com/llvm/llvm-project/commit/343428c666f9293ae260bbcf79130562b830b268
Author: Fangrui Song <i at maskray.me>
Date: 2025-05-26 (Mon, 26 May 2025)
Changed paths:
M llvm/include/llvm/MC/MCSymbol.h
M llvm/lib/MC/MCExpr.cpp
M llvm/lib/MC/MCParser/AsmParser.cpp
M llvm/test/MC/ARM/thumb_set-diagnostics.s
A llvm/test/MC/AsmParser/equate-cycle.s
M llvm/test/MC/AsmParser/variables-invalid.s
M llvm/test/MC/ELF/weakref.s
M llvm/test/MC/Mips/set-sym-recursive.s
Log Message:
-----------
MC: Detect cyclic dependency for variable symbols
We report cyclic dependency errors for variable symbols and rely on
isSymbolUsedInExpression in parseAssignmentExpression at parse time,
which does not catch all setVariableValue cases (e.g. cyclic .weakref).
Instead, add a bit to MCSymbol and check it when walking the variable
value MCExpr. When a cycle is detected when we have a final layout,
report an error and set the variable to a constant to avoid duplicate
errors.
isSymbolUsedInExpression is considered deprecated, but it is still used
by AMDGPU (#112251).
To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications
More information about the All-commits
mailing list