cvs commit: fptools/ghc/compiler/cmm CLabel.hs Cmm.hs CmmParse.y
PprC.hs PprCmm.hs fptools/ghc/compiler/codeGen CgInfoTbls.hs
fptools/ghc/compiler/main CmdLineOpts.lhs DriverFlags.hs
fptools/ghc/compiler/nativeGen PositionIndependentCode.hs AsmCodeGen.lhs ...
wolfgang at haskell.org
Thu Oct 7 11:54:45 EDT 2004
wolfgang 2004/10/07 08:54:45 PDT
ghc/compiler/cmm CLabel.hs Cmm.hs CmmParse.y PprC.hs
ghc/compiler/main CmdLineOpts.lhs DriverFlags.hs
ghc/compiler/nativeGen AsmCodeGen.lhs MachCodeGen.hs
MachInstrs.hs MachRegs.lhs NCGMonad.hs
ghc/includes Cmm.h InfoTables.h Storage.h
ghc/rts GC.c GCCompact.c HeapStackCheck.cmm
Linker.c Printer.c RetainerProfile.c
Position Independent Code and Dynamic Linking Support, Part 1
This commit allows generation of position independent code (PIC) that fully supports dynamic linking on Mac OS X and PowerPC Linux.
Other platforms are not yet supported, and there is no support for actually linking or using dynamic libraries - so if you use the -fPIC or -dynamic code generation flags, you have to type your (platform-specific) linker command lines yourself.
New file. Look here for some more comments on how this works.
Add support for DynamicLinkerLabels and PIC base labels - for use inside the NCG.
needsCDecl: Case alternative labels now need C decls, see the codeGen/CgInfoTbls.hs below for details
Add CmmPicBaseReg (used in NCG),
and CmmLabelDiffOff (used in NCG and for offsets in info tables)
support offsets in info tables
Case alternative labels now need C decls (see the codeGen/CgInfoTbls.hs for details), so we need to pprDataExterns for info tables.
no longer store absolute addresses in info tables, instead, we store offsets.
Also, for vectored return points, emit the alternatives _after_ the vector table. This is to work around a limitation in Apple's as, which refuses to handle label differences where one label is at the end of a section. Emitting alternatives after vector info tables makes sure this never happens in GHC generated code. Case alternatives now require prototypes in hc code, though (see changes in PprC.hs, CLabel.hs).
Add a new option, -fPIC.
Pass the correct options for PIC to gcc, depending on the platform. Only for powerpc for now.
Mac OS X-specific management of import stubs is no longer, it's now part of a general mechanism to handle such things for all platforms that need it (Darwin [both ppc and x86], Linux on ppc, and some platforms we don't support).
Move cmmToCmm into its own monad which can accumulate a list of imported symbols. Make it call cmmMakeDynamicReference at the right places.
Too many changes to enumerate here, PowerPC specific.
NatM still tracks imported symbols, as more labels can be created during code generation (float literals, jump tables; on some platforms all data access has to go through the dynamic linking mechanism).
Mangle absolute addresses in info tables to offsets.
Correctly pass through GCC-generated PIC for Mac OS X and powerpc linux.
Adapt to the fact that info tables now contain offsets.
Mac-specific: change machoInitSymbolsWithoutUnderscore to support PIC.
Revision Changes Path
1.6 +85 -19 fptools/ghc/compiler/cmm/CLabel.hs
1.3 +12 -0 fptools/ghc/compiler/cmm/Cmm.hs
1.4 +7 -4 fptools/ghc/compiler/cmm/CmmParse.y
1.8 +13 -1 fptools/ghc/compiler/cmm/PprC.hs
1.4 +2 -0 fptools/ghc/compiler/cmm/PprCmm.hs
1.5 +59 -19 fptools/ghc/compiler/codeGen/CgInfoTbls.hs
1.190 +6 -2 fptools/ghc/compiler/main/CmdLineOpts.lhs
1.138 +13 -4 fptools/ghc/compiler/main/DriverFlags.hs
1.63 +120 -69 fptools/ghc/compiler/nativeGen/AsmCodeGen.lhs
1.3 +148 -109 fptools/ghc/compiler/nativeGen/MachCodeGen.hs
1.3 +4 -0 fptools/ghc/compiler/nativeGen/MachInstrs.hs
1.52 +6 -4 fptools/ghc/compiler/nativeGen/MachRegs.lhs
1.3 +22 -9 fptools/ghc/compiler/nativeGen/NCGMonad.hs
1.3 +25 -51 fptools/ghc/compiler/nativeGen/PprMach.hs
1.3 +4 -0 fptools/ghc/compiler/nativeGen/RegAllocInfo.hs
1.116 +58 -7 fptools/ghc/driver/mangler/ghc-asm.lprl
1.3 +7 -1 fptools/ghc/includes/Cmm.h
1.34 +48 -4 fptools/ghc/includes/InfoTables.h
1.4 +1 -1 fptools/ghc/includes/Storage.h
1.8 +1 -1 fptools/ghc/includes/mkDerivedConstants.c
1.172 +9 -9 fptools/ghc/rts/GC.c
1.22 +5 -5 fptools/ghc/rts/GCCompact.c
1.5 +6 -0 fptools/ghc/rts/HeapStackCheck.cmm
1.162 +14 -4 fptools/ghc/rts/Linker.c
1.67 +2 -2 fptools/ghc/rts/Printer.c
1.14 +10 -10 fptools/ghc/rts/RetainerProfile.c
1.37 +4 -4 fptools/ghc/rts/Sanity.c
More information about the Cvs-ghc