Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Glasgow Haskell Compiler
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Iterations
Merge Requests
0
Merge Requests
0
Requirements
Requirements
List
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Package Registry
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issue
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Shayne Fletcher
Glasgow Haskell Compiler
Commits
da5b7ba3
Commit
da5b7ba3
authored
Sep 10, 2012
by
ian@well-typed.com
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove some more CPP
parent
c8553963
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
144 additions
and
128 deletions
+144
-128
aclocal.m4
aclocal.m4
+4
-1
compiler/main/DriverPipeline.hs
compiler/main/DriverPipeline.hs
+136
-127
compiler/utils/Platform.hs
compiler/utils/Platform.hs
+4
-0
No files found.
aclocal.m4
View file @
da5b7ba3
...
...
@@ -226,7 +226,10 @@ AC_DEFUN([FPTOOLS_SET_HASKELL_PLATFORM_VARS],
haiku)
test -z "[$]2" || eval "[$]2=OSHaiku"
;;
dragonfly|osf1|osf3|hpux|linuxaout|freebsd2|cygwin32|gnu|nextstep2|nextstep3|sunos4|ultrix|irix|aix)
osf3)
test -z "[$]2" || eval "[$]2=OSOsf3"
;;
dragonfly|osf1|hpux|linuxaout|freebsd2|cygwin32|gnu|nextstep2|nextstep3|sunos4|ultrix|irix|aix)
test -z "[$]2" || eval "[$]2=OSUnknown"
;;
*)
...
...
compiler/main/DriverPipeline.hs
View file @
da5b7ba3
...
...
@@ -1730,16 +1730,15 @@ linkBinary dflags o_files dep_packages = do
]
|
otherwise
=
[]
let
thread_opts
|
WayThreaded
`
elem
`
ways
dflags
=
[
#
if
!
defined
(
mingw32_TARGET_OS
)
&&
!
defined
(
freebsd_TARGET_OS
)
&&
!
defined
(
openbsd_TARGET_OS
)
&&
!
defined
(
netbsd_TARGET_OS
)
&&
!
defined
(
haiku_TARGET_OS
)
"-lpthread"
#
endif
#
if
defined
(
osf3_TARGET_OS
)
,
"-lexc"
#
endif
]
|
otherwise
=
[]
let
thread_opts
|
WayThreaded
`
elem
`
ways
dflags
=
let
os
=
platformOS
(
targetPlatform
dflags
)
in
if
os
==
OSOsf3
then
[
"-lpthread"
,
"-lexc"
]
else
if
os
`
elem
`
[
OSMinGW32
,
OSFreeBSD
,
OSOpenBSD
,
OSNetBSD
,
OSHaiku
]
then
[]
else
[
"-lpthread"
]
|
otherwise
=
[]
rc_objs
<-
maybeCreateManifest
dflags
output_fn
...
...
@@ -1904,7 +1903,9 @@ linkDynLib dflags o_files dep_packages
-- not allow undefined symbols.
-- The RTS library path is still added to the library search path
-- above in case the RTS is being explicitly linked in (see #3807).
let
pkgs_no_rts
=
case
platformOS
(
targetPlatform
dflags
)
of
let
platform
=
targetPlatform
dflags
os
=
platformOS
platform
pkgs_no_rts
=
case
os
of
OSMinGW32
->
pkgs
_
->
...
...
@@ -1916,123 +1917,131 @@ linkDynLib dflags o_files dep_packages
let
extra_ld_opts
=
getOpts
dflags
opt_l
#
if
defined
(
mingw32_HOST_OS
)
-----------------------------------------------------------------------------
-- Making a DLL
-----------------------------------------------------------------------------
let
output_fn
=
case
o_file
of
{
Just
s
->
s
;
Nothing
->
"HSdll.dll"
;
}
case
os
of
OSMinGW32
->
do
-------------------------------------------------------------
-- Making a DLL
-------------------------------------------------------------
let
output_fn
=
case
o_file
of
Just
s
->
s
Nothing
->
"HSdll.dll"
SysTools
.
runLink
dflags
(
map
SysTools
.
Option
verbFlags
++
[
SysTools
.
Option
"-o"
,
SysTools
.
FileOption
""
output_fn
,
SysTools
.
Option
"-shared"
]
++
[
SysTools
.
FileOption
"-Wl,--out-implib="
(
output_fn
++
".a"
)
|
dopt
Opt_SharedImplib
dflags
]
++
map
(
SysTools
.
FileOption
""
)
o_files
++
map
SysTools
.
Option
(
-- Permit the linker to auto link _symbol to _imp_symbol
-- This lets us link against DLLs without needing an "import library"
[
"-Wl,--enable-auto-import"
]
++
extra_ld_inputs
++
lib_path_opts
++
extra_ld_opts
++
pkg_lib_path_opts
++
pkg_link_opts
))
OSDarwin
->
do
-------------------------------------------------------------------
-- Making a darwin dylib
-------------------------------------------------------------------
-- About the options used for Darwin:
-- -dynamiclib
-- Apple's way of saying -shared
-- -undefined dynamic_lookup:
-- Without these options, we'd have to specify the correct
-- dependencies for each of the dylibs. Note that we could
-- (and should) do without this for all libraries except
-- the RTS; all we need to do is to pass the correct
-- HSfoo_dyn.dylib files to the link command.
-- This feature requires Mac OS X 10.3 or later; there is
-- a similar feature, -flat_namespace -undefined suppress,
-- which works on earlier versions, but it has other
-- disadvantages.
-- -single_module
-- Build the dynamic library as a single "module", i.e. no
-- dynamic binding nonsense when referring to symbols from
-- within the library. The NCG assumes that this option is
-- specified (on i386, at least).
-- -install_name
-- Mac OS/X stores the path where a dynamic library is (to
-- be) installed in the library itself. It's called the
-- "install name" of the library. Then any library or
-- executable that links against it before it's installed
-- will search for it in its ultimate install location.
-- By default we set the install name to the absolute path
-- at build time, but it can be overridden by the
-- -dylib-install-name option passed to ghc. Cabal does
-- this.
-------------------------------------------------------------------
let
output_fn
=
case
o_file
of
{
Just
s
->
s
;
Nothing
->
"a.out"
;
}
instName
<-
case
dylibInstallName
dflags
of
Just
n
->
return
n
Nothing
->
do
pwd
<-
getCurrentDirectory
return
$
pwd
`
combine
`
output_fn
SysTools
.
runLink
dflags
(
map
SysTools
.
Option
verbFlags
++
[
SysTools
.
Option
"-dynamiclib"
,
SysTools
.
Option
"-o"
,
SysTools
.
FileOption
""
output_fn
]
++
map
SysTools
.
Option
(
o_files
++
[
"-undefined"
,
"dynamic_lookup"
,
"-single_module"
]
++
(
if
platformArch
platform
==
ArchX86_64
then
[ ]
else
[
"-Wl,-read_only_relocs,suppress"
])
++
[
"-install_name"
,
instName
]
++
extra_ld_inputs
++
lib_path_opts
++
extra_ld_opts
++
pkg_lib_path_opts
++
pkg_link_opts
))
_
->
do
-------------------------------------------------------------------
-- Making a DSO
-------------------------------------------------------------------
let
output_fn
=
case
o_file
of
{
Just
s
->
s
;
Nothing
->
"a.out"
;
}
let
buildingRts
=
thisPackage
dflags
==
rtsPackageId
let
bsymbolicFlag
=
if
buildingRts
then
-- -Bsymbolic breaks the way we implement
-- hooks in the RTS
[]
else
-- we need symbolic linking to resolve
-- non-PIC intra-package-relocations
[
"-Wl,-Bsymbolic"
]
SysTools
.
runLink
dflags
(
map
SysTools
.
Option
verbFlags
++
[
SysTools
.
Option
"-o"
,
SysTools
.
FileOption
""
output_fn
]
++
map
SysTools
.
Option
(
o_files
++
[
"-shared"
]
++
bsymbolicFlag
-- Set the library soname. We use -h rather than -soname as
-- Solaris 10 doesn't support the latter:
++
[
"-Wl,-h,"
++
takeFileName
output_fn
]
++
extra_ld_inputs
++
lib_path_opts
++
extra_ld_opts
++
pkg_lib_path_opts
++
pkg_link_opts
))
SysTools
.
runLink
dflags
(
map
SysTools
.
Option
verbFlags
++
[
SysTools
.
Option
"-o"
,
SysTools
.
FileOption
""
output_fn
,
SysTools
.
Option
"-shared"
]
++
[
SysTools
.
FileOption
"-Wl,--out-implib="
(
output_fn
++
".a"
)
|
dopt
Opt_SharedImplib
dflags
]
++
map
(
SysTools
.
FileOption
""
)
o_files
++
map
SysTools
.
Option
(
-- Permit the linker to auto link _symbol to _imp_symbol
-- This lets us link against DLLs without needing an "import library"
[
"-Wl,--enable-auto-import"
]
++
extra_ld_inputs
++
lib_path_opts
++
extra_ld_opts
++
pkg_lib_path_opts
++
pkg_link_opts
))
#
elif
defined
(
darwin_TARGET_OS
)
-----------------------------------------------------------------------------
-- Making a darwin dylib
-----------------------------------------------------------------------------
-- About the options used for Darwin:
-- -dynamiclib
-- Apple's way of saying -shared
-- -undefined dynamic_lookup:
-- Without these options, we'd have to specify the correct dependencies
-- for each of the dylibs. Note that we could (and should) do without this
-- for all libraries except the RTS; all we need to do is to pass the
-- correct HSfoo_dyn.dylib files to the link command.
-- This feature requires Mac OS X 10.3 or later; there is a similar feature,
-- -flat_namespace -undefined suppress, which works on earlier versions,
-- but it has other disadvantages.
-- -single_module
-- Build the dynamic library as a single "module", i.e. no dynamic binding
-- nonsense when referring to symbols from within the library. The NCG
-- assumes that this option is specified (on i386, at least).
-- -install_name
-- Mac OS/X stores the path where a dynamic library is (to be) installed
-- in the library itself. It's called the "install name" of the library.
-- Then any library or executable that links against it before it's
-- installed will search for it in its ultimate install location. By
-- default we set the install name to the absolute path at build time, but
-- it can be overridden by the -dylib-install-name option passed to ghc.
-- Cabal does this.
-----------------------------------------------------------------------------
let
output_fn
=
case
o_file
of
{
Just
s
->
s
;
Nothing
->
"a.out"
;
}
instName
<-
case
dylibInstallName
dflags
of
Just
n
->
return
n
Nothing
->
do
pwd
<-
getCurrentDirectory
return
$
pwd
`
combine
`
output_fn
SysTools
.
runLink
dflags
(
map
SysTools
.
Option
verbFlags
++
[
SysTools
.
Option
"-dynamiclib"
,
SysTools
.
Option
"-o"
,
SysTools
.
FileOption
""
output_fn
]
++
map
SysTools
.
Option
(
o_files
++
[
"-undefined"
,
"dynamic_lookup"
,
"-single_module"
,
#
if
!
defined
(
x86_64_TARGET_ARCH
)
"-Wl,-read_only_relocs,suppress"
,
#
endif
"-install_name"
,
instName
]
++
extra_ld_inputs
++
lib_path_opts
++
extra_ld_opts
++
pkg_lib_path_opts
++
pkg_link_opts
))
#
else
-----------------------------------------------------------------------------
-- Making a DSO
-----------------------------------------------------------------------------
let
output_fn
=
case
o_file
of
{
Just
s
->
s
;
Nothing
->
"a.out"
;
}
let
buildingRts
=
thisPackage
dflags
==
rtsPackageId
let
bsymbolicFlag
=
if
buildingRts
then
-- -Bsymbolic breaks the way we implement
-- hooks in the RTS
[]
else
-- we need symbolic linking to resolve
-- non-PIC intra-package-relocations
[
"-Wl,-Bsymbolic"
]
SysTools
.
runLink
dflags
(
map
SysTools
.
Option
verbFlags
++
[
SysTools
.
Option
"-o"
,
SysTools
.
FileOption
""
output_fn
]
++
map
SysTools
.
Option
(
o_files
++
[
"-shared"
]
++
bsymbolicFlag
-- Set the library soname. We use -h rather than -soname as
-- Solaris 10 doesn't support the latter:
++
[
"-Wl,-h,"
++
takeFileName
output_fn
]
++
extra_ld_inputs
++
lib_path_opts
++
extra_ld_opts
++
pkg_lib_path_opts
++
pkg_link_opts
))
#
endif
-- -----------------------------------------------------------------------------
-- Running CPP
...
...
compiler/utils/Platform.hs
View file @
da5b7ba3
...
...
@@ -65,6 +65,7 @@ data OS
|
OSNetBSD
|
OSKFreeBSD
|
OSHaiku
|
OSOsf3
deriving
(
Read
,
Show
,
Eq
)
-- | ARM Instruction Set Architecture, Extensions and ABI
...
...
@@ -104,8 +105,11 @@ osElfTarget OSDarwin = False
osElfTarget
OSMinGW32
=
False
osElfTarget
OSKFreeBSD
=
True
osElfTarget
OSHaiku
=
True
osElfTarget
OSOsf3
=
False
-- I don't know if this is right, but as
-- per comment below it's safe
osElfTarget
OSUnknown
=
False
-- Defaulting to False is safe; it means don't rely on any
-- ELF-specific functionality. It is important to have a default for
-- portability, otherwise we have to answer this question for every
-- new platform we compile on (even unreg).
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment