diff --git a/lib/builtins/CMakeLists.txt b/lib/builtins/CMakeLists.txt index 0c88893e1a..21272b97ce 100644 --- a/lib/builtins/CMakeLists.txt +++ b/lib/builtins/CMakeLists.txt @@ -242,10 +242,13 @@ set(arm_SOURCES arm/unordsf2vfp.S ${GENERIC_SOURCES}) +set(aarch64_SOURCES + ${GENERIC_SOURCES}) + add_custom_target(builtins) if (NOT WIN32) - foreach(arch x86_64 i386 arm) + foreach(arch x86_64 i386 arm aarch64) if(CAN_TARGET_${arch}) add_compiler_rt_runtime(clang_rt.${arch} ${arch} STATIC SOURCES ${${arch}_SOURCES} diff --git a/lib/builtins/Makefile.mk b/lib/builtins/Makefile.mk index 3143d91f07..18debba00f 100644 --- a/lib/builtins/Makefile.mk +++ b/lib/builtins/Makefile.mk @@ -11,7 +11,7 @@ ModuleName := builtins SubDirs := # Add arch specific optimized implementations. -SubDirs += i386 ppc x86_64 arm +SubDirs += i386 ppc x86_64 arm aarch64 # Define the variables for this specific directory. Sources := $(foreach file,$(wildcard $(Dir)/*.c),$(notdir $(file))) diff --git a/lib/builtins/aarch64/Makefile.mk b/lib/builtins/aarch64/Makefile.mk new file mode 100644 index 0000000000..4855941ff0 --- /dev/null +++ b/lib/builtins/aarch64/Makefile.mk @@ -0,0 +1,22 @@ +#===- lib/builtins/aarch64/Makefile.mk ---------------------*- Makefile -*--===# +# +# The LLVM Compiler Infrastructure +# +# This file is distributed under the University of Illinois Open Source +# License. See LICENSE.TXT for details. +# +#===------------------------------------------------------------------------===# + +ModuleName := builtins +SubDirs := +OnlyArchs := aarch64 + +AsmSources := $(foreach file,$(wildcard $(Dir)/*.S),$(notdir $(file))) +Sources := $(foreach file,$(wildcard $(Dir)/*.c),$(notdir $(file))) +ObjNames := $(Sources:%.c=%.o) $(AsmSources:%.S=%.o) +Implementation := Optimized + +# FIXME: use automatic dependencies? +Dependencies := $(wildcard lib/*.h $(Dir)/*.h) + +CFLAGS.builtins := $(CFLAGS) -std=c99 diff --git a/lib/builtins/clear_cache.c b/lib/builtins/clear_cache.c index a5cfac070f..37d6c61489 100644 --- a/lib/builtins/clear_cache.c +++ b/lib/builtins/clear_cache.c @@ -25,6 +25,10 @@ #include <asm/unistd.h> #endif +#if defined(__aarch64__) && !defined(__APPLE__) + #include <stddef.h> +#endif + /* * The compiler generates calls to __clear_cache() when creating * trampoline functions on the stack for use with nested functions.