Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
jberryman
GHC
Commits
668151c8
Commit
668151c8
authored
Aug 05, 2012
by
ian@well-typed.com
Browse files
More more ld-related settings into the settings file
Related to
#4862
parent
1235c274
Changes
7
Hide whitespace changes
Inline
Side-by-side
compiler/ghc.mk
View file @
668151c8
...
...
@@ -99,12 +99,6 @@ endif
@
echo
'cLeadingUnderscore = "
$(LeadingUnderscore)
"'
>>
$@
@
echo
'cRAWCPP_FLAGS :: String'
>>
$@
@
echo
'cRAWCPP_FLAGS = "
$(RAWCPP_FLAGS)
"'
>>
$@
@
echo
'cLdHasNoCompactUnwind :: String'
>>
$@
@
echo
'cLdHasNoCompactUnwind = "
$(LdHasNoCompactUnwind)
"'
>>
$@
@
echo
'cLdIsGNULd :: String'
>>
$@
@
echo
'cLdIsGNULd = "
$(LdIsGNULd)
"'
>>
$@
@
echo
'cLdHasBuildId :: String'
>>
$@
@
echo
'cLdHasBuildId = "
$(LdHasBuildId)
"'
>>
$@
@
echo
'cGHC_DRIVER_DIR :: String'
>>
$@
@
echo
'cGHC_DRIVER_DIR = "
$(GHC_DRIVER_DIR)
"'
>>
$@
@
echo
'cGHC_UNLIT_PGM :: String'
>>
$@
...
...
compiler/main/DriverPipeline.hs
View file @
668151c8
...
...
@@ -1655,6 +1655,7 @@ getHCFilePackages filename =
linkBinary
::
DynFlags
->
[
FilePath
]
->
[
PackageId
]
->
IO
()
linkBinary
dflags
o_files
dep_packages
=
do
let
platform
=
targetPlatform
dflags
mySettings
=
settings
dflags
verbFlags
=
getVerbFlags
dflags
output_fn
=
exeFileName
dflags
...
...
@@ -1767,7 +1768,7 @@ linkBinary dflags o_files dep_packages = do
-- like
-- ld: warning: could not create compact unwind for .LFB3: non-standard register 5 being saved in prolog
-- on x86.
++
(
if
c
Ld
HasNo
CompactUnwind
==
"YES"
&&
++
(
if
s
Ld
Supports
CompactUnwind
mySettings
&&
platformOS
platform
==
OSDarwin
&&
platformArch
platform
`
elem
`
[
ArchX86
,
ArchX86_64
]
then
[
"-Wl,-no_compact_unwind"
]
...
...
@@ -2089,7 +2090,8 @@ hsSourceCppOpts =
joinObjectFiles
::
DynFlags
->
[
FilePath
]
->
FilePath
->
IO
()
joinObjectFiles
dflags
o_files
output_fn
=
do
let
ld_r
args
=
SysTools
.
runLink
dflags
([
let
mySettings
=
settings
dflags
ld_r
args
=
SysTools
.
runLink
dflags
([
SysTools
.
Option
"-nostdlib"
,
SysTools
.
Option
"-nodefaultlibs"
,
SysTools
.
Option
"-Wl,-r"
...
...
@@ -2100,20 +2102,18 @@ joinObjectFiles dflags o_files output_fn = do
++
(
if
platformArch
(
targetPlatform
dflags
)
==
ArchSPARC
then
[
SysTools
.
Option
"-Wl,-no-relax"
]
else
[]
)
++
[
SysTools
.
Option
ld_build_id
,
-- SysTools.Option ld_x_flag,
SysTools
.
Option
"-o"
,
SysTools
.
FileOption
""
output_fn
]
++
map
SysTools
.
Option
ld_build_id
++
[
SysTools
.
Option
"-o"
,
SysTools
.
FileOption
""
output_fn
]
++
args
)
-- suppress the generation of the .note.gnu.build-id section,
-- which we don't need and sometimes causes ld to emit a
-- warning:
ld_build_id
|
c
Ld
Ha
sBuildId
==
"YES"
=
"-Wl,--build-id=none"
|
otherwise
=
""
ld_build_id
|
s
Ld
Support
sBuildId
mySettings
=
[
"-Wl,--build-id=none"
]
|
otherwise
=
[]
if
c
LdIsG
NU
Ld
==
"YES"
if
s
LdIsG
nu
Ld
mySettings
then
do
script
<-
newTempName
dflags
"ldscript"
writeFile
script
$
"INPUT("
++
unwords
o_files
++
")"
...
...
compiler/main/DynFlags.hs
View file @
668151c8
...
...
@@ -672,6 +672,9 @@ data Settings = Settings {
sRawSettings
::
[(
String
,
String
)],
sExtraGccViaCFlags
::
[
String
],
sSystemPackageConfig
::
FilePath
,
sLdSupportsCompactUnwind
::
Bool
,
sLdSupportsBuildId
::
Bool
,
sLdIsGnuLd
::
Bool
,
-- commands for particular phases
sPgm_L
::
String
,
sPgm_P
::
(
String
,[
Option
]),
...
...
compiler/main/SysTools.lhs
View file @
668151c8
...
...
@@ -192,6 +192,11 @@ initSysTools mbMinusB
_ ->
xs
Nothing -> pgmError ("No entry for " ++ show key ++ " in " ++ show settingsFile)
getBooleanSetting key = case lookup key mySettings of
Just "YES" -> return True
Just "NO" -> return False
Just xs -> pgmError ("Bad value for " ++ show key ++ ": " ++ show xs)
Nothing -> pgmError ("No entry for " ++ show key ++ " in " ++ show settingsFile)
readSetting key = case lookup key mySettings of
Just xs ->
case maybeRead xs of
...
...
@@ -213,6 +218,9 @@ initSysTools mbMinusB
gcc_prog <- getSetting "C compiler command"
gcc_args_str <- getSetting "C compiler flags"
let gcc_args = map Option (words gcc_args_str)
ldSupportsCompactUnwind <- getBooleanSetting "ld supports compact unwind"
ldSupportsBuildId <- getBooleanSetting "ld supports build-id"
ldIsGnuLd <- getBooleanSetting "ld is GNU ld"
perl_path <- getSetting "perl command"
let pkgconfig_path = installed "package.conf.d"
...
...
@@ -280,6 +288,9 @@ initSysTools mbMinusB
sRawSettings = mySettings,
sExtraGccViaCFlags = words myExtraGccViaCFlags,
sSystemPackageConfig = pkgconfig_path,
sLdSupportsCompactUnwind = ldSupportsCompactUnwind,
sLdSupportsBuildId = ldSupportsBuildId,
sLdIsGnuLd = ldIsGnuLd,
sPgm_L = unlit_path,
sPgm_P = (cpp_prog, cpp_args),
sPgm_F = "",
...
...
configure.ac
View file @
668151c8
...
...
@@ -546,6 +546,10 @@ FP_CC_LLVM_BACKEND
FP_PROG_LD_HashSize31
FP_PROG_LD_ReduceMemoryOverheads
FP_PROG_LD_IS_GNU
FP_PROG_LD_BUILD_ID
FP_PROG_LD_NO_COMPACT_UNWIND
FPTOOLS_SET_C_LD_FLAGS([target],[CFLAGS],[LDFLAGS],[IGNORE_LINKER_LD_FLAGS],[CPPFLAGS])
FPTOOLS_SET_C_LD_FLAGS([build],[CONF_CC_OPTS_STAGE0],[CONF_GCC_LINKER_OPTS_STAGE0],[CONF_LD_LINKER_OPTS_STAGE0],[CONF_CPP_OPTS_STAGE0])
...
...
@@ -830,11 +834,6 @@ FPTOOLS_FLOAT_WORD_ORDER_BIGENDIAN
dnl ** check for leading underscores in symbol names
FP_LEADING_UNDERSCORE
dnl ** check for ld, whether it has an -x option, and if it is GNU ld
FP_PROG_LD_IS_GNU
FP_PROG_LD_BUILD_ID
FP_PROG_LD_NO_COMPACT_UNWIND
FP_VISIBILITY_HIDDEN
dnl ** check for librt
...
...
distrib/configure.ac.in
View file @
668151c8
...
...
@@ -72,6 +72,9 @@ AC_PROG_CPP
FP_PROG_LD_HashSize31
FP_PROG_LD_ReduceMemoryOverheads
FP_PROG_LD_IS_GNU
FP_PROG_LD_BUILD_ID
FP_PROG_LD_NO_COMPACT_UNWIND
#
dnl ** Check gcc version and flags we need to pass it **
...
...
settings.in
View file @
668151c8
...
...
@@ -2,6 +2,9 @@
("C compiler command", "@SettingsCCompilerCommand@"),
("C compiler flags", "@SettingsCCompilerFlags@"),
("ld flags", "@SettingsLdFlags@"),
("ld supports compact unwind", "@LdHasNoCompactUnwind@"),
("ld supports build-id", "@LdHasBuildId@"),
("ld is GNU ld", "@LdIsGNULd@"),
("ar command", "@SettingsArCommand@"),
("ar flags", "@ArArgs@"),
("ar supports at file", "@ArSupportsAtFile@"),
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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