[ELF] Extract temporary state used in assignAddresses()
authorPeter Smith <peter.smith@linaro.org>
Fri, 7 Jul 2017 09:11:27 +0000 (09:11 +0000)
committerPeter Smith <peter.smith@linaro.org>
Fri, 7 Jul 2017 09:11:27 +0000 (09:11 +0000)
commit906e9a18982a3f0d5074800799045d9d033c8e83
treefb4648946d682bdae32420f9a03781a1cfe16d6f
parent77367378ac391c816354107476e8491cad291760
[ELF] Extract temporary state used in assignAddresses()

The assignAddresses() function accumulates state in the LinkerScript that
prevents it from being called multiple times. This change moves the state
into a separate structure AddressState that is created at the start of the
function and disposed of at the end.

CurAddressState is used rather than passing a reference to the state as a
parameter to the functions used by assignAddresses(). This is because the
getSymbolValue function needs to be executed in the context of AddressState
but it is stored in ScriptParser when AddressState is not available.

The AddressState is also used in a limited context by processCommands()

Differential Revision: https://reviews.llvm.org/D34345

llvm-svn: 307367
lld/ELF/LinkerScript.cpp
lld/ELF/LinkerScript.h
lld/ELF/ScriptParser.cpp