[MLton-devel] cvs commit: command line checking linker args
Stephen Weeks
sweeks@users.sourceforge.net
Tue, 15 Jul 2003 17:44:05 -0700
sweeks 03/07/15 17:44:05
Modified: doc changelog
doc/user-guide man-page.tex
man mlton.1
mlton/main main.sml
Log:
mlton now checks the command line arguments following the file to
compile that are passed to the linker to make sure they are
reasonable. For now, it makes sure the linker args are of the form
*.a, *.o, -l*, or -L*. Did I miss any cases?
Revision Changes Path
1.59 +3 -0 mlton/doc/changelog
Index: changelog
===================================================================
RCS file: /cvsroot/mlton/mlton/doc/changelog,v
retrieving revision 1.58
retrieving revision 1.59
diff -u -r1.58 -r1.59
--- changelog 15 Jul 2003 17:28:42 -0000 1.58
+++ changelog 16 Jul 2003 00:44:05 -0000 1.59
@@ -4,6 +4,9 @@
- Fixed bug that caused a segfault when attempting to create an
array that was too large, e.g
1 + Array.sub (Array.tabulate (valOf Int.maxInt, fn i => i), 0)
+ - mlton now checks the command line arguments following the file to
+ compile that are passed to the linker to make sure they are
+ reasonable.
* 2003-07-14
- Fixed packaging for Cygwin and Sparc to include libgmp.a.
1.36 +12 -9 mlton/doc/user-guide/man-page.tex
Index: man-page.tex
===================================================================
RCS file: /cvsroot/mlton/mlton/doc/user-guide/man-page.tex,v
retrieving revision 1.35
retrieving revision 1.36
diff -u -r1.35 -r1.36
--- man-page.tex 8 Jul 2003 19:48:52 -0000 1.35
+++ man-page.tex 16 Jul 2003 00:44:05 -0000 1.36
@@ -1,16 +1,19 @@
\sec{Manual page}{manual-page}
-{\mlton} is run from the command line with a collection of options followed by a
-file name and a list of files to assemble and libraries to link with.
+{\mlton} is run from the command line with a collection of options
+followed by a file name and a list of files to assemble and to link
+with.
\begin{verbatim}
-mlton [option ...] file.{cm|sml|c|o} [file.{S|o} ...] [library ...]
+mlton [option ...] file.{cm|sml|c|o} [file.{S|o} ...] [linker arg ...]
\end{verbatim}
-The simplest case is to run {\tt mlton foo.sml}, where {\tt foo.sml} contains a
-valid SML program, in which case {\mlton} compiles the program to produce an
-executable called {\tt foo}. Since {\mlton} has no notion of separate
-compilation, the program must be the entire program you wish to
-compile. However, the program may refer to signatures and structures
-defined in the SML basis library.
+The simplest case is to run {\tt mlton foo.sml}, where {\tt foo.sml}
+contains a valid SML program, in which case {\mlton} compiles the
+program to produce an executable called {\tt foo}. Since {\mlton} has
+no notion of separate compilation, the program must be the entire
+program you wish to compile. However, the program may refer to
+signatures and structures defined in the SML basis library.
+The linker arguments are passed unchanged to the linker, and must have
+a suffix of {\tt .a} or {\tt .o} or a prefix of {\tt -l} or {\tt -L}.
For developing large programs spanning many files, {\mlton} supports a limited
subset of SML/NJ Compilation Manager (CM) files. For example, {\tt mlton
1.32 +4 -2 mlton/man/mlton.1
Index: mlton.1
===================================================================
RCS file: /cvsroot/mlton/mlton/man/mlton.1,v
retrieving revision 1.31
retrieving revision 1.32
diff -u -r1.31 -r1.32
--- mlton.1 8 Jul 2003 19:48:53 -0000 1.31
+++ mlton.1 16 Jul 2003 00:44:05 -0000 1.32
@@ -1,10 +1,10 @@
-.TH mlton 1 "July 8, 2003"
+.TH mlton 1 "July 15, 2003"
.SH NAME
\fBmlton\fP \- whole-program compiler for the Standard ML (SML) programming
language
.SH SYNOPSIS
\fBmlton\fP \fI[option ...] file\fB.\fP{\fBcm\fP|\fBsml\fP|\fBc\fP|\fBo\fP}
-[file\fB.\fP{\fBS\fP|\fBo\fP} ...] [library ...]\fR
+[file\fB.\fP{\fBS\fP|\fBo\fP} ...] [linker arg ...]\fR
.SH DESCRIPTION
.PP
Typical use of \fBMLton\fP is \fBmlton \fIxxx\fB.sml\fR, which will
@@ -12,6 +12,8 @@
\fBMLton\fP has no notion of separate compilation.
The program must be the entire program you wish to compile; however, it may
refer to signatures and structures defined in the SML basis library.
+The linker arguments are passed unchanged to the linker, and must have
+a suffix of \fB.a\fP or \fB.o\fP or a prefix of \fB-l\fP or \fB-L\fP.
\fBMLton\fP's options allow you to control the name of the output
file, the verbosity of compile-time messages, and whether or not
1.144 +12 -0 mlton/mlton/main/main.sml
Index: main.sml
===================================================================
RCS file: /cvsroot/mlton/mlton/mlton/main/main.sml,v
retrieving revision 1.143
retrieving revision 1.144
diff -u -r1.143 -r1.144
--- main.sml 16 Jul 2003 00:27:06 -0000 1.143
+++ main.sml 16 Jul 2003 00:44:05 -0000 1.144
@@ -548,6 +548,18 @@
([".c", ".o", ".s", ".S"], fn suffix =>
String.isSuffix {string = s,
suffix = suffix}))
+ val _ =
+ case List.peek (rest, fn s =>
+ not
+ (List.exists ([".a", ".o"], fn suffix =>
+ String.isSuffix {string = s,
+ suffix = suffix})
+ orelse
+ List.exists (["-l", "-L"], fn prefix =>
+ String.isPrefix {prefix = prefix,
+ string = s}))) of
+ NONE => ()
+ | SOME s => usage (concat ["invalid linker argument: ", s])
val stop = !stop
in
case Place.compare (start, stop) of
-------------------------------------------------------
This SF.net email is sponsored by: VM Ware
With VMware you can run multiple operating systems on a single machine.
WITHOUT REBOOTING! Mix Linux / Windows / Novell virtual machines at the
same time. Free trial click here: http://www.vmware.com/wl/offer/345/0
_______________________________________________
MLton-devel mailing list
MLton-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mlton-devel