Page MenuHomePhabricator

lld::COFF: better behavior when using as a library
ClosedPublic

Authored by ruiu on Oct 23 2017, 12:43 PM.

Details

Summary

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.

Diff Detail

Repository
rL LLVM

Event Timeline

ruiu created this revision.Oct 23 2017, 12:43 PM
andrewrk accepted this revision.Oct 23 2017, 12:53 PM
andrewrk awarded a token.
andrewrk added a subscriber: andrewrk.
andrewrk added inline comments.
lld/COFF/Driver.cpp
64 ↗(On Diff #119921)

is this necessary?

This revision is now accepted and ready to land.Oct 23 2017, 12:54 PM
ruiu added inline comments.Oct 23 2017, 1:01 PM
lld/COFF/Driver.cpp
64 ↗(On Diff #119921)

Yes, because we use it in Errors.cpp.

This revision was automatically updated to reflect the committed changes.