Skip to content
Snippets Groups Projects
Commit 3dbc6ac6 authored by Moritz Angermann's avatar Moritz Angermann
Browse files

Trying to get PIC right.

parent 34c6c6d7
No related branches found
No related tags found
No related merge requests found
......@@ -1436,6 +1436,10 @@ pprDynamicLinkerAsmLabel platform dllInfo lbl =
SymbolPtr -> text ".LC_" <> ppr lbl
_ -> panic "pprDynamicLinkerAsmLabel"
| platformArch platform == ArchAArch64
= ppr lbl
| platformArch platform == ArchX86_64
= case dllInfo of
CodeStub -> ppr lbl <> text "@plt"
......
......@@ -133,6 +133,14 @@ cmmMakeDynamicReference config referenceKind lbl
addImport stub
return $ CmmLit $ CmmLabel stub
-- GOT relative loads work differently on AArch64. We don't
-- the got symbol is loaded directly, and not through an additional
-- load.
AccessViaSymbolPtr | ArchAArch64 <- platformArch platform -> do
let symbolPtr = mkDynamicLinkerLabel SymbolPtr lbl
addImport symbolPtr
return $ cmmMakePicReference config symbolPtr
AccessViaSymbolPtr -> do
let symbolPtr = mkDynamicLinkerLabel SymbolPtr lbl
addImport symbolPtr
......@@ -146,7 +154,6 @@ cmmMakeDynamicReference config referenceKind lbl
-- so just jump there if it's a call or a jump
_ -> return $ CmmLit $ CmmLabel lbl
-- -----------------------------------------------------------------------------
-- Create a position independent reference to a label.
-- (but do not bother with dynamic linking).
......@@ -261,11 +268,11 @@ howToAccessLabel config _ OSMinGW32 this_mod _ lbl
-- is enough for ~64MB of range. Anything else will need to go through a veneer,
-- which is the job of the linker to build. We might only want to lookup
-- Data References through the GOT.
howToAccessLabel _config ArchAArch64 _os _this_mod kind _lbl
= case kind of
DataReference -> AccessDirectly -- AccessViaSymbolPtr
CallReference -> AccessDirectly
JumpReference -> AccessDirectly
-- howToAccessLabel _config ArchAArch64 _os _this_mod kind _lbl
-- = case kind of
-- DataReference -> AccessDirectly -- AccessViaSymbolPtr
-- CallReference -> AccessDirectly
-- JumpReference -> AccessDirectly
-- Mach-O (Darwin, Mac OS X)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment