Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
GHC
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
Alex D
GHC
Commits
58eaacc9
Commit
58eaacc9
authored
Oct 01, 2012
by
ian@well-typed.com
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add a flag to tell ghc to use $ORIGIN when linking program dynamically
parent
483c7633
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
26 additions
and
2 deletions
+26
-2
compiler/main/DriverPipeline.hs
compiler/main/DriverPipeline.hs
+12
-2
compiler/main/DynFlags.hs
compiler/main/DynFlags.hs
+2
-0
compiler/utils/Util.lhs
compiler/utils/Util.lhs
+12
-0
No files found.
compiler/main/DriverPipeline.hs
View file @
58eaacc9
...
...
@@ -1662,13 +1662,23 @@ linkBinary dflags o_files dep_packages = do
-- explicit packages with the auto packages and all of their
-- dependencies, and eliminating duplicates.
full_output_fn
<-
if
isAbsolute
output_fn
then
return
output_fn
else
do
d
<-
getCurrentDirectory
return
$
normalise
(
d
</>
output_fn
)
pkg_lib_paths
<-
getPackageLibraryPath
dflags
dep_packages
let
pkg_lib_path_opts
=
concat
(
map
get_pkg_lib_path_opts
pkg_lib_paths
)
let
pkg_lib_path_opts
=
concat
Map
get_pkg_lib_path_opts
pkg_lib_paths
get_pkg_lib_path_opts
l
|
osElfTarget
(
platformOS
platform
)
&&
dynLibLoader
dflags
==
SystemDependent
&&
not
(
dopt
Opt_Static
dflags
)
=
[
"-L"
++
l
,
"-Wl,-rpath"
,
"-Wl,"
++
l
]
=
let
libpath
=
if
dopt
Opt_RelativeDynlibPaths
dflags
then
"$ORIGIN"
</>
(
l
`
makeRelativeTo
`
full_output_fn
)
else
l
in
[
"-L"
++
l
,
"-Wl,-rpath"
,
"-Wl,"
++
libpath
,
"-Wl,-rpath-link"
,
"-Wl,"
++
l
]
|
otherwise
=
[
"-L"
++
l
]
let
lib_paths
=
libraryPaths
dflags
...
...
compiler/main/DynFlags.hs
View file @
58eaacc9
...
...
@@ -339,6 +339,7 @@ data DynFlag
|
Opt_SccProfilingOn
|
Opt_Ticky
|
Opt_Static
|
Opt_RelativeDynlibPaths
|
Opt_Hpc
-- output style opts
...
...
@@ -1780,6 +1781,7 @@ dynamic_flags = [
addWay
WayDyn
))
-- ignored for compat w/ gcc:
,
Flag
"rdynamic"
(
NoArg
(
return
()
))
,
Flag
"relative-dynlib-paths"
(
NoArg
(
setDynFlag
Opt_RelativeDynlibPaths
))
------- Specific phases --------------------------------------------
-- need to appear before -pgmL to be parsed as LLVM flags.
...
...
compiler/utils/Util.lhs
View file @
58eaacc9
...
...
@@ -87,6 +87,7 @@ module Util (
escapeSpaces,
parseSearchPath,
Direction(..), reslash,
makeRelativeTo,
-- * Utils for defining Data instances
abstractConstr, abstractDataType, mkNoRepType,
...
...
@@ -1006,6 +1007,17 @@ reslash d = f
slash = case d of
Forwards -> '/'
Backwards -> '\\'
makeRelativeTo :: FilePath -> FilePath -> FilePath
this `makeRelativeTo` that = directory </> thisFilename
where (thisDirectory, thisFilename) = splitFileName this
thatDirectory = dropFileName that
directory = joinPath $ f (splitPath thisDirectory)
(splitPath thatDirectory)
f (x : xs) (y : ys)
| x == y = f xs ys
f xs ys = replicate (length ys) ".." ++ xs
\end{code}
%************************************************************************
...
...
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