linker: store entire link map and use it.

Authored by Phyx on Mon, Dec 3, 6:29 PM.

Description

linker: store entire link map and use it.

Summary:
This fixes a corner case in which we have seen the symbol multiple times in
different static libraries, but due to a depencency we end up loading the
symbol from a library other than the first one.

Previously the runtime linker would only track symbols from the first
library and did not store the full link map. In this case it was unable
to find the address for the symbols in the second library during delay
loading.

This change stores the address of all symbols seen so a full link map
is generated, such that when we make a different decision later than what
was expected we're able to still correctly load the library.

Test Plan: ./validate, new testcase T15894

Reviewers: angerman, bgamari, erikd, simonmar

Reviewed By: bgamari

Subscribers: rwbarton, carter

GHC Trac Issues: Trac #15894

Differential Revision: https://phabricator.haskell.org/D5353

Details

Committed
PhyxTue, Dec 4, 1:15 AM
Reviewer
bgamari
Differential Revision
D5353: linker: store entire link map and use it.
Parents
rGHC924026e04053: Hadrian: include 'findPtr' via find-ptr cabal flag
Branches
Unknown
Tags
Unknown