[COFF] Support -gsplit-dwarf for COFF on Windows
authorHaohai Wen <haohai.wen@intel.com>
Sun, 25 Jun 2023 03:54:23 +0000 (11:54 +0800)
committerhh <whh108@live.com>
Sun, 25 Jun 2023 03:54:39 +0000 (11:54 +0800)
commit3eee5aa528abd67bb6d057e25ce1980d0d38c445
treef5ba71c45c4b9010c203bfb4b9cd130948d283c6
parentdf8d6d95ca64c70b3acc5a4266326966f3e6f93e
[COFF] Support -gsplit-dwarf for COFF on Windows

D152340 has split WinCOFFObjectWriter to WinCOFFWriter. This patch adds
another WinCOFFWriter as DwoWriter to write Dwo sections to dwo file.
Driver options are also updated accordingly to support -gsplit-dwarf in
CL mode.

e.g. $ clang-cl  -c -gdwarf -gsplit-dwarf foo.c

Like what -gsplit-dwarf did in ELF, using this option will create DWARF object
(.dwo) file. DWARF debug info is split between COFF object and DWARF object
file. It can reduce the executable file size especially for large project.

Reviewed By: skan, MaskRay

Differential Revision: https://reviews.llvm.org/D152785
clang/include/clang/Driver/Options.td
clang/lib/Driver/Driver.cpp
clang/lib/Driver/ToolChains/Clang.cpp
clang/lib/Driver/ToolChains/CommonArgs.cpp
clang/test/Driver/split-debug.c
llvm/include/llvm/MC/MCWinCOFFObjectWriter.h
llvm/lib/MC/MCAsmBackend.cpp
llvm/lib/MC/WinCOFFObjectWriter.cpp
llvm/test/DebugInfo/COFF/dwarf-headers.ll [new file with mode: 0644]
llvm/test/DebugInfo/COFF/fission-cu.ll [new file with mode: 0644]
llvm/test/DebugInfo/COFF/fission-sections.ll [new file with mode: 0644]