summaryrefslogtreecommitdiff
path: root/rts/LinkerInternals.h
diff options
context:
space:
mode:
authorTamar Christina <tamar@zhox.com>2017-06-02 11:47:57 -0400
committerBen Gamari <ben@smart-cactus.org>2017-06-02 12:27:45 -0400
commit93489cd3b4c1b0d17506a12a9b964c0082ddb7a8 (patch)
tree3255cbf5caa2c71e094e9e8655c9f38d5da734c5 /rts/LinkerInternals.h
parent5164cce20bc6f09f55cf5c4d1797b72b7e85b176 (diff)
downloadhaskell-93489cd3b4c1b0d17506a12a9b964c0082ddb7a8.tar.gz
Better import library support for Windows
The import library support added for 7.10.3 was only a partial one. This support was predicated on using file extensions to determine whether or not a library was an import library. It also couldn't handle libraries with multiple dll pointers. This is a rewrite of that patch and fully integrating it into the normal archive parsing and loading routines. This solves a host of issues, among others allowing us to finally use `-lgcc_s`. This also fixes a problem with our previous implementation, where we just loaded the DLL and moved on. Doing this had the potential of using the wrong symbol at resolve time. Say a DLL already loaded (A.dll) has symbol a exported (dependency of another dll perhaps). We find an import library `B.lib` explicitly defining an export of `a`. we load `B.dll` but this gets put after `A.dll`, at resolve time we would use the value from `A` instead of `B` which is what we wanted. Test Plan: ./valide and make test TEST=13606 Reviewers: austin, bgamari, erikd, simonmar Reviewed By: bgamari Subscribers: rwbarton, RyanGlScott, thomie, #ghc_windows_task_force GHC Trac Issues: #13606, #12499, #12498 Differential Revision: https://phabricator.haskell.org/D3513
Diffstat (limited to 'rts/LinkerInternals.h')
-rw-r--r--rts/LinkerInternals.h14
1 files changed, 12 insertions, 2 deletions
diff --git a/rts/LinkerInternals.h b/rts/LinkerInternals.h
index b8c411d22a..48c43ebbbe 100644
--- a/rts/LinkerInternals.h
+++ b/rts/LinkerInternals.h
@@ -32,13 +32,23 @@ typedef enum {
/* Indication of section kinds for loaded objects. Needed by
the GC for deciding whether or not a pointer on the stack
is a code pointer.
+ See Note [BFD import libraries].
*/
typedef
- enum { SECTIONKIND_CODE_OR_RODATA,
+ enum { /* Section is code or readonly. e.g. .text or .r(o)data. */
+ SECTIONKIND_CODE_OR_RODATA,
+ /* Section contains read/write data. e.g. .data. */
SECTIONKIND_RWDATA,
+ /* Static initializer section. e.g. .ctors. */
SECTIONKIND_INIT_ARRAY,
+ /* We don't know what the section is and don't care. */
SECTIONKIND_OTHER,
- SECTIONKIND_NOINFOAVAIL }
+ /* Section belongs to an import section group. e.g. .idata$. */
+ SECTIONKIND_IMPORT,
+ /* Section defines an import library entry, e.g. idata$7. */
+ SECTIONKIND_IMPORT_LIBRARY,
+ SECTIONKIND_NOINFOAVAIL
+ }
SectionKind;
typedef