summaryrefslogtreecommitdiff
path: root/ghc/compiler/cmm
Commit message (Collapse)AuthorAgeFilesLines
...
* [project @ 2004-10-18 11:38:41 by simonmar]simonmar2004-10-181-4/+8
| | | | | Make foreign import stdcall "dynamic" work via-C (we'd forgotten to add the __stdcall qualifier to the type cast for the function).
* [project @ 2004-10-07 15:54:03 by wolfgang]wolfgang2004-10-075-24/+119
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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. nativeGen/PositionIndependentCode.hs: New file. Look here for some more comments on how this works. cmm/CLabel.hs: 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 cmm/Cmm.hs: Add CmmPicBaseReg (used in NCG), and CmmLabelDiffOff (used in NCG and for offsets in info tables) cmm/CmmParse.y: support offsets in info tables cmm/PprC.hs: support CmmLabelDiffOff Case alternative labels now need C decls (see the codeGen/CgInfoTbls.hs for details), so we need to pprDataExterns for info tables. cmm/PprCmm.hs: support CmmLabelDiffOff codeGen/CgInfoTbls.hs: 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). main/CmdLineOpts.lhs: Add a new option, -fPIC. main/DriverFlags.hs: Pass the correct options for PIC to gcc, depending on the platform. Only for powerpc for now. nativeGen/AsmCodeGen.hs: Many changes... 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. nativeGen/MachCodeGen.hs: nativeGen/MachInstrs.hs: nativeGen/MachRegs.lhs: nativeGen/PprMach.hs: nativeGen/RegAllocInfo.hs: Too many changes to enumerate here, PowerPC specific. nativeGen/NCGMonad.hs: 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). driver/mangler/ghc-asm.lprl: Mangle absolute addresses in info tables to offsets. Correctly pass through GCC-generated PIC for Mac OS X and powerpc linux. includes/Cmm.h: includes/InfoTables.h: includes/Storage.h: includes/mkDerivedConstants.c: rts/GC.c: rts/GCCompact.c: rts/HeapStackCheck.cmm: rts/Printer.c: rts/RetainerProfile.c: rts/Sanity.c: Adapt to the fact that info tables now contain offsets. rts/Linker.c: Mac-specific: change machoInitSymbolsWithoutUnderscore to support PIC.
* [project @ 2004-09-28 13:15:19 by simonmar]simonmar2004-09-281-0/+6
| | | | | | | Avoid some warnings from gcc by appending an 'LL' suffix to 64-bit integers on a 32-bit platform. Suggested by: Sven Panne <Sven.Panne@aedion.de>
* [project @ 2004-09-15 02:47:03 by wolfgang]wolfgang2004-09-151-0/+1
| | | | | | | Accept '#pragma' lines in the cmm parser. This is necessary because Apple's version of GNU cpp 3.3 leaves #pragma lines in it's output, which cause the build to fail on Mac OS X with GCC >= 3.3
* [project @ 2004-09-10 18:54:21 by panne]panne2004-09-101-1/+0
| | | | Unbreak previous commit. Is QA on holiday? :-)
* [project @ 2004-09-10 14:54:48 by simonmar]simonmar2004-09-101-11/+1
| | | | RtsShouldNeverHappenCode never happens, now.
* [project @ 2004-09-10 14:53:44 by simonmar]simonmar2004-09-101-2/+2
| | | | | | | | | | | Fix problem that shows up when building stage2 on Windows: slots of a vector table that can never happen are normally filled with the RtsShouldNeverHappen label, which currently prints as "0". On systems with leading underscores on labels, such as Windows, this turns into "_0" which is reported as an undefined symbol. Having a label print as "0" is a real hack, so the solution is to do it properly. This commit does just that.
* [project @ 2004-08-26 11:06:04 by simonmar]simonmar2004-08-261-1/+0
| | | | | Urk, since when has subtraction been associative. /me dons the pointy hat.
* [project @ 2004-08-25 10:37:06 by simonmar]simonmar2004-08-251-5/+6
| | | | | fix braino in previous commit: we should cast the function result to the right type, not just assume (W_).
* [project @ 2004-08-23 10:11:23 by simonmar]simonmar2004-08-231-0/+22
| | | | | Fix an infinite loop in the cmm-optimiser in the native codegen, and refactor: move isAssociativeMachOp into MachOp.
* [project @ 2004-08-20 12:21:03 by simonmar]simonmar2004-08-202-27/+22
| | | | | | | | | | | Simplify the "impossible branch" handling, and fix a bug in the process. CmmSwitch encodes the possibility of having impossible branches (the destinations are Maybe BlockId rather than just BlockId) so we don't need to encode impossible branches as dummy blocks containing a jump to an impossible location (currently 0). However, PprC and PprCmm weren't set up to cope with Nothings in a CmmSwitch, so this commit fixes that too.
* [project @ 2004-08-20 11:20:16 by simonmar]simonmar2004-08-201-0/+10
| | | | | Give literal string labels a _str suffix, to make it less likely that they'll clash with a symbol in scope in a C file.
* [project @ 2004-08-18 10:07:29 by simonmar]simonmar2004-08-181-1/+1
| | | | Remove extra semicolon; exposed by other recent changes.
* [project @ 2004-08-16 11:57:19 by simonmar]simonmar2004-08-161-3/+19
| | | | Avoid casting lvalues; gcc 3.4 issues warnings for it.
* [project @ 2004-08-13 13:04:50 by simonmar]simonmar2004-08-139-0/+4534
Merge backend-hacking-branch onto HEAD. Yay!