X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=compiler%2FnativeGen%2FPositionIndependentCode.hs;h=6a94de22b2251ad597b6c21b44aa8973caa00964;hb=f83010b119096699d1efef2f7bb45460719c48f9;hp=53ee563e5cdbfd5da1a642fea0eb46fa3308a29d;hpb=ba8b3afc73880f49c3c9a960d3ac8fc3247fa6f8;p=ghc-hetmet.git diff --git a/compiler/nativeGen/PositionIndependentCode.hs b/compiler/nativeGen/PositionIndependentCode.hs index 53ee563..6a94de2 100644 --- a/compiler/nativeGen/PositionIndependentCode.hs +++ b/compiler/nativeGen/PositionIndependentCode.hs @@ -131,7 +131,7 @@ cmmMakePicReference :: CLabel -> CmmExpr -- everything gets relocated at runtime cmmMakePicReference lbl - | opt_PIC && absoluteLabel lbl = CmmMachOp (MO_Add wordRep) [ + | (opt_PIC || not opt_Static) && absoluteLabel lbl = CmmMachOp (MO_Add wordRep) [ CmmReg (CmmGlobal PicBaseReg), CmmLit $ picRelative lbl ] @@ -200,7 +200,7 @@ howToAccessLabel DataReference lbl | otherwise = AccessDirectly -#if x86_TARGET_ARCH || x86_64_TARGET_ARCH +#if i386_TARGET_ARCH || x86_64_TARGET_ARCH -- dyld code stubs don't work for tailcalls because the -- stack alignment is only right for regular calls. -- Therefore, we have to go via a symbol pointer: @@ -274,7 +274,7 @@ howToAccessLabel CallReference lbl = AccessDirectly #if !i386_TARGET_ARCH | labelDynamic lbl && opt_PIC - = AccessViaSymbolStub + = AccessViaStub #endif howToAccessLabel _ lbl @@ -372,6 +372,9 @@ pprGotDeclaration = Pretty.empty -- On Darwin, we have to generate our own stub code for lazy binding.. -- For each processor architecture, there are two versions, one for PIC -- and one for non-PIC. +-- +-- Whenever you change something in this assembler output, make sure +-- the splitter in driver/split/ghc-split.lprl recognizes the new output pprImportedSymbol importedLbl #if powerpc_TARGET_ARCH | Just (CodeStub, lbl) <- dynamicLinkerLabelInfo importedLbl @@ -442,7 +445,7 @@ pprImportedSymbol importedLbl ptext SLIT("1:"), ptext SLIT("\tmovl L") <> pprCLabel_asm lbl <> ptext SLIT("$lazy_ptr-1b(%eax),%edx"), - ptext SLIT("\tjmp %edx"), + ptext SLIT("\tjmp *%edx"), ptext SLIT("L") <> pprCLabel_asm lbl <> ptext SLIT("$stub_binder:"), ptext SLIT("\tlea L") <> pprCLabel_asm lbl