diff options
author | Daniel Dunbar <daniel@zuster.org> | 2010-01-18 22:19:34 +0000 |
---|---|---|
committer | Daniel Dunbar <daniel@zuster.org> | 2010-01-18 22:19:34 +0000 |
commit | f665b32a708a731976bd95fbb2800e8c47636e81 (patch) | |
tree | 8591e0f558e90d4d2b6c02a44b8f0806f3ce628a /compiler-rt | |
parent | 64a198d0602e0a9dd8add5d47f96ec9e928f2a25 (diff) | |
download | bcm5719-llvm-f665b32a708a731976bd95fbb2800e8c47636e81.tar.gz bcm5719-llvm-f665b32a708a731976bd95fbb2800e8c47636e81.zip |
Add a VISIBILITY_HIDDEN option, which can be used to make all compiler-rt function definitions hidden/private extern.
llvm-svn: 93790
Diffstat (limited to 'compiler-rt')
-rw-r--r-- | compiler-rt/Makefile | 11 | ||||
-rw-r--r-- | compiler-rt/lib/assembly.h | 7 | ||||
-rw-r--r-- | compiler-rt/make/lib_info.mk | 3 | ||||
-rw-r--r-- | compiler-rt/make/options.mk | 8 | ||||
-rw-r--r-- | compiler-rt/make/platform/darwin_bni.mk | 1 | ||||
-rw-r--r-- | compiler-rt/make/platform/darwin_fat.mk | 2 | ||||
-rw-r--r-- | compiler-rt/make/platform/multi_arch.mk | 2 |
7 files changed, 27 insertions, 7 deletions
diff --git a/compiler-rt/Makefile b/compiler-rt/Makefile index 5a6f01745a8..79149e32529 100644 --- a/compiler-rt/Makefile +++ b/compiler-rt/Makefile @@ -205,19 +205,20 @@ $(call Set,Tmp.Dependencies,$($(Tmp.SubDirKey).Dependencies)) $(call Set,Tmp.CC,$(strip \ $(call GetCNAVar,CC,$(Tmp.Key),$(Tmp.Config),$(Tmp.Arch)))) $(call Set,Tmp.CFLAGS,$(strip \ + $(if $(call IsDefined,$(Tmp.Key).UniversalArchs),-arch $(Tmp.Arch),)\ + $(if $(call streq,$($(Tmp.Key).VISIBILITY_HIDDEN),1),\ + -fvisibility=hidden -DVISIBILITY_HIDDEN,)\ $(call GetCNAVar,CFLAGS,$(Tmp.Key),$(Tmp.Config),$(Tmp.Arch)))) -$(call Set,Tmp.ArchFlag,$(strip \ - $(if $(call IsDefined,$(Tmp.Key).UniversalArchs),-arch $(Tmp.Arch),))) $(Tmp.ObjPath)/%.o: $(Tmp.SrcPath)/%.s $(Tmp.Dependencies) $(Tmp.ObjPath)/.dir $(Summary) " ASSEMBLE: $(Tmp.Name)/$(Tmp.Config)/$(Tmp.Arch): $$<" - $(Verb) $(Tmp.CC) $(Tmp.ArchFlag) $(Tmp.CFLAGS) -c -o $$@ $$< + $(Verb) $(Tmp.CC) $(Tmp.CFLAGS) -c -o $$@ $$< $(Tmp.ObjPath)/%.o: $(Tmp.SrcPath)/%.S $(Tmp.Dependencies) $(Tmp.ObjPath)/.dir $(Summary) " ASSEMBLE: $(Tmp.Name)/$(Tmp.Config)/$(Tmp.Arch): $$<" - $(Verb) $(Tmp.CC) $(Tmp.ArchFlag) $(Tmp.CFLAGS) -c -o $$@ $$< + $(Verb) $(Tmp.CC) $(Tmp.CFLAGS) -c -o $$@ $$< $(Tmp.ObjPath)/%.o: $(Tmp.SrcPath)/%.c $(Tmp.Dependencies) $(Tmp.ObjPath)/.dir $(Summary) " COMPILE: $(Tmp.Name)/$(Tmp.Config)/$(Tmp.Arch): $$<" - $(Verb) $(Tmp.CC) $(Tmp.ArchFlag) $(Tmp.CFLAGS) -c -o $$@ $$< + $(Verb) $(Tmp.CC) $(Tmp.CFLAGS) -c -o $$@ $$< .PRECIOUS: $(Tmp.ObjPath)/.dir endef diff --git a/compiler-rt/lib/assembly.h b/compiler-rt/lib/assembly.h index e6b84108f85..c2d5a34fffb 100644 --- a/compiler-rt/lib/assembly.h +++ b/compiler-rt/lib/assembly.h @@ -30,9 +30,16 @@ #define SYMBOL_NAME(name) name #endif +#ifdef VISIBILITY_HIDDEN +#define DEFINE_COMPILERRT_FUNCTION(name) \ + .globl SYMBOL_NAME(name) SEPARATOR \ + .private_extern SYMBOL_NAME(name) SEPARATOR \ + SYMBOL_NAME(name): +#else #define DEFINE_COMPILERRT_FUNCTION(name) \ .globl SYMBOL_NAME(name) SEPARATOR \ SYMBOL_NAME(name): +#endif #define DEFINE_COMPILERRT_PRIVATE_FUNCTION(name) \ .globl SYMBOL_NAME(name) SEPARATOR \ diff --git a/compiler-rt/make/lib_info.mk b/compiler-rt/make/lib_info.mk index 91ee23b5564..a54152a4feb 100644 --- a/compiler-rt/make/lib_info.mk +++ b/compiler-rt/make/lib_info.mk @@ -46,4 +46,5 @@ $(foreach key,$(SubDirKeys),\ # The names of all the available options. AvailableOptions := AR ARFLAGS \ CC CFLAGS FUNCTIONS OPTIMIZED \ - RANLIB RANLIBFLAGS + RANLIB RANLIBFLAGS \ + VISIBILITY_HIDDEN diff --git a/compiler-rt/make/options.mk b/compiler-rt/make/options.mk index 392bbdde589..f6a331bf0f5 100644 --- a/compiler-rt/make/options.mk +++ b/compiler-rt/make/options.mk @@ -15,6 +15,14 @@ FUNCTIONS := # Whether optimized function implementations should be used. OPTIMIZED := 1 +# Whether function definitions should use hidden visibility. This adds the +# -fvisibility=hidden compiler option and uses .private_extern annotations in +# assembly files. +# +# FIXME: Make this more portable. When that is done, it should probably be the +# default. +VISIBILITY_HIDDEN := 0 + # Miscellaneous tools. AR := ar diff --git a/compiler-rt/make/platform/darwin_bni.mk b/compiler-rt/make/platform/darwin_bni.mk index 952b1047419..e713d243d6a 100644 --- a/compiler-rt/make/platform/darwin_bni.mk +++ b/compiler-rt/make/platform/darwin_bni.mk @@ -50,3 +50,4 @@ FUNCTIONS.armv6 := $(FUNCTIONS) \ subdf3vfp subsf3vfp truncdfsf2vfp unorddf2vfp unordsf2vfp \ modsi3 umodsi3 udivsi3 divsi3 switch save_restore_d8_d15 +VISIBILITY_HIDDEN := 0 diff --git a/compiler-rt/make/platform/darwin_fat.mk b/compiler-rt/make/platform/darwin_fat.mk index cea2a51f2ad..3659e041f69 100644 --- a/compiler-rt/make/platform/darwin_fat.mk +++ b/compiler-rt/make/platform/darwin_fat.mk @@ -51,3 +51,5 @@ FUNCTIONS.armv6 := $(CommonFunctions) $(ArchFunctions.armv6) FUNCTIONS.armv7 := $(CommonFunctions) $(ArchFunctions.armv7) OPTIMIZED.Debug := 0 + +VISIBILITY_HIDDEN := 1 diff --git a/compiler-rt/make/platform/multi_arch.mk b/compiler-rt/make/platform/multi_arch.mk index c85f3d90492..eebc7b2f80d 100644 --- a/compiler-rt/make/platform/multi_arch.mk +++ b/compiler-rt/make/platform/multi_arch.mk @@ -13,4 +13,4 @@ CFLAGS.m32 := $(CFLAGS) -m32 -O3 CFLAGS.m64 := $(CFLAGS) -m64 -O3 FUNCTIONS := moddi3 floatundixf udivdi3 -FUNCTIONS.m64 := $(FUNCTIONS) lshrdi3
\ No newline at end of file +FUNCTIONS.m64 := $(FUNCTIONS) lshrdi3 |