summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Changes6
-rw-r--r--Makefile1
-rw-r--r--Makefile.nt1
-rw-r--r--asmrun/Makefile15
-rw-r--r--config/Makefile-templ4
-rw-r--r--config/Makefile.mingw2
-rw-r--r--config/Makefile.mingw642
-rw-r--r--config/Makefile.msvc2
-rw-r--r--config/Makefile.msvc642
-rwxr-xr-xconfigure36
-rw-r--r--driver/optmain.ml2
-rw-r--r--stdlib/Makefile14
-rw-r--r--utils/config.mli3
-rw-r--r--utils/config.mlp2
14 files changed, 55 insertions, 37 deletions
diff --git a/Changes b/Changes
index a847f03350..6aacff64ea 100644
--- a/Changes
+++ b/Changes
@@ -35,6 +35,12 @@ Next version (4.05.0):
compiler when called to compile third-party C source files
(Sébastien Hinderer)
+* GPR#933: ocamlopt -p now reports an error on platforms that do not
+ support profiling with gprof; dummy profiling libraries are no longer
+ installed on such platforms.
+ This can be tested with ocamlopt -config
+ (Sébastien Hinderer)
+
### Standard library:
- PR#6975, GPR#902: Truncate function added to stdlib Buffer module
diff --git a/Makefile b/Makefile
index 39659bf511..88b31359d0 100644
--- a/Makefile
+++ b/Makefile
@@ -438,6 +438,7 @@ utils/config.ml: utils/config.mlp config/Makefile
-e 's|%%HOST%%|$(HOST)|' \
-e 's|%%TARGET%%|$(TARGET)|' \
-e 's|%%FLAMBDA%%|$(FLAMBDA)|' \
+ -e 's|%%PROFILING%%|$(PROFILING)|' \
-e 's|%%SAFE_STRING%%|$(SAFE_STRING)|' \
utils/config.mlp > utils/config.ml
diff --git a/Makefile.nt b/Makefile.nt
index 8911f77d88..1e930c17dc 100644
--- a/Makefile.nt
+++ b/Makefile.nt
@@ -406,6 +406,7 @@ utils/config.ml: utils/config.mlp config/Makefile
-e 's|%%CC_PROFILE%%||' \
-e 's|%%HOST%%|$(HOST)|' \
-e 's|%%TARGET%%|$(TARGET)|' \
+ -e 's|%%PROFILING%%|$(PROFILING)|' \
-e 's|%%FLAMBDA%%|$(FLAMBDA)|' \
-e 's|%%SAFE_STRING%%|$(SAFE_STRING)|' \
-e 's|%%FLEXLINK_FLAGS%%|$(FLEXLINK_FLAGS)|' \
diff --git a/asmrun/Makefile b/asmrun/Makefile
index a5d85b7d5f..bb7c1636f0 100644
--- a/asmrun/Makefile
+++ b/asmrun/Makefile
@@ -36,7 +36,13 @@ IOBJS=$(COBJS:.o=.i.o) $(ASMOBJS)
POBJS=$(COBJS:.o=.p.o) $(ASMOBJS:.o=.p.o)
PICOBJS=$(COBJS:.o=.pic.o) $(ASMOBJS:.o=.pic.o)
-all: libasmrun.a all-$(RUNTIMED) all-$(PROFILING) all-$(SHARED)
+ifeq "$(PROFILING)" "true"
+PROFILINGTARGET = prof
+else
+PROFILINGTARGET = noprof
+endif
+
+all: libasmrun.a all-$(RUNTIMED) all-$(PROFILINGTARGET) all-$(SHARED)
ifeq "$(RUNTIMEI)" "true"
all: libasmruni.a
@@ -103,14 +109,9 @@ install::
cd $(INSTALL_LIBDIR); $(RANLIB) libasmruni.a
endif
-ifeq "$(PROFILING)" "prof"
+ifeq "$(PROFILING)" "true"
install::
cp libasmrunp.a $(INSTALL_LIBDIR)/libasmrunp.a
- cd $(INSTALL_LIBDIR); $(RANLIB) libasmrunp.a
-else
-install::
- rm -f $(INSTALL_LIBDIR)/libasmrunp.a
- ln -s libasmrun.a $(INSTALL_LIBDIR)/libasmrunp.a
endif
ifeq "$(SHARED)" "shared"
diff --git a/config/Makefile-templ b/config/Makefile-templ
index 1cd797eb26..7e6ed685da 100644
--- a/config/Makefile-templ
+++ b/config/Makefile-templ
@@ -166,9 +166,9 @@ RANLIBCMD=ranlib
### Whether profiling with gprof is supported
# If yes: (e.g. x86/Linux, Sparc/Solaris):
-#PROFILING=prof
+#PROFILING=true
# If no:
-#PROFILING=noprof
+#PROFILING=false
### Option to give to the C compiler for profiling
#CC_PROFILE=-pg
diff --git a/config/Makefile.mingw b/config/Makefile.mingw
index 0abc598b8a..1918a4c9ff 100644
--- a/config/Makefile.mingw
+++ b/config/Makefile.mingw
@@ -75,7 +75,7 @@ NATIVECCRPATH=
ASM=$(TOOLPREF)as
ASPP=$(TOOLPREF)gcc -c
ASPPPROFFLAGS=
-PROFILING=noprof
+PROFILING=false
DYNLINKOPTS=
CC_PROFILE=
SYSTHREAD_SUPPORT=true
diff --git a/config/Makefile.mingw64 b/config/Makefile.mingw64
index 0ff2c77d1a..795f80983d 100644
--- a/config/Makefile.mingw64
+++ b/config/Makefile.mingw64
@@ -75,7 +75,7 @@ NATIVECCRPATH=
ASM=$(TOOLPREF)as
ASPP=$(TOOLPREF)gcc -c
ASPPPROFFLAGS=
-PROFILING=noprof
+PROFILING=false
DYNLINKOPTS=
CC_PROFILE=
SYSTHREAD_SUPPORT=true
diff --git a/config/Makefile.msvc b/config/Makefile.msvc
index df9308edc3..4d98fb1764 100644
--- a/config/Makefile.msvc
+++ b/config/Makefile.msvc
@@ -69,7 +69,7 @@ NATIVECCRPATH=
ASM=ml -nologo -coff -Cp -c -Fo
ASPP=
ASPPPROFFLAGS=
-PROFILING=noprof
+PROFILING=false
DYNLINKOPTS=
CC_PROFILE=
SYSTHREAD_SUPPORT=true
diff --git a/config/Makefile.msvc64 b/config/Makefile.msvc64
index ad0d84723a..893bbc4876 100644
--- a/config/Makefile.msvc64
+++ b/config/Makefile.msvc64
@@ -69,7 +69,7 @@ NATIVECCRPATH=
ASM=ml64 -nologo -Cp -c -Fo
ASPP=
ASPPPROFFLAGS=
-PROFILING=noprof
+PROFILING=false
DYNLINKOPTS=
CC_PROFILE=
SYSTHREAD_SUPPORT=true
diff --git a/configure b/configure
index 8a34ca8d4e..80e5f8b436 100755
--- a/configure
+++ b/configure
@@ -1023,25 +1023,25 @@ if test -n "$asppoption"; then aspp="$asppoption"; fi
cc_profile='-pg'
case "$arch,$system" in
- i386,linux_elf) profiling='prof';;
- i386,gnu) profiling='prof';;
- i386,bsd_elf) profiling='prof';;
- amd64,macosx) profiling='prof';;
- i386,macosx) profiling='prof';;
- sparc,bsd) profiling='prof';;
+ i386,linux_elf) profiling='true';;
+ i386,gnu) profiling='true';;
+ i386,bsd_elf) profiling='true';;
+ amd64,macosx) profiling='true';;
+ i386,macosx) profiling='true';;
+ sparc,bsd) profiling='true';;
sparc,solaris)
- profiling='prof'
+ profiling='true'
case "$nativecc" in gcc*) ;; *) cc_profile='-xpg';; esac;;
- amd64,linux) profiling='prof';;
- amd64,openbsd) profiling='prof';;
- amd64,freebsd) profiling='prof';;
- amd64,netbsd) profiling='prof';;
- arm,netbsd) profiling='prof';;
- amd64,gnu) profiling='prof';;
- arm,linux*) profiling='prof';;
- power,elf) profiling='prof';;
- power,bsd*) profiling='prof';;
- *) profiling='noprof';;
+ amd64,linux) profiling='true';;
+ amd64,openbsd) profiling='true';;
+ amd64,freebsd) profiling='true';;
+ amd64,netbsd) profiling='true';;
+ arm,netbsd) profiling='true';;
+ amd64,gnu) profiling='true';;
+ arm,linux*) profiling='true';;
+ power,elf) profiling='true';;
+ power,bsd*) profiling='true';;
+ *) profiling='false';;
esac
# Where is ranlib?
@@ -2143,7 +2143,7 @@ else
inf " compile with -fPIC........ no"
fi
inf " native dynlink ........... $natdynlink"
- if test "$profiling" = "prof"; then
+ if $profiling; then
inf " profiling with gprof ..... supported"
else
inf " profiling with gprof ..... not supported"
diff --git a/driver/optmain.ml b/driver/optmain.ml
index b3f662c70e..c069cb4f8e 100644
--- a/driver/optmain.ml
+++ b/driver/optmain.ml
@@ -293,6 +293,8 @@ let main () =
try
readenv ppf Before_args;
Arg.parse_expand (Arch.command_line_options @ Options.list) anonymous usage;
+ if !gprofile && not profiling then
+ fatal "Profiling with \"gprof\" is not supported on this platform.";
if !output_name <> None && !compile_only &&
List.length !process_thunks > 1 then
fatal "Options -c -o are incompatible with compiling multiple files";
diff --git a/stdlib/Makefile b/stdlib/Makefile
index 1660e27034..3ad984be9c 100644
--- a/stdlib/Makefile
+++ b/stdlib/Makefile
@@ -61,8 +61,14 @@ ifeq "$(RUNTIMEI)" "true"
all: camlheaderi
endif
+ifeq "$(PROFILING)" "true"
+PROFILINGTARGET = prof
+else
+PROFILINGTARGET = noprof
+endif
+
.PHONY: allopt
-allopt: stdlib.cmxa std_exit.cmx allopt-$(PROFILING)
+allopt: stdlib.cmxa std_exit.cmx allopt-$(PROFILINGTARGET)
.PHONY: allopt-noprof
allopt-noprof:
@@ -91,7 +97,7 @@ install::
endif
.PHONY: installopt
-installopt: installopt-default installopt-$(PROFILING)
+installopt: installopt-default installopt-$(PROFILINGTARGET)
.PHONY: installopt-default
installopt-default:
@@ -100,10 +106,6 @@ installopt-default:
.PHONY: installopt-noprof
installopt-noprof:
- ln -sf stdlib.cmxa "$(INSTALL_LIBDIR)/stdlib.p.cmxa"
- ln -sf stdlib.$(A) "$(INSTALL_LIBDIR)/stdlib.p.$(A)"
- ln -sf std_exit.cmx "$(INSTALL_LIBDIR)/std_exit.p.cmx"
- ln -sf std_exit.$(O) "$(INSTALL_LIBDIR)/std_exit.p.$(O)"
.PHONY: installopt-prof
installopt-prof:
diff --git a/utils/config.mli b/utils/config.mli
index ee311f149e..28a9850d77 100644
--- a/utils/config.mli
+++ b/utils/config.mli
@@ -136,6 +136,9 @@ val target : string
val print_config : out_channel -> unit;;
+val profiling : bool
+ (* Whether profiling with gprof is supported on this platform *)
+
val flambda : bool
(* Whether the compiler was configured for flambda *)
diff --git a/utils/config.mlp b/utils/config.mlp
index da788715e8..36cde144cc 100644
--- a/utils/config.mlp
+++ b/utils/config.mlp
@@ -57,6 +57,7 @@ let mkdll, mkexe, mkmaindll =
else
"%%MKDLL%%", "%%MKEXE%%", "%%MKMAINDLL%%"
+let profiling = %%PROFILING%%
let flambda = %%FLAMBDA%%
let safe_string = %%SAFE_STRING%%
@@ -152,6 +153,7 @@ let print_config oc =
p_bool "systhread_supported" systhread_supported;
p "host" host;
p "target" target;
+ p_bool "profiling" profiling;
p_bool "flambda" flambda;
p_bool "spacetime" spacetime;