Skip to content
This repository has been archived by the owner on May 21, 2019. It is now read-only.

Add Rust-specific buildsystem fixes #11

Merged
merged 4 commits into from
Oct 26, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/builtins/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -347,7 +347,7 @@ if (APPLE)
add_subdirectory(Darwin-excludes)
add_subdirectory(macho_embedded)
darwin_add_builtin_libraries(${BUILTIN_SUPPORTED_OS})
elseif (NOT WIN32 OR MINGW)
else ()
foreach (arch ${BUILTIN_SUPPORTED_ARCH})
if (CAN_TARGET_${arch})
# Filter out generic versions of routines that are re-implemented in
Expand Down
4 changes: 2 additions & 2 deletions make/config.mk
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,6 @@ endif
###
# Common compiler options
COMMON_INCLUDES=-I${ProjSrcRoot}/lib -I${ProjSrcRoot}/include
COMMON_CXXFLAGS=-std=c++11 -fno-exceptions -fPIC -funwind-tables $(COMMON_INCLUDES)
COMMON_CFLAGS=-fPIC $(COMMON_INCLUDES)
COMMON_CXXFLAGS=-std=c++11 -fno-exceptions -funwind-tables $(COMMON_INCLUDES)
COMMON_CFLAGS=$(COMMON_INCLUDES)
COMMON_ASMFLAGS=$(COMMON_INCLUDES)
2 changes: 1 addition & 1 deletion make/platform/clang_darwin.mk
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ $(foreach config,$(Configs),\
override CC := $(subst -arch ,-arch_,$(CC))
override CC := $(patsubst -arch_%,,$(CC))

CFLAGS := -Wall -Werror -O3 -fomit-frame-pointer
CFLAGS := -fPIC -Wall -Werror -O3 -fomit-frame-pointer

# Always set deployment target arguments for every build, these libraries should
# never depend on the environmental overrides. We simply set them to minimum
Expand Down
2 changes: 1 addition & 1 deletion make/platform/clang_linux.mk
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ endif

###

CFLAGS := -Wall -Werror -O3 -fomit-frame-pointer
CFLAGS := -fPIC -Wall -Werror -O3 -fomit-frame-pointer

CFLAGS.builtins-i386 := $(CFLAGS) -m32
CFLAGS.builtins-x86_64 := $(CFLAGS) -m64
Expand Down
2 changes: 1 addition & 1 deletion make/platform/darwin_bni.mk
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ ifneq (,$(SDKROOT))
DEPLOYMENT_FLAGS += -isysroot $(SDKROOT)
endif

CFLAGS := -Wall -Os -fomit-frame-pointer -g $(DEPLOYMENT_FLAGS)
CFLAGS := -fPIC -Wall -Os -fomit-frame-pointer -g $(DEPLOYMENT_FLAGS)
CFLAGS.Static := $(CFLAGS) -static
DYLIB_FLAGS := $(DEPLOYMENT_FLAGS) \
-Xarch_arm -Wl,-alias_list,$(SRCROOT)/lib/builtins/arm/softfloat-alias.list
Expand Down
66 changes: 66 additions & 0 deletions make/platform/triple.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
# This "platform" file is intended for building compiler-rt using gcc.
# The actual target platform is selected by setting the TargetTriple variable to the corresponding LLVM triple.

Description := Static runtime libraries for platforms selected by 'TargetTriple'

# Provide defaults for the required vars
ifndef CC
CC := gcc
endif
ifndef CFLAGS
CFLAGS := -Wall -O3
endif

Configs := builtins

Arch := $(word 1,$(subst -, ,$(TargetTriple)))
ifeq ($(Arch),i686)
Arch := i386
else ifeq ($(Arch),arm)
ifneq (,$(findstring ios,$(TargetTriple)))
Arch := armv7
else ifneq (,$(findstring android,$(TargetTriple)))
Arch := armv7
endif
endif

# Filter out stuff that gcc cannot compile (these are only needed for clang-generated code anywasys).
CommonFunctions_gcc := $(filter-out atomic% enable_execute_stack,$(CommonFunctions))

# Filter out stuff which is not available on specific target
# For example, sync_fetch_and_add_4 uses Thumb instructions, which are unavailable
# when building for arm-linux-androideabi
ifeq ($(TargetTriple),arm-linux-androideabi)
ArchDisabledFunctions := \
sync_fetch_and_add_4 \
sync_fetch_and_sub_4 \
sync_fetch_and_and_4 \
sync_fetch_and_or_4 \
sync_fetch_and_xor_4 \
sync_fetch_and_nand_4 \
sync_fetch_and_max_4 \
sync_fetch_and_umax_4 \
sync_fetch_and_min_4 \
sync_fetch_and_umin_4 \
sync_fetch_and_add_8 \
sync_fetch_and_sub_8 \
sync_fetch_and_and_8 \
sync_fetch_and_or_8 \
sync_fetch_and_xor_8 \
sync_fetch_and_nand_8 \
sync_fetch_and_max_8 \
sync_fetch_and_umax_8 \
sync_fetch_and_min_8 \
sync_fetch_and_umin_8
endif

# Clear cache is builtin on aarch64-apple-ios
# arm64 and aarch64 are synonims, but iOS targets usually use arm64 (history reasons)
ifeq (aarch64-apple-ios,$(subst arm64,aarch64,$(TargetTriple)))
CommonDisabledFunctions := clear_cache
endif

ArchEnabledFunctions := $(filter-out $(ArchDisabledFunctions),$(value ArchFunctions.$(Arch)))
CommonEnabledFunctions := $(filter-out $(CommonDisabledFunctions),$(CommonFunctions_gcc))

FUNCTIONS.builtins := $(CommonEnabledFunctions) $(ArchEnabledFunctions)