diff options
author | Ray Shih <rayshih@fb.com> | 2020-07-09 06:48:55 -0700 |
---|---|---|
committer | Marge Bot <ben+marge-bot@smart-cactus.org> | 2020-11-11 03:20:35 -0500 |
commit | 2782487f5f6ad9df4dc8725226a47f07fec77f9f (patch) | |
tree | c0605f2cfd8228586eb108598d021ce0c40d9976 /rts/linker | |
parent | c34a4b98b1f09ea3096d39a839a86f2d7185c796 (diff) | |
download | haskell-2782487f5f6ad9df4dc8725226a47f07fec77f9f.tar.gz |
Add loadNativeObj and unloadNativeObj
(This change is originally written by niteria)
This adds two functions:
* `loadNativeObj`
* `unloadNativeObj`
and implements them for Linux.
They are useful if you want to load a shared object with Haskell code
using the system linker and have GHC call dlclose() after the
code is no longer referenced from the heap.
Using the system linker allows you to load the shared object
above outside the low-mem region. It also loads the DWARF sections
in a way that `perf` understands.
`dl_iterate_phdr` is what makes this implementation Linux specific.
Diffstat (limited to 'rts/linker')
-rw-r--r-- | rts/linker/LoadArchive.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/rts/linker/LoadArchive.c b/rts/linker/LoadArchive.c index 0ad3d94725..55081489f5 100644 --- a/rts/linker/LoadArchive.c +++ b/rts/linker/LoadArchive.c @@ -521,7 +521,7 @@ static HsInt loadArchive_ (pathchar *path) pathprintf(archiveMemberName, size, WSTR("%" PATH_FMT "(%.*s)"), path, (int)thisFileNameSize, fileName); - ObjectCode *oc = mkOc(path, image, memberSize, false, archiveMemberName, + ObjectCode *oc = mkOc(STATIC_OBJECT, path, image, memberSize, false, archiveMemberName, misalignment); #if defined(OBJFORMAT_MACHO) ocInit_MachO( oc ); |