lld::COFF: better behavior when using as a library
authorRui Ueyama <ruiu@google.com>
Mon, 23 Oct 2017 20:03:32 +0000 (20:03 +0000)
committerRui Ueyama <ruiu@google.com>
Mon, 23 Oct 2017 20:03:32 +0000 (20:03 +0000)
commit6f4e255219f2a7878d3ac66d26313b9b8863e92f
treed615f65cdb9fa6c85863018cb11cfb7fac2d2c14
parent9ed81c66ce72abb343e154b201b95e3913e78c70
lld::COFF: better behavior when using as a library

Previously, the COFF driver would call exit(0) when called
as a library.  Now it takes `ExitEarly` option, and if it
is false, it doesn't exit.  So it is now more library-friendly.

Furthermore, link() calls freeArena() before returning, to
clean up resources.

Based on an Andrew Kelley's patch.

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

llvm-svn: 316370
lld/COFF/Config.h
lld/COFF/Driver.cpp
lld/COFF/Error.cpp
lld/COFF/Error.h
lld/MinGW/Driver.cpp
lld/include/lld/Common/Driver.h
lld/tools/lld/lld.cpp