[ELF] Move --print-map(-M)/--cref before checkSections() and openFile()
authorFangrui Song <maskray@google.com>
Tue, 10 Mar 2020 22:41:57 +0000 (15:41 -0700)
committerFangrui Song <maskray@google.com>
Thu, 12 Mar 2020 15:00:18 +0000 (08:00 -0700)
commiteb4b5a36a6331a0de3559a01e6854895cacce6b3
tree913c5be89e864750b184567009a46331452023cb
parent7c2b3c9dda37ab25a6849a3670f1bfda6aa17e5e
[ELF] Move --print-map(-M)/--cref before checkSections() and openFile()

-M output can be useful when diagnosing an "error: output file too large" problem (emitted in openFile()).

I just ran into such a situation where I had to debug an erronerous
Linux kernel linker script. It tried to create a file larger than
INT64_MAX bytes.

This patch could have helped https://bugs.llvm.org/show_bug.cgi?id=44715 as well.

Reviewed By: grimar

Differential Revision: https://reviews.llvm.org/D75966
lld/ELF/Writer.cpp
lld/test/ELF/linkerscript/output-too-large.s