Make the linker more robust to errors
authorSimon Marlow <marlowsd@gmail.com>
Wed, 1 Oct 2014 12:15:05 +0000 (13:15 +0100)
committerSimon Marlow <marlowsd@gmail.com>
Wed, 8 Oct 2014 12:57:22 +0000 (13:57 +0100)
commit5300099edf106c1f5938c0793bd6ca199a0eebf0
tree57d654681c48e08c0970fd3396c07a8ed5dd8b08
parent0ed9a2779a2adf0347088134fdb9f60ae9f2735b
Make the linker more robust to errors

Summary:
When linking fails because there was a problem with the supplied
object file, then we should not barf() or exit, we should emit a
suitable error message and return an error code to the caller.  We
should also free all memory that might have been allocated during
linking, and generally not do any damage.  This patch fixes most
common instances of this problem.

Test Plan: validate

Reviewers: rwbarton, austin, ezyang

Reviewed By: ezyang

Subscribers: simonmar, ezyang, carter, thomie

Differential Revision: https://phabricator.haskell.org/D294
includes/rts/Linker.h
rts/Linker.c
testsuite/tests/rts/Makefile
testsuite/tests/rts/all.T
testsuite/tests/rts/linker_error.c [new file with mode: 0644]
testsuite/tests/rts/linker_error2.c [new file with mode: 0644]
testsuite/tests/rts/linker_error3.c [new file with mode: 0644]
testsuite/tests/rts/linker_unload.c