[llvm-branch-commits] [llvm-branch] r195873 - Merging r195834:

Bill Wendling isanbard at gmail.com
Wed Nov 27 11:51:24 PST 2013


Author: void
Date: Wed Nov 27 13:51:24 2013
New Revision: 195873

URL: http://llvm.org/viewvc/llvm-project?rev=195873&view=rev
Log:
Merging r195834:
------------------------------------------------------------------------
r195834 | whitequark | 2013-11-27 03:03:18 -0800 (Wed, 27 Nov 2013) | 11 lines

[OCaml] Embed rpath into stub libraries and native executables

This commit embeds a set of linker flags with hardcoded paths to
the LLVM shared library on --enable-shared builds into .cmxa files
and stub dynamic libraries. This solution closely follows existing
rules for rpath in the LLVM tools, which had to be modified because
of differences in toolchain.

Without this patch, OCaml tests as well as opam bindings broke,
as neither of those updates LD_LIBRARY_PATH to include
the $prefix/lib directory.
------------------------------------------------------------------------

Modified:
    llvm/branches/release_34/   (props changed)
    llvm/branches/release_34/bindings/ocaml/Makefile.ocaml

Propchange: llvm/branches/release_34/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Wed Nov 27 13:51:24 2013
@@ -1,3 +1,3 @@
 /llvm/branches/Apple/Pertwee:110850,110961
 /llvm/branches/type-system-rewrite:133420-134817
-/llvm/trunk:155241,195092-195094,195100,195102-195103,195118,195129,195136,195138,195148,195152,195156-195157,195161-195162,195193,195272,195317-195318,195327,195330,195333,195339,195343,195355,195364,195379,195397-195399,195408,195421,195423-195424,195432,195439,195444,195455-195456,195469,195476-195477,195479,195491-195493,195514,195528,195547,195567,195573-195576,195591,195599,195632,195635-195636,195670,195679,195682,195684,195713,195716,195769,195773,195779,195782,195791,195798
+/llvm/trunk:155241,195092-195094,195100,195102-195103,195118,195129,195136,195138,195148,195152,195156-195157,195161-195162,195193,195272,195317-195318,195327,195330,195333,195339,195343,195355,195364,195379,195397-195399,195408,195421,195423-195424,195432,195439,195444,195455-195456,195469,195476-195477,195479,195491-195493,195514,195528,195547,195567,195573-195576,195591,195599,195632,195635-195636,195670,195679,195682,195684,195713,195716,195769,195773,195779,195782,195791,195798,195834

Modified: llvm/branches/release_34/bindings/ocaml/Makefile.ocaml
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/release_34/bindings/ocaml/Makefile.ocaml?rev=195873&r1=195872&r2=195873&view=diff
==============================================================================
--- llvm/branches/release_34/bindings/ocaml/Makefile.ocaml (original)
+++ llvm/branches/release_34/bindings/ocaml/Makefile.ocaml Wed Nov 27 13:51:24 2013
@@ -79,6 +79,15 @@ Compile.CMO  := $(strip $(OCAMLC) -c $(O
 Compile.CMX  := $(strip $(OCAMLOPT) -c $(OCAMLCFLAGS) $(OCAMLDEBUGFLAG) -o)
 
 ifdef OCAMLSTUBS
+# Avoid the need for LD_LIBRARY_PATH
+ifneq ($(HOST_OS), $(filter $(HOST_OS), Cygwin MingW))
+ifneq ($(HOST_OS),Darwin)
+OCAMLRPATH   := $(RPATH) -Wl,'$(SharedLibDir)'
+endif
+endif
+endif
+
+ifdef OCAMLSTUBS
 Archive.CMA  := $(strip $(OCAMLC) -a -dllib -l$(LIBRARYNAME) $(OCAMLDEBUGFLAG) \
                                   -o)
 else
@@ -88,8 +97,8 @@ endif
 
 ifdef OCAMLSTUBS
 Archive.CMXA := $(strip $(OCAMLOPT) -a $(patsubst %,-cclib %, \
-                                    $(LLVMLibsOptions) -l$(LIBRARYNAME)) \
-                                    -cclib -L$(SharedLibDir) \
+                                    $(LLVMLibsOptions) -l$(LIBRARYNAME) \
+                                    -L$(SharedLibDir) $(OCAMLRPATH))
                                     $(OCAMLDEBUGFLAG) -o)
 else
 Archive.CMXA := $(strip $(OCAMLOPT) -a $(OCAMLAFLAGS) $(OCAMLDEBUGFLAG) -o)
@@ -234,7 +243,7 @@ uninstall-local:: uninstall-shared
 
 $(SharedLib): $(ObjectsO) $(OcamlDir)/.dir
 	$(Echo) "Building $(BuildMode) $(notdir $@)"
-	$(Verb) $(Link) $(SharedLinkOptions) $(LLVMLibsOptions) \
+	$(Verb) $(Link) $(SharedLinkOptions) $(OCAMLRPATH) $(LLVMLibsOptions) \
 			-o $@ $(ObjectsO)
 
 clean-shared::





More information about the llvm-branch-commits mailing list