mirror of
https://github.com/xen-project/xen.git
synced 2026-10-28 02:01:24 +01:00
tools/ocaml: Specify rpath correctly for ocamlmklib
ocamlmklib has special handling for C-like '-Wl,-rpath' option, but does
not know how to handle '-Wl,-rpath-link', as evidenced by warnings like:
"Unknown option
-Wl,-rpath-link=$HOME/xen/tools/ocaml/libs/eventchn/../../../../tools/libs/toollog"
Pass this option directly to the compiler with -ccopt instead.
Also pass -L directly to the linker with -ldopt. This prevents embedding absolute
paths from buildtime into binary's RPATH.
Fixes: f7b4e4558b ("tools/ocaml: Fix OCaml libs rules")
Reported-by: Fernando Rodrigues <alpha@sigmasquadron.net>
Tested-by: Fernando Rodrigues <alpha@sigmasquadron.net>
Signed-off-by: Andrii Sultanov <andrii.sultanov@cloud.com>
Acked-by: Christian Lindig <christian.lindig@cloud.com>
This commit is contained in:
1 parent
13df44f8a1
commit
bf8a209915
1 file changed
+2
-2
@@ -63,7 +63,7 @@ mk-caml-lib-bytecode = $(call quiet-command, $(OCAMLC) $(OCAMLCFLAGS) -a -o $1 $
|
||||
|
||||
mk-caml-stubs = $(call quiet-command, $(OCAMLMKLIB) -o `basename $1 .a` $2,MKLIB,$1)
|
||||
mk-caml-lib-stubs = \
|
||||
$(call quiet-command, $(OCAMLMKLIB) -o `basename $1 .a | sed -e 's/^lib//'` $2 $3,MKLIB,$1)
|
||||
$(call quiet-command, $(OCAMLMKLIB) -o `basename $1 .a | sed -e 's/^lib//'` $2 `echo $3 | sed -e 's/-ccopt -l/-l/g' | sed -e 's/-ccopt -L/-ldopt -L/g'`,MKLIB,$1)
|
||||
|
||||
# define a library target <name>.cmxa and <name>.cma
|
||||
define OCAML_LIBRARY_template
|
||||
@@ -74,7 +74,7 @@ define OCAML_LIBRARY_template
|
||||
$(1)_stubs.a: $(foreach obj,$$($(1)_C_OBJS),$(obj).o)
|
||||
$(call mk-caml-stubs,$$@, $$+)
|
||||
lib$(1)_stubs.a: $(foreach obj,$($(1)_C_OBJS),$(obj).o)
|
||||
$(call mk-caml-lib-stubs,$$@, $$+, $(foreach lib,$(LIBS_$(1)),$(lib)))
|
||||
$(call mk-caml-lib-stubs,$$@, $$+, $(foreach lib,$(LIBS_$(1)),-ccopt $(lib)))
|
||||
endef
|
||||
|
||||
# Dynamically linked OCaml libraries ("plugins" in Dynlink parlance)
|
||||
|
||||