Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
C
Cabal
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Analyze
Contributor analytics
CI/CD analytics
Repository analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Haskell
Cabal
Commits
745c720e
Commit
745c720e
authored
1 year ago
by
Erik de Castro Lopo
Browse files
Options
Downloads
Patches
Plain Diff
Only use relocatable linker flag if linker supports it
parent
7f0c5b24
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
Cabal/src/Distribution/Simple/Program/Ld.hs
+16
-3
16 additions, 3 deletions
Cabal/src/Distribution/Simple/Program/Ld.hs
with
16 additions
and
3 deletions
Cabal/src/Distribution/Simple/Program/Ld.hs
+
16
−
3
View file @
745c720e
...
...
@@ -18,6 +18,8 @@ module Distribution.Simple.Program.Ld
import
Distribution.Compat.Prelude
import
Prelude
()
import
qualified
Data.Map
as
Map
import
Distribution.Simple.Compiler
(
arResponseFilesSupported
)
import
Distribution.Simple.Flag
(
fromFlagOrDefault
...
...
@@ -67,10 +69,14 @@ combineObjectFiles verbosity lbi ld target files = do
-- have a slight problem. What we have to do is link files in batches into
-- a temp object file and then include that one in the next batch.
let
simpleArgs
=
[
"-r"
,
"-o"
,
target
]
putStrLn
"
\n\n\n
"
print
ld
putStrLn
"
\n\n\n
"
let
simpleArgs
=
prependRelocatableFlag
[
"-o"
,
target
]
initialArgs
=
[
"-r"
,
"-o"
,
target
]
middleArgs
=
[
"-r"
,
"-o"
,
target
,
tmpfile
]
initialArgs
=
prependRelocatableFlag
[
"-o"
,
target
]
middleArgs
=
prependRelocatableFlag
[
"-o"
,
target
,
tmpfile
]
finalArgs
=
middleArgs
simple
=
programInvocation
ld
simpleArgs
...
...
@@ -104,3 +110,10 @@ combineObjectFiles verbosity lbi ld target files = do
runProgramInvocation
verbosity
inv
renameFile
target
tmpfile
run
invs
-- Prepend "-r" to the list if the linker supports relocatable outputs.
prependRelocatableFlag
::
[
String
]
->
[
String
]
prependRelocatableFlag
xs
=
case
Map
.
lookup
"Supports relocatable output"
$
programProperties
ld
of
Just
"YES"
->
"-r"
:
xs
_other
->
xs
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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!
Save comment
Cancel
Please
register
or
sign in
to comment