diff options
author | Dougal <d.maclaurin@gmail.com> | 2022-09-26 21:48:11 -0400 |
---|---|---|
committer | Dougal <d.maclaurin@gmail.com> | 2022-09-26 21:48:11 -0400 |
commit | 11f28195aa258c8e16c07406ccd915f03d8f2aa7 (patch) | |
tree | dbaf2b5b65df3ce6f463135160d71b007dcc0663 /stack.yaml | |
parent | 8d1a725832636df71bf685e12d3a071a10347a9a (diff) |
Switch to a local naming discipline for linking standalone functions.
In the LLVM/C world, linking happens in a global name space. That clashes with
Dex's scoped naming system, which assumes that all names are abstractable and
alpha-renamable. Previously we limped along with a hack, but now that we're
about to add even more link-time names (specifically pointer constants, which
currently don't work with standalone functions) it's time to fix it.
With this change, each top-level standalone function is compiled as a speparate
LLVM module, and the functions it calls are given arbitrary local names that are
only used within that particular module. We maintain a mapping between these
names and our usual well-scoped "E-kinded" names. At link time, we provide the
linker with an explicit mapping from the local names to the actual function
pointers in the current process (thanks to Adam's recent patch to llvm-hs, PR
#404). Linking has to be redone when we start a new process, but everything else
can be stored on disk.
This way, object files contain no names outside of our own naming system. We're
free to cache them, merge separately compiled functions, use different versions
of a single library, and so on.
This change breaks the linking of dexrt. I'll try to fix that next.
Diffstat (limited to 'stack.yaml')
-rw-r--r-- | stack.yaml | 2 |
1 files changed, 1 insertions, 1 deletions
@@ -11,7 +11,7 @@ packages: extra-deps: - github: llvm-hs/llvm-hs - commit: 789e2b9e8b827d4c5e15b997f16e395fd2259c0f + commit: d694c1a0d8941591dffb8c2f7877712e04ab3e7e subdirs: - llvm-hs - llvm-hs-pure |