[MLton-user] A few questions

Vesa Karvonen vesa.a.j.k at gmail.com
Wed Dec 12 12:09:33 PST 2007


On Dec 12, 2007 8:03 PM, Vesa Karvonen <vesa.a.j.k at gmail.com> wrote:
> On Dec 12, 2007 5:20 PM, Matthew Fluet <fluet at tti-c.org> wrote:
> [...]
> > You might look into options that can be passed to gcc/as (that is, gcc
> > used as an assembler) or to gcc/ld (that is, gcc used as a linker).  A lot
> > of the assembly labels are local to the file being assembled, so perhaps
> > there is a way to instruct the assembler to strip local labels from the
> > object file.  Similarly, perhaps there is an option that can be passed to
> > the linker to instruct it to strip labels from the final executable.
[...]

Perhaps something like the below patch.

-Vesa Karvonen

Index: main/main.fun
===================================================================
--- main/main.fun	(revision 6257)
+++ main/main.fun	(working copy)
@@ -870,6 +870,7 @@
       val linkOpts =
          List.concat [[concat ["-L", !libTargetDir],
                        if !debugRuntime then "-lmlton-gdb" else "-lmlton"],
+                      if !debug then [] else ["-Xlinker", "--strip-all"],
                       addTargetOpts linkOpts]
       (* With gcc 3.4, the '-b <arch>' must be the first argument. *)
       val targetOpts =
@@ -1145,7 +1146,9 @@
                             List.concat
                             [targetOpts,
                              ["-c"],
-                             if !debug then [asDebug] else [],
+                             if !debug
+                                then [asDebug]
+                             else ["-Xassembler", "--strip-local-absolute"],
                              asOpts,
                              ["-o", output],
                              [input]])



More information about the MLton-user mailing list