Skip to content

Commit

Permalink
Add -pic-runtime {false,true} option
Browse files Browse the repository at this point in the history
Can be used to override a target-determined default.

See MLton#191
  • Loading branch information
MatthewFluet committed Jan 21, 2020
1 parent 749b0b5 commit daa5eb3
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
4 changes: 3 additions & 1 deletion CHANGELOG.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@ Here are the changes from version 20180206 to version YYYYMMDD.
=== Details

* 2020-01-21
** Added expert `-native-pic {false,true}` option, which can be used
** Added expert `-pic-runtime {false|true}` option, which can be used
to override a target-determined default.
** Added expert `-native-pic {false|true}` option, which can be used
to override a target-determined default.
** Support parallel build (i.e., `make -j`). This mainly supports
platforms/packagers tht use a parallel `make` by default; it does not obtain
Expand Down
11 changes: 9 additions & 2 deletions mlton/main/main.fun
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ val llvm_opt: string ref = ref "opt"
val llvm_optOpts: {opt: string, pred: OptPred.t} list ref = ref []

val debugRuntime: bool ref = ref false
val picRuntime: bool option ref = ref NONE
val expert: bool ref = ref false
val explicitAlign: Control.align option ref = ref NONE
val explicitChunkify: Control.Chunkify.t option ref = ref NONE
Expand Down Expand Up @@ -344,7 +345,7 @@ fun makeOptions {usage} =
(Expert, "debug", " {false|true}", "produce executable with debug info",
Bool (fn b => (debug := b
; debugRuntime := b))),
(Expert, "debug-runtime", " {false|true}", "produce executable with debug info",
(Expert, "debug-runtime", " {false|true}", "link with debug runtime",
boolRef debugRuntime),
let
val flag = "default-ann"
Expand Down Expand Up @@ -667,6 +668,8 @@ fun makeOptions {usage} =
| Result.Yes () => ())),
(Normal, "output", " <file>", "name of output file",
SpaceString (fn s => output := SOME s)),
(Expert, "pic-runtime", " {false|true}", "link with pic runtime",
Bool (fn b => picRuntime := SOME b)),
(Expert, "polyvariance", " {true|false}", "use polyvariance",
Bool (fn b => if b then () else polyvariance := NONE)),
(Expert, "polyvariance-hofo", " {true|false}", "duplicate higher-order fns only",
Expand Down Expand Up @@ -1017,6 +1020,10 @@ fun commandLine (args: string list): unit =
Native.pic := (case !explicitNativePIC of
NONE => positionIndependent
| SOME b => b)
val picRuntime =
case !picRuntime of
NONE => positionIndependent
| SOME b => b

val stop = !stop

Expand Down Expand Up @@ -1097,7 +1104,7 @@ fun commandLine (args: string list): unit =
if b then s ^ "-" ^ suf else s
in
val addDBG = mk (!debugRuntime, "dbg")
val addPIC = mk (positionIndependent, "pic")
val addPIC = mk (picRuntime, "pic")
end
fun addTargetOpts opts =
List.fold
Expand Down

0 comments on commit daa5eb3

Please sign in to comment.