[ELF] Warn changed output section address
authorFangrui Song <maskray@google.com>
Mon, 17 Feb 2020 21:56:01 +0000 (13:56 -0800)
committerFangrui Song <maskray@google.com>
Fri, 21 Feb 2020 16:13:29 +0000 (08:13 -0800)
commitde0dda54d38137d0714c279a540074fe73822b8b
tree2cf5b5f611e20f1edb4b0f787c1abea1ae8b2f42
parent6ed8e2014330b6a48d238cdc4357e788cdd6d445
[ELF] Warn changed output section address

When the output section address (addrExpr) is specified, GNU ld warns if
sh_addr is different. This patch implements the warning.

Note, LinkerScript::assignAddresses can be called more than once. We
need to record the changed section addresses, and only report the
warnings after the addresses are finalized.

Reviewed By: grimar

Differential Revision: https://reviews.llvm.org/D74741
lld/ELF/LinkerScript.cpp
lld/ELF/LinkerScript.h
lld/ELF/Writer.cpp
lld/test/ELF/linkerscript/lma-align.test
lld/test/ELF/linkerscript/section-align2.test