From 658440a2392f27215fca6615b20a6065b0812bc0 Mon Sep 17 00:00:00 2001 From: Marshall Roch Date: Tue, 26 Apr 2022 13:05:29 -0400 Subject: [PATCH 1/2] pass LDFLAGS to ocamlmklib via -ldopt `ocamlmklib` supports some but not all linker flags. we have some `LDFLAGS` that are not supported by `ocamlmklib`, so they need to be passed via `-ldopt`. this PR prepends `-ldopt` to each word in `LIBS` (which is set to `LDFLAGS` in ./configure). --- project.mak | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/project.mak b/project.mak index 82a5aba..fe6dc67 100644 --- a/project.mak +++ b/project.mak @@ -52,6 +52,7 @@ endif DEBUG = -g OCAMLFLAGS += $(DEBUG) -I +compiler-libs OCAMLOPTFLAGS += $(DEBUG) -I +compiler-libs +LDFLAGS = $(foreach flag, $(LIBS), -ldopt $(flag)) ifeq ($(HASDYNLINK),yes) TOBUILD += zarith.cmxs @@ -71,16 +72,16 @@ tests: make -C tests test zarith.cma: $(MLSRC:%.ml=%.cmo) - $(OCAMLMKLIB) $(DEBUG) -failsafe -o zarith $+ $(LIBS) + $(OCAMLMKLIB) $(DEBUG) -failsafe -o zarith $+ $(LDFLAGS) zarith.cmxa: $(MLSRC:%.ml=%.cmx) - $(OCAMLMKLIB) $(DEBUG) -failsafe -o zarith $+ $(LIBS) + $(OCAMLMKLIB) $(DEBUG) -failsafe -o zarith $+ $(LDFLAGS) zarith.cmxs: zarith.cmxa libzarith.$(LIBSUFFIX) $(OCAMLOPT) -shared -o $@ -I . zarith.cmxa -linkall libzarith.$(LIBSUFFIX): $(CSRC:%.c=%.$(OBJSUFFIX)) - $(OCAMLMKLIB) $(DEBUG) -failsafe -o zarith $+ $(LIBS) + $(OCAMLMKLIB) $(DEBUG) -failsafe -o zarith $+ $(LDFLAGS) zarith_top.cma: zarith_top.cmo $(OCAMLC) $(DEBUG) -o $@ -a $< From 7b1dda4d92e26e91f0dbc901fa54603cf872376b Mon Sep 17 00:00:00 2001 From: Marshall Roch Date: Tue, 3 May 2022 16:32:19 -0400 Subject: [PATCH 2/2] use single quoted -ldopt --- project.mak | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/project.mak b/project.mak index fe6dc67..e857946 100644 --- a/project.mak +++ b/project.mak @@ -52,7 +52,6 @@ endif DEBUG = -g OCAMLFLAGS += $(DEBUG) -I +compiler-libs OCAMLOPTFLAGS += $(DEBUG) -I +compiler-libs -LDFLAGS = $(foreach flag, $(LIBS), -ldopt $(flag)) ifeq ($(HASDYNLINK),yes) TOBUILD += zarith.cmxs @@ -72,16 +71,16 @@ tests: make -C tests test zarith.cma: $(MLSRC:%.ml=%.cmo) - $(OCAMLMKLIB) $(DEBUG) -failsafe -o zarith $+ $(LDFLAGS) + $(OCAMLMKLIB) $(DEBUG) -failsafe -o zarith $+ -ldopt "$(LIBS)" zarith.cmxa: $(MLSRC:%.ml=%.cmx) - $(OCAMLMKLIB) $(DEBUG) -failsafe -o zarith $+ $(LDFLAGS) + $(OCAMLMKLIB) $(DEBUG) -failsafe -o zarith $+ -ldopt "$(LIBS)" zarith.cmxs: zarith.cmxa libzarith.$(LIBSUFFIX) $(OCAMLOPT) -shared -o $@ -I . zarith.cmxa -linkall libzarith.$(LIBSUFFIX): $(CSRC:%.c=%.$(OBJSUFFIX)) - $(OCAMLMKLIB) $(DEBUG) -failsafe -o zarith $+ $(LDFLAGS) + $(OCAMLMKLIB) $(DEBUG) -failsafe -o zarith $+ -ldopt "$(LIBS)" zarith_top.cma: zarith_top.cmo $(OCAMLC) $(DEBUG) -o $@ -a $<