MPR#7679: make sure `.a` files are erased before calling `ar rc` (#1494)

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.
master
Xavier Leroy 2017-11-30 11:25:17 +01:00 committed by GitHub
parent 282d8c49ae
commit 13785c9276
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 12 additions and 8 deletions

View File

@ -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

View File

@ -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)

View File

@ -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)

4
configure vendored
View File

@ -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"