[PATCH] Enable Opt_PIC for the dyn way regardless of OSes.

PHO pho at cielonegro.org
Wed Mar 13 16:22:34 CET 2013


We were previously enabling Opt_PIC on certain OSes namely Windows,
Darwin and Linux, but it should always be enabled for the dyn way
because it makes no sense to try to generate non-PIC dynamic
libraries, which is usually impossible.
---
 compiler/main/DynFlags.hs | 16 ++--------------
 1 file changed, 2 insertions(+), 14 deletions(-)

diff --git a/compiler/main/DynFlags.hs b/compiler/main/DynFlags.hs
index 060619d..55b6fe9 100644
--- a/compiler/main/DynFlags.hs
+++ b/compiler/main/DynFlags.hs
@@ -1052,20 +1052,8 @@ wayDesc WayNDP      = "Nested data parallelism"

 wayGeneralFlags :: Platform -> Way -> [GeneralFlag]
 wayGeneralFlags _ WayThreaded = []
-wayGeneralFlags _ WayDebug = []
-wayGeneralFlags platform WayDyn =
-        case platformOS platform of
-            -- On Windows, code that is to be linked into a dynamic
-            -- library must be compiled with -fPIC. Labels not in
-            -- the current package are assumed to be in a DLL
-            -- different from the current one.
-            OSMinGW32 -> [Opt_PIC]
-            OSDarwin  -> [Opt_PIC]
-            OSLinux   -> [Opt_PIC] -- This needs to be here for GHCi to work:
-                                   -- GHCi links objects into a .so before
-                                   -- loading the .so using the system linker.
-                                   -- Only PIC objects can be linked into a .so.
-            _         -> []
+wayGeneralFlags _ WayDebug    = []
+wayGeneralFlags _ WayDyn      = [Opt_PIC]
 wayGeneralFlags _ WayProf     = [Opt_SccProfilingOn]
 wayGeneralFlags _ WayEventLog = []
 wayGeneralFlags _ WayPar      = [Opt_Parallel]
--
1.8.1


----Next_Part(Thu_Mar_14_01_03_13_2013_276)----

----Security_Multipart0(Thu_Mar_14_01_03_20_2013_817)--
Content-Type: application/pgp-signature
Content-Transfer-Encoding: 7bit

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.13 (Darwin)

iD8DBQBRQKNIFOecpxqG73IRApCkAKCgxuumnkT5uBRfI5oP+atjS1GRPQCfc1ex
49VUzXaa1xFHySSWcm9nNME=
=TkKO
-----END PGP SIGNATURE-----

----Security_Multipart0(Thu_Mar_14_01_03_20_2013_817)----



More information about the ghc-devs mailing list