createFiles(args) readDefsym readerLinkerScript(*mb) ... readMemory readMemoryAssignment("ORIGIN", "org", "o") // eagerly evaluated target = getTarget(); link(args) writeResult<ELFT>() ... finalizeSections() script->processSymbolAssignments() addSymbol(cmd) // with this patch, evaluated here
readMemoryAssignment eagerly evaluates ORIGIN/LENGTH and returns an uint64_t.
This patch postpones the evaluation to make
- --defsym and symbol assignments
- CONSTANT(COMMONPAGESIZE) (requires a non-null lld::elf::target)
work. If the expression somehow requires interaction with memory
regions, the circular dependency may cause the expression to evaluate to
a strange value. See the new test added to memory-err.s
clang-format: please reformat the code