From: Andrii Sultanov Date: Mon, 16 Dec 2024 12:33:17 +0000 (+0100) Subject: tools/ocaml: Specify rpath correctly for ocamlmklib X-Git-Tag: RELEASE-4.19.2~78 X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=fbe3ec72dc0d6ecf4007fdb6eff821cc7570e9ca;p=xen.git 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: f7b4e4558b42 ("tools/ocaml: Fix OCaml libs rules") Reported-by: Fernando Rodrigues Tested-by: Fernando Rodrigues Signed-off-by: Andrii Sultanov Acked-by: Christian Lindig master commit: bf8a209915804088c09ac6575bcca554450fa7e8 master date: 2024-12-11 10:45:08 +0000 --- diff --git a/tools/ocaml/Makefile.rules b/tools/ocaml/Makefile.rules index 5638193edf..678bbc046f 100644 --- a/tools/ocaml/Makefile.rules +++ b/tools/ocaml/Makefile.rules @@ -61,7 +61,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 .cmxa and .cma define OCAML_LIBRARY_template @@ -72,7 +72,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 define OCAML_NOC_LIBRARY_template