<br><br><div class="gmail_quote">On Fri, Sep 7, 2012 at 11:57 PM, Daniel Dunbar <span dir="ltr"><<a href="mailto:daniel@zuster.org" target="_blank">daniel@zuster.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Author: ddunbar<br>
Date: Fri Sep 7 14:57:23 2012<br>
New Revision: 163412<br>
<br>
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=163412&view=rev" target="_blank">http://llvm.org/viewvc/llvm-project?rev=163412&view=rev</a><br>
Log:<br>
build: Add support for building dylibs.<br>
<br>
Modified:<br>
compiler-rt/trunk/Makefile<br>
compiler-rt/trunk/make/<a href="http://lib_info.mk" target="_blank">lib_info.mk</a><br>
compiler-rt/trunk/make/<a href="http://options.mk" target="_blank">options.mk</a><br>
<br>
Modified: compiler-rt/trunk/Makefile<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/Makefile?rev=163412&r1=163411&r2=163412&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/Makefile?rev=163412&r1=163411&r2=163412&view=diff</a><br>
==============================================================================<br>
--- compiler-rt/trunk/Makefile (original)<br>
+++ compiler-rt/trunk/Makefile Fri Sep 7 14:57:23 2012<br>
@@ -117,7 +117,7 @@<br>
$(call Set,Tmp.ObjPath,$(ProjObjRoot)/$(Tmp.Name))<br>
<br>
# Top-Level Platform Target<br>
-$(Tmp.Name):: $(Tmp.Configs:%=$(Tmp.ObjPath)/%/libcompiler_rt.a)<br>
+$(Tmp.Name):: $(Tmp.Configs:%=$(Tmp.Name)-%)<br>
.PHONY: $(Tmp.Name)<br>
<br>
clean::<br>
@@ -131,6 +131,13 @@<br>
define PerPlatformConfig_template<br>
$(call Set,Tmp.Config,$(1))<br>
$(call Set,Tmp.ObjPath,$(ProjObjRoot)/$(Tmp.Name)/$(Tmp.Config))<br>
+$(call Set,Tmp.SHARED_LIBRARY,$(strip \<br>
+ $(call GetCNAVar,SHARED_LIBRARY,$(Tmp.Key),$(Tmp.Config),$(Tmp.Arch))))<br>
+<br>
+# Compute the library suffix.<br>
+$(if $(call streq,1,$(Tmp.SHARED_LIBRARY)),<br>
+ $(call Set,Tmp.LibrarySuffix,dylib),<br>
+ $(call Set,Tmp.LibrarySuffix,a))<br>
<br>
# Compute the archs to build, depending on whether this is a universal build or<br>
# not.<br>
@@ -142,8 +149,8 @@<br>
$(call VarOrDefault,$(Tmp.Key).Arch.$(Tmp.Config),$($(Tmp.Key).Arch))))<br>
<br>
# Copy or lipo to create the per-config library.<br>
-$(call Set,Tmp.Inputs,$(Tmp.ArchsToBuild:%=$(Tmp.ObjPath)/%/libcompiler_rt.a))<br>
-$(Tmp.ObjPath)/libcompiler_rt.a: $(Tmp.Inputs) $(Tmp.ObjPath)/.dir<br>
+$(call Set,Tmp.Inputs,$(Tmp.ArchsToBuild:%=$(Tmp.ObjPath)/%/libcompiler_rt.$(Tmp.LibrarySuffix)))<br>
+$(Tmp.ObjPath)/libcompiler_rt.$(Tmp.LibrarySuffix): $(Tmp.Inputs) $(Tmp.ObjPath)/.dir<br>
$(Summary) " FINAL-ARCHIVE: $(Tmp.Name)/$(Tmp.Config): $$@"<br>
-$(Verb) $(RM) $$@<br>
$(if $(call streq,1,$(words $(Tmp.ArchsToBuild))), \<br>
@@ -152,7 +159,7 @@<br>
.PRECIOUS: $(Tmp.ObjPath)/.dir<br>
<br>
# Per-Config Targets<br>
-$(Tmp.Name)-$(Tmp.Config):: $(Tmp.ObjPath)/libcompiler_rt.a<br>
+$(Tmp.Name)-$(Tmp.Config):: $(Tmp.ObjPath)/libcompiler_rt.$(Tmp.LibrarySuffix)<br>
.PHONY: $(Tmp.Name)-$(Tmp.Config)<br>
<br>
# Per-Config-Arch Libraries<br>
@@ -172,10 +179,21 @@<br>
$(call GetCNAVar,AR,$(Tmp.Key),$(Tmp.Config),$(Tmp.Arch))))<br>
$(call Set,Tmp.ARFLAGS,$(strip \<br>
$(call GetCNAVar,ARFLAGS,$(Tmp.Key),$(Tmp.Config),$(Tmp.Arch))))<br>
+$(call Set,Tmp.CC,$(strip \<br>
+ $(call GetCNAVar,CC,$(Tmp.Key),$(Tmp.Config),$(Tmp.Arch))))<br>
+$(call Set,Tmp.LDFLAGS,$(strip \<br>
+ $(call GetCNAVar,LDFLAGS,$(Tmp.Key),$(Tmp.Config),$(Tmp.Arch))))<br>
$(call Set,Tmp.RANLIB,$(strip \<br>
$(call GetCNAVar,RANLIB,$(Tmp.Key),$(Tmp.Config),$(Tmp.Arch))))<br>
$(call Set,Tmp.RANLIBFLAGS,$(strip \<br>
$(call GetCNAVar,RANLIBFLAGS,$(Tmp.Key),$(Tmp.Config),$(Tmp.Arch))))<br>
+$(call Set,Tmp.SHARED_LIBRARY,$(strip \<br>
+ $(call GetCNAVar,SHARED_LIBRARY,$(Tmp.Key),$(Tmp.Config),$(Tmp.Arch))))<br>
+<br>
+# Compute the library suffix.<br>
+$(if $(call streq,1,$(Tmp.SHARED_LIBRARY)),<br>
+ $(call Set,Tmp.LibrarySuffix,dylib),<br>
+ $(call Set,Tmp.LibrarySuffix,a))<br>
<br>
# Compute the object inputs for this library.<br>
$(call Set,Tmp.Inputs,\<br>
@@ -188,10 +206,14 @@<br>
-$(Verb) $(RM) $$@<br>
$(Verb) $(Tmp.AR) $(Tmp.ARFLAGS) $$@ $(Tmp.Inputs)<br>
$(Verb) $(Tmp.RANLIB) $(Tmp.RANLIBFLAGS) $$@<br>
+$(Tmp.ObjPath)/libcompiler_rt.dylib: $(Tmp.Inputs) $(Tmp.ObjPath)/.dir<br>
+ $(Summary) " DYLIB: $(Tmp.Name)/$(Tmp.Config)/$(Tmp.Arch): $$@"<br>
+ $(Verb) $(Tmp.CC) -arch $(Tmp.Arch) -dynamiclib -o $$@ \<br>
+ $(Tmp.Inputs) $(Tmp.LDFLAGS)<br>
.PRECIOUS: $(Tmp.ObjPath)/.dir<br>
<br>
# Per-Config-Arch Targets<br>
-$(Tmp.Name)-$(Tmp.Config)-$(Tmp.Arch):: $(Tmp.ObjPath)/libcompiler_rt.a<br>
+$(Tmp.Name)-$(Tmp.Config)-$(Tmp.Arch):: $(Tmp.ObjPath)/libcompiler_rt.$(Tmp.LibrarySuffix)<br>
.PHONY: $(Tmp.Name)-$(Tmp.Config)-$(Tmp.Arch)<br>
<br>
# Per-Config-Arch-SubDir Objects<br>
<br>
Modified: compiler-rt/trunk/make/<a href="http://lib_info.mk" target="_blank">lib_info.mk</a><br>
URL: <a href="http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/make/lib_info.mk?rev=163412&r1=163411&r2=163412&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/make/lib_info.mk?rev=163412&r1=163411&r2=163412&view=diff</a><br>
==============================================================================<br>
--- compiler-rt/trunk/make/<a href="http://lib_info.mk" target="_blank">lib_info.mk</a> (original)<br>
+++ compiler-rt/trunk/make/<a href="http://lib_info.mk" target="_blank">lib_info.mk</a> Fri Sep 7 14:57:23 2012<br>
@@ -53,8 +53,7 @@<br>
<br>
# The names of all the available options.<br>
AvailableOptions := AR ARFLAGS \<br>
- CC CFLAGS FUNCTIONS OPTIMIZED \<br>
+ CC CFLAGS LDFLAGS FUNCTIONS OPTIMIZED \<br>
RANLIB RANLIBFLAGS \<br>
- VISIBILITY_HIDDEN \<br>
- KERNEL_USE \<br>
- STRIP LIPO<br>
+ VISIBILITY_HIDDEN KERNEL_USE \<br>
+ SHARED_LIBRARY STRIP LIPO<br>
<br>
Modified: compiler-rt/trunk/make/<a href="http://options.mk" target="_blank">options.mk</a><br>
URL: <a href="http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/make/options.mk?rev=163412&r1=163411&r2=163412&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/make/options.mk?rev=163412&r1=163411&r2=163412&view=diff</a><br>
==============================================================================<br>
--- compiler-rt/trunk/make/<a href="http://options.mk" target="_blank">options.mk</a> (original)<br>
+++ compiler-rt/trunk/make/<a href="http://options.mk" target="_blank">options.mk</a> Fri Sep 7 14:57:23 2012<br>
@@ -23,11 +23,20 @@<br>
# default.<br>
VISIBILITY_HIDDEN := 0<br>
<br>
+# Whether the library is being built for kernel use.<br>
+KERNEL_USE := 0<br>
+<br>
+# Whether the library should be built as a shared object.<br>
+SHARED_LIBRARY := 0<br>
+<br>
# Miscellaneous tools.<br>
<br>
AR := ar<br>
# FIXME: Remove these pipes once ranlib errors are fixed.<br>
ARFLAGS := cru 2> /dev/null<br>
+<br>
+LDFLAGS :=<br>
+<br>
RANLIB := ranlib<br>
# FIXME: Remove these pipes once ranlib errors are fixed.<br>
RANLIBFLAGS := 2> /dev/null<br>
<br>
<br>
_______________________________________________<br>
llvm-commits mailing list<br>
<a href="mailto:llvm-commits@cs.uiuc.edu">llvm-commits@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits</a><br>
</blockquote></div><br><br>We get the following build error on our Mac 10.6 bot:<div><...><br><div><pre><span class="stdout" style="font-family:'Courier New',courier,monotype">DYLIB: clang_darwin/asan_osx_dynamic/i386: /Users/buildbot/src/llvm-buildbot/slave/mac10.6/build/llvm-build/tools/clang/runtime/compiler-rt/clang_darwin/asan_osx_dynamic/i386/libcompiler_rt.dylib
DYLIB: clang_darwin/asan_osx_dynamic/x86_64: /Users/buildbot/src/llvm-buildbot/slave/mac10.6/build/llvm-build/tools/clang/runtime/compiler-rt/clang_darwin/asan_osx_dynamic/x86_64/libcompiler_rt.dylib
ld: library not found for -lc++
clang: error: linker command failed with exit code 1 (use -v to see invocation)</span></pre>-- <br><div>Alexey Samsonov, MSK</div><br>
</div></div>