Skip to content

Commit

Permalink
MPR#7679: make sure .a files are erased before calling ar rc (#1494)
Browse files Browse the repository at this point in the history
Otherwise leftover .a files from an earlier compilation may contain
unwanted modules, as shown in MPR#7679.

However, ocamlmklib always erases the destination .a file before
calling the `mkdll` function defined in `#ml` blocks of the
configuration makefile.  Hence there is no need for a `rm` (or `del`)
shell command in `mklib`.

Finally, in the config/Makefile.mingw* files, we can safely assume
"ar" supports the "s" option because this is "ar" from the GNU
binutils, so no need to call ranlib.
  • Loading branch information
xavierleroy committed Nov 30, 2017
1 parent 282d8c4 commit 13785c9
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 8 deletions.
4 changes: 4 additions & 0 deletions Changes
Expand Up @@ -58,6 +58,10 @@ Working version

### Compiler distribution build system

- MPR#7679: make sure .a files are erased before calling ar rc, otherwise
leftover .a files from an earlier compilation may contain unwanted modules
(Xavier Leroy)

### Internal/compiler-libs changes:

### Bug fixes
Expand Down
6 changes: 3 additions & 3 deletions config/Makefile.mingw
Expand Up @@ -156,10 +156,10 @@ MKEXE_BOOT=$(CC) $(CFLAGS) $(LDFLAGS) $(OUTPUTEXE)$(1) $(2)
MKEXE_ANSI=$(FLEXLINK) -exe

### How to build a static library
MKLIB=rm -f $(1); $(TOOLPREF)ar rc $(1) $(2); $(RANLIB) $(1)
MKLIB=rm -f $(1) && $(TOOLPREF)ar rcs $(1) $(2)
#ml let mklib out files opts =
#ml Printf.sprintf "rm -f %s && %sar rcs %s %s %s"
#ml out toolpref opts out files;;
#ml Printf.sprintf "%sar rcs %s %s %s"
#ml toolpref opts out files;;

### Canonicalize the name of a system library
SYSLIB=-l$(1)
Expand Down
6 changes: 3 additions & 3 deletions config/Makefile.mingw64
Expand Up @@ -156,10 +156,10 @@ MKEXE_BOOT=$(CC) $(CFLAGS) $(LDFLAGS) $(OUTPUTEXE)$(1) $(2)
MKEXE_ANSI=$(FLEXLINK) -exe

### How to build a static library
MKLIB=rm -f $(1); $(TOOLPREF)ar rc $(1) $(2); $(RANLIB) $(1)
MKLIB=rm -f $(1) && $(TOOLPREF)ar rcs $(1) $(2)
#ml let mklib out files opts =
#ml Printf.sprintf "rm -f %s && %sar rcs %s %s %s"
#ml out toolpref opts out files;;
#ml Printf.sprintf "%sar rcs %s %s %s"
#ml toolpref opts out files;;

### Canonicalize the name of a system library
SYSLIB=-l$(1)
Expand Down
4 changes: 2 additions & 2 deletions configure
Expand Up @@ -2057,9 +2057,9 @@ SYSLIB=-l\$(1)
#ml let syslib x = "-l"^x;;
### How to build a static library
MKLIB=${TOOLPREF}ar rc \$(1) \$(2); ${TOOLPREF}ranlib \$(1)
MKLIB=rm -f \$(1) && ${TOOLPREF}ar rc \$(1) \$(2) && ${TOOLPREF}ranlib \$(1)
#ml let mklib out files opts = (* "" *)
#ml Printf.sprintf "${TOOLPREF}ar rc %s %s %s; ${TOOLPREF}ranlib %s"
#ml Printf.sprintf "${TOOLPREF}ar rc %s %s %s && ${TOOLPREF}ranlib %s"
#ml out opts files out;;
EOF
config ARCH "$arch"
Expand Down

0 comments on commit 13785c9

Please sign in to comment.