[LLD][COFF] Generate map file even if no /out flag is present
authorPengxuan Zheng <pzheng@quicinc.com>
Fri, 23 Sep 2022 19:39:34 +0000 (12:39 -0700)
committerPengxuan Zheng <pzheng@quicinc.com>
Mon, 26 Sep 2022 16:05:23 +0000 (09:05 -0700)
commit961c45fd9f4e289d7d5e3d990c611d2bb7f2f1fb
tree3f51a4570479c9d3e153570e64588917c7bc3d2b
parent53c3664f674cc2f33c8214f493c2c17ce9b4d466
[LLD][COFF] Generate map file even if no /out flag is present

Currently LLD does not generate a map file if no /out flag (e.g., /out:a.exe) is
present. This is because LLD derives the map file's name from the default output
file name is no output file name is specified explicitly on the command
line. However, in this case, the default output file name has not been set by
LLD yet when LLD tries to set the name of the map file. This patch fixes this
corner case by moving the logic handling map file flags to a place after the
default output file name is set.

Reviewed By: thakis

Differential Revision: https://reviews.llvm.org/D134559
lld/COFF/Driver.cpp
lld/test/COFF/map.test