2014-02-14 17:20:33 +08:00
|
|
|
# This directory contains a large amount of C code which provides
|
|
|
|
# generic implementations of the core runtime library along with optimized
|
|
|
|
# architecture-specific code in various subdirectories.
|
|
|
|
|
[CMake] Support platform building builtins without a full toolchain
Summary:
This patch adds support for building lib/builtins without a fully functioning toolchain. It allows you to bootstrap a cross-compiler, which previously couldn't be done with CMake.
This patch contains the following specific changes:
* Split builtin-specific code out of config-ix.cmake into builtin-config-ix.cmake
* Split some common CMake functionality needed by both builtins and sanitizers into base-config-ix.cmake
* Made lib/builtins/CMakeLists.txt able to be a top-level CMake configuration
I have tested this on Darwin targeting embedded Darwin, and on FreeBSD x86_64 targeting FreeBSD AArch64.
This patch depends on http://reviews.llvm.org/D19692, and is the last part of http://reviews.llvm.org/D16653.
Reviewers: samsonov, iains, jroelofs
Subscribers: compnerd, aemerson, tberghammer, danalbert, srhines, emaste, llvm-commits
Differential Revision: http://reviews.llvm.org/D19742
llvm-svn: 268977
2016-05-10 05:45:52 +08:00
|
|
|
if (CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR)
|
2020-04-22 23:15:05 +08:00
|
|
|
cmake_minimum_required(VERSION 3.13.4)
|
[CMake] Support platform building builtins without a full toolchain
Summary:
This patch adds support for building lib/builtins without a fully functioning toolchain. It allows you to bootstrap a cross-compiler, which previously couldn't be done with CMake.
This patch contains the following specific changes:
* Split builtin-specific code out of config-ix.cmake into builtin-config-ix.cmake
* Split some common CMake functionality needed by both builtins and sanitizers into base-config-ix.cmake
* Made lib/builtins/CMakeLists.txt able to be a top-level CMake configuration
I have tested this on Darwin targeting embedded Darwin, and on FreeBSD x86_64 targeting FreeBSD AArch64.
This patch depends on http://reviews.llvm.org/D19692, and is the last part of http://reviews.llvm.org/D16653.
Reviewers: samsonov, iains, jroelofs
Subscribers: compnerd, aemerson, tberghammer, danalbert, srhines, emaste, llvm-commits
Differential Revision: http://reviews.llvm.org/D19742
llvm-svn: 268977
2016-05-10 05:45:52 +08:00
|
|
|
|
2020-11-12 17:09:38 +08:00
|
|
|
set(CMAKE_TRY_COMPILE_TARGET_TYPE STATIC_LIBRARY)
|
[CMake] Support platform building builtins without a full toolchain
Summary:
This patch adds support for building lib/builtins without a fully functioning toolchain. It allows you to bootstrap a cross-compiler, which previously couldn't be done with CMake.
This patch contains the following specific changes:
* Split builtin-specific code out of config-ix.cmake into builtin-config-ix.cmake
* Split some common CMake functionality needed by both builtins and sanitizers into base-config-ix.cmake
* Made lib/builtins/CMakeLists.txt able to be a top-level CMake configuration
I have tested this on Darwin targeting embedded Darwin, and on FreeBSD x86_64 targeting FreeBSD AArch64.
This patch depends on http://reviews.llvm.org/D19692, and is the last part of http://reviews.llvm.org/D16653.
Reviewers: samsonov, iains, jroelofs
Subscribers: compnerd, aemerson, tberghammer, danalbert, srhines, emaste, llvm-commits
Differential Revision: http://reviews.llvm.org/D19742
llvm-svn: 268977
2016-05-10 05:45:52 +08:00
|
|
|
project(CompilerRTBuiltins C ASM)
|
|
|
|
set(COMPILER_RT_STANDALONE_BUILD TRUE)
|
|
|
|
set(COMPILER_RT_BUILTINS_STANDALONE_BUILD TRUE)
|
|
|
|
list(INSERT CMAKE_MODULE_PATH 0
|
|
|
|
"${CMAKE_SOURCE_DIR}/../../cmake"
|
|
|
|
"${CMAKE_SOURCE_DIR}/../../cmake/Modules")
|
|
|
|
include(base-config-ix)
|
|
|
|
include(CompilerRTUtils)
|
2016-08-02 13:51:05 +08:00
|
|
|
|
|
|
|
load_llvm_config()
|
|
|
|
construct_compiler_rt_default_triple()
|
|
|
|
|
[CMake] Support platform building builtins without a full toolchain
Summary:
This patch adds support for building lib/builtins without a fully functioning toolchain. It allows you to bootstrap a cross-compiler, which previously couldn't be done with CMake.
This patch contains the following specific changes:
* Split builtin-specific code out of config-ix.cmake into builtin-config-ix.cmake
* Split some common CMake functionality needed by both builtins and sanitizers into base-config-ix.cmake
* Made lib/builtins/CMakeLists.txt able to be a top-level CMake configuration
I have tested this on Darwin targeting embedded Darwin, and on FreeBSD x86_64 targeting FreeBSD AArch64.
This patch depends on http://reviews.llvm.org/D19692, and is the last part of http://reviews.llvm.org/D16653.
Reviewers: samsonov, iains, jroelofs
Subscribers: compnerd, aemerson, tberghammer, danalbert, srhines, emaste, llvm-commits
Differential Revision: http://reviews.llvm.org/D19742
llvm-svn: 268977
2016-05-10 05:45:52 +08:00
|
|
|
if(APPLE)
|
|
|
|
include(CompilerRTDarwinUtils)
|
|
|
|
endif()
|
2020-08-22 04:03:13 +08:00
|
|
|
if(APPLE)
|
2019-06-04 10:38:15 +08:00
|
|
|
include(UseLibtool)
|
|
|
|
endif()
|
[CMake] Support platform building builtins without a full toolchain
Summary:
This patch adds support for building lib/builtins without a fully functioning toolchain. It allows you to bootstrap a cross-compiler, which previously couldn't be done with CMake.
This patch contains the following specific changes:
* Split builtin-specific code out of config-ix.cmake into builtin-config-ix.cmake
* Split some common CMake functionality needed by both builtins and sanitizers into base-config-ix.cmake
* Made lib/builtins/CMakeLists.txt able to be a top-level CMake configuration
I have tested this on Darwin targeting embedded Darwin, and on FreeBSD x86_64 targeting FreeBSD AArch64.
This patch depends on http://reviews.llvm.org/D19692, and is the last part of http://reviews.llvm.org/D16653.
Reviewers: samsonov, iains, jroelofs
Subscribers: compnerd, aemerson, tberghammer, danalbert, srhines, emaste, llvm-commits
Differential Revision: http://reviews.llvm.org/D19742
llvm-svn: 268977
2016-05-10 05:45:52 +08:00
|
|
|
include(AddCompilerRT)
|
2020-01-02 23:11:59 +08:00
|
|
|
|
|
|
|
if(${CMAKE_SYSTEM_NAME} MATCHES "AIX")
|
|
|
|
set(CMAKE_C_ARCHIVE_CREATE "<CMAKE_AR> -X32_64 qc <TARGET> <LINK_FLAGS> <OBJECTS>")
|
|
|
|
set(CMAKE_CXX_ARCHIVE_CREATE "<CMAKE_AR> -X32_64 qc <TARGET> <LINK_FLAGS> <OBJECTS>")
|
|
|
|
set(CMAKE_C_ARCHIVE_APPEND "<CMAKE_AR> -X32_64 q <TARGET> <LINK_FLAGS> <OBJECTS>")
|
|
|
|
set(CMAKE_CXX_ARCHIVE_APPEND "<CMAKE_AR> -X32_64 q <TARGET> <LINK_FLAGS> <OBJECTS>")
|
|
|
|
set(CMAKE_C_ARCHIVE_FINISH "<CMAKE_RANLIB> -X32_64 <TARGET>")
|
|
|
|
set(CMAKE_CXX_ARCHIVE_FINISH "<CMAKE_RANLIB> -X32_64 <TARGET>")
|
|
|
|
endif()
|
[CMake] Support platform building builtins without a full toolchain
Summary:
This patch adds support for building lib/builtins without a fully functioning toolchain. It allows you to bootstrap a cross-compiler, which previously couldn't be done with CMake.
This patch contains the following specific changes:
* Split builtin-specific code out of config-ix.cmake into builtin-config-ix.cmake
* Split some common CMake functionality needed by both builtins and sanitizers into base-config-ix.cmake
* Made lib/builtins/CMakeLists.txt able to be a top-level CMake configuration
I have tested this on Darwin targeting embedded Darwin, and on FreeBSD x86_64 targeting FreeBSD AArch64.
This patch depends on http://reviews.llvm.org/D19692, and is the last part of http://reviews.llvm.org/D16653.
Reviewers: samsonov, iains, jroelofs
Subscribers: compnerd, aemerson, tberghammer, danalbert, srhines, emaste, llvm-commits
Differential Revision: http://reviews.llvm.org/D19742
llvm-svn: 268977
2016-05-10 05:45:52 +08:00
|
|
|
endif()
|
|
|
|
|
2020-02-01 07:57:18 +08:00
|
|
|
if (COMPILER_RT_STANDALONE_BUILD)
|
|
|
|
# When compiler-rt is being built standalone, possibly as a cross-compilation
|
|
|
|
# target, the target may or may not want position independent code. This
|
|
|
|
# option provides an avenue through which the flag may be controlled when an
|
|
|
|
# LLVM configuration is not being utilized.
|
|
|
|
option(COMPILER_RT_BUILTINS_ENABLE_PIC
|
|
|
|
"Turns on or off -fPIC for the builtin library source"
|
|
|
|
ON)
|
|
|
|
endif()
|
|
|
|
|
[CMake] Support platform building builtins without a full toolchain
Summary:
This patch adds support for building lib/builtins without a fully functioning toolchain. It allows you to bootstrap a cross-compiler, which previously couldn't be done with CMake.
This patch contains the following specific changes:
* Split builtin-specific code out of config-ix.cmake into builtin-config-ix.cmake
* Split some common CMake functionality needed by both builtins and sanitizers into base-config-ix.cmake
* Made lib/builtins/CMakeLists.txt able to be a top-level CMake configuration
I have tested this on Darwin targeting embedded Darwin, and on FreeBSD x86_64 targeting FreeBSD AArch64.
This patch depends on http://reviews.llvm.org/D19692, and is the last part of http://reviews.llvm.org/D16653.
Reviewers: samsonov, iains, jroelofs
Subscribers: compnerd, aemerson, tberghammer, danalbert, srhines, emaste, llvm-commits
Differential Revision: http://reviews.llvm.org/D19742
llvm-svn: 268977
2016-05-10 05:45:52 +08:00
|
|
|
include(builtin-config-ix)
|
|
|
|
|
2021-05-16 13:03:10 +08:00
|
|
|
if(${CMAKE_SYSTEM_NAME} MATCHES "AIX")
|
|
|
|
include(CompilerRTAIXUtils)
|
|
|
|
endif()
|
|
|
|
|
[builtins] Add COMPILER_RT_BUILTINS_HIDE_SYMBOLS
On Android, when the builtins are linked into a binary, they are
typically linked using -Wl,--exclude-libs so that the symbols aren't
reexported. For the NDK, compiler-rt's default behavior (build the
builtins archive with -fvisibility=hidden) is better so that builtins
are hidden even without -Wl,--exclude-libs.
Android needs the builtins with non-hidden symbols only for a special
case: for backwards compatibility with old binaries, the libc.so and
libm.so DSOs in the platform need to export some builtins for arm32 and
32-bit x86. See D56977.
Control the behavior with a new flag,
`COMPILER_RT_BUILTINS_HIDE_SYMBOLS`, that behaves similarly to the
`*_HERMETIC_STATIC_LIBRARY` in libunwind/libcxx/libcxxabi, so that
Android can build a special builtins variant for libc.so/libm.so.
Unlike the hermetic flags for other projects, this new flag is enabled
by default.
Reviewed By: compnerd, MaskRay
Differential Revision: https://reviews.llvm.org/D93431
2021-01-08 09:49:29 +08:00
|
|
|
option(COMPILER_RT_BUILTINS_HIDE_SYMBOLS
|
|
|
|
"Do not export any symbols from the static library." ON)
|
|
|
|
|
2015-11-13 03:17:05 +08:00
|
|
|
# TODO: Need to add a mechanism for logging errors when builtin source files are
|
|
|
|
# added to a sub-directory and not this CMakeLists file.
|
2014-02-14 17:20:33 +08:00
|
|
|
set(GENERIC_SOURCES
|
|
|
|
absvdi2.c
|
|
|
|
absvsi2.c
|
|
|
|
absvti2.c
|
|
|
|
adddf3.c
|
|
|
|
addsf3.c
|
|
|
|
addvdi3.c
|
|
|
|
addvsi3.c
|
|
|
|
addvti3.c
|
|
|
|
apple_versioning.c
|
|
|
|
ashldi3.c
|
|
|
|
ashlti3.c
|
|
|
|
ashrdi3.c
|
|
|
|
ashrti3.c
|
Add generic __bswap[ds]i2 implementations
Summary:
In FreeBSD we needed to add generic implementations for `__bswapdi2` and
`__bswapsi2`, since gcc 6.x for mips is emitting calls to these. See:
https://reviews.freebsd.org/D10838 and https://reviews.freebsd.org/rS318601
The actual mips code generated for these generic C versions is pretty
OK, as can be seen in the (FreeBSD) review.
I checked over gcc sources, and it seems that it can emit these calls on
more architectures, so maybe it's best to simply always add them to the
compiler-rt builtins library.
Reviewers: howard.hinnant, compnerd, petarj, emaste
Reviewed By: compnerd, emaste
Subscribers: mgorny, llvm-commits, arichardson
Differential Revision: https://reviews.llvm.org/D33516
llvm-svn: 303866
2017-05-25 22:52:14 +08:00
|
|
|
bswapdi2.c
|
|
|
|
bswapsi2.c
|
2014-02-14 17:20:33 +08:00
|
|
|
clzdi2.c
|
|
|
|
clzsi2.c
|
|
|
|
clzti2.c
|
|
|
|
cmpdi2.c
|
|
|
|
cmpti2.c
|
|
|
|
comparedf2.c
|
|
|
|
comparesf2.c
|
|
|
|
ctzdi2.c
|
|
|
|
ctzsi2.c
|
|
|
|
ctzti2.c
|
|
|
|
divdc3.c
|
|
|
|
divdf3.c
|
|
|
|
divdi3.c
|
|
|
|
divmoddi4.c
|
|
|
|
divmodsi4.c
|
2020-09-17 12:56:01 +08:00
|
|
|
divmodti4.c
|
2014-02-14 17:20:33 +08:00
|
|
|
divsc3.c
|
|
|
|
divsf3.c
|
|
|
|
divsi3.c
|
|
|
|
divti3.c
|
|
|
|
extendsfdf2.c
|
2015-05-13 02:33:42 +08:00
|
|
|
extendhfsf2.c
|
2014-02-14 17:20:33 +08:00
|
|
|
ffsdi2.c
|
2017-04-07 02:12:02 +08:00
|
|
|
ffssi2.c
|
2014-02-14 17:20:33 +08:00
|
|
|
ffsti2.c
|
|
|
|
fixdfdi.c
|
|
|
|
fixdfsi.c
|
|
|
|
fixdfti.c
|
|
|
|
fixsfdi.c
|
|
|
|
fixsfsi.c
|
|
|
|
fixsfti.c
|
|
|
|
fixunsdfdi.c
|
|
|
|
fixunsdfsi.c
|
|
|
|
fixunsdfti.c
|
|
|
|
fixunssfdi.c
|
|
|
|
fixunssfsi.c
|
|
|
|
fixunssfti.c
|
|
|
|
floatdidf.c
|
|
|
|
floatdisf.c
|
|
|
|
floatsidf.c
|
|
|
|
floatsisf.c
|
|
|
|
floattidf.c
|
|
|
|
floattisf.c
|
|
|
|
floatundidf.c
|
|
|
|
floatundisf.c
|
|
|
|
floatunsidf.c
|
|
|
|
floatunsisf.c
|
|
|
|
floatuntidf.c
|
|
|
|
floatuntisf.c
|
2019-09-05 09:05:05 +08:00
|
|
|
fp_mode.c
|
2014-02-14 17:20:33 +08:00
|
|
|
int_util.c
|
|
|
|
lshrdi3.c
|
|
|
|
lshrti3.c
|
|
|
|
moddi3.c
|
|
|
|
modsi3.c
|
|
|
|
modti3.c
|
|
|
|
muldc3.c
|
|
|
|
muldf3.c
|
|
|
|
muldi3.c
|
|
|
|
mulodi4.c
|
|
|
|
mulosi4.c
|
|
|
|
muloti4.c
|
|
|
|
mulsc3.c
|
|
|
|
mulsf3.c
|
|
|
|
multi3.c
|
|
|
|
mulvdi3.c
|
|
|
|
mulvsi3.c
|
|
|
|
mulvti3.c
|
|
|
|
negdf2.c
|
|
|
|
negdi2.c
|
|
|
|
negsf2.c
|
|
|
|
negti2.c
|
|
|
|
negvdi2.c
|
|
|
|
negvsi2.c
|
|
|
|
negvti2.c
|
2017-03-10 01:02:16 +08:00
|
|
|
os_version_check.c
|
2014-02-14 17:20:33 +08:00
|
|
|
paritydi2.c
|
|
|
|
paritysi2.c
|
|
|
|
parityti2.c
|
|
|
|
popcountdi2.c
|
|
|
|
popcountsi2.c
|
|
|
|
popcountti2.c
|
|
|
|
powidf2.c
|
|
|
|
powisf2.c
|
|
|
|
subdf3.c
|
|
|
|
subsf3.c
|
|
|
|
subvdi3.c
|
|
|
|
subvsi3.c
|
|
|
|
subvti3.c
|
|
|
|
trampoline_setup.c
|
2015-05-13 02:33:42 +08:00
|
|
|
truncdfhf2.c
|
2014-02-14 17:20:33 +08:00
|
|
|
truncdfsf2.c
|
2015-05-13 02:33:42 +08:00
|
|
|
truncsfhf2.c
|
2014-02-14 17:20:33 +08:00
|
|
|
ucmpdi2.c
|
|
|
|
ucmpti2.c
|
|
|
|
udivdi3.c
|
|
|
|
udivmoddi4.c
|
|
|
|
udivmodsi4.c
|
|
|
|
udivmodti4.c
|
|
|
|
udivsi3.c
|
|
|
|
udivti3.c
|
|
|
|
umoddi3.c
|
|
|
|
umodsi3.c
|
2019-04-06 05:30:40 +08:00
|
|
|
umodti3.c
|
|
|
|
)
|
2014-02-14 17:20:33 +08:00
|
|
|
|
2020-07-17 06:10:22 +08:00
|
|
|
# TODO: Several "tf" files (and divtc3.c, but not multc3.c) are in
|
|
|
|
# GENERIC_SOURCES instead of here.
|
2017-05-04 21:34:17 +08:00
|
|
|
set(GENERIC_TF_SOURCES
|
2020-06-26 03:32:41 +08:00
|
|
|
addtf3.c
|
2017-05-04 21:34:17 +08:00
|
|
|
comparetf2.c
|
2020-06-26 03:32:41 +08:00
|
|
|
divtc3.c
|
|
|
|
divtf3.c
|
2017-05-04 21:34:17 +08:00
|
|
|
extenddftf2.c
|
2020-12-08 21:26:18 +08:00
|
|
|
extendhftf2.c
|
2017-05-04 21:34:17 +08:00
|
|
|
extendsftf2.c
|
|
|
|
fixtfdi.c
|
|
|
|
fixtfsi.c
|
|
|
|
fixtfti.c
|
|
|
|
fixunstfdi.c
|
|
|
|
fixunstfsi.c
|
|
|
|
fixunstfti.c
|
|
|
|
floatditf.c
|
|
|
|
floatsitf.c
|
|
|
|
floattitf.c
|
|
|
|
floatunditf.c
|
|
|
|
floatunsitf.c
|
|
|
|
floatuntitf.c
|
|
|
|
multc3.c
|
2020-06-26 03:32:41 +08:00
|
|
|
multf3.c
|
|
|
|
powitf2.c
|
|
|
|
subtf3.c
|
2017-05-04 21:34:17 +08:00
|
|
|
trunctfdf2.c
|
2020-12-08 21:26:18 +08:00
|
|
|
trunctfhf2.c
|
2019-04-06 05:30:40 +08:00
|
|
|
trunctfsf2.c
|
|
|
|
)
|
2017-05-04 21:34:17 +08:00
|
|
|
|
2016-09-02 05:05:49 +08:00
|
|
|
option(COMPILER_RT_EXCLUDE_ATOMIC_BUILTIN
|
2018-06-15 07:22:53 +08:00
|
|
|
"Skip the atomic builtin (these should normally be provided by a shared library)"
|
|
|
|
On)
|
2016-09-02 05:05:49 +08:00
|
|
|
|
2017-07-13 03:33:30 +08:00
|
|
|
if(NOT FUCHSIA AND NOT COMPILER_RT_BAREMETAL_BUILD)
|
2017-05-10 23:34:25 +08:00
|
|
|
set(GENERIC_SOURCES
|
|
|
|
${GENERIC_SOURCES}
|
2019-04-06 05:30:40 +08:00
|
|
|
emutls.c
|
2017-07-13 03:33:30 +08:00
|
|
|
enable_execute_stack.c
|
2019-04-06 05:30:40 +08:00
|
|
|
eprintf.c
|
|
|
|
)
|
2017-05-10 23:34:25 +08:00
|
|
|
endif()
|
|
|
|
|
2016-09-02 05:05:49 +08:00
|
|
|
if(COMPILER_RT_HAS_ATOMIC_KEYWORD AND NOT COMPILER_RT_EXCLUDE_ATOMIC_BUILTIN)
|
2016-08-12 09:29:26 +08:00
|
|
|
set(GENERIC_SOURCES
|
|
|
|
${GENERIC_SOURCES}
|
2019-04-06 05:30:40 +08:00
|
|
|
atomic.c
|
|
|
|
)
|
2016-08-12 09:29:26 +08:00
|
|
|
endif()
|
|
|
|
|
2015-09-23 23:28:44 +08:00
|
|
|
if(APPLE)
|
|
|
|
set(GENERIC_SOURCES
|
|
|
|
${GENERIC_SOURCES}
|
|
|
|
atomic_flag_clear.c
|
|
|
|
atomic_flag_clear_explicit.c
|
|
|
|
atomic_flag_test_and_set.c
|
|
|
|
atomic_flag_test_and_set_explicit.c
|
|
|
|
atomic_signal_fence.c
|
2019-04-06 05:30:40 +08:00
|
|
|
atomic_thread_fence.c
|
|
|
|
)
|
2015-09-23 23:28:44 +08:00
|
|
|
endif()
|
|
|
|
|
2015-01-14 23:55:17 +08:00
|
|
|
if (HAVE_UNWIND_H)
|
|
|
|
set(GENERIC_SOURCES
|
2019-04-06 05:30:40 +08:00
|
|
|
${GENERIC_SOURCES}
|
|
|
|
gcc_personality_v0.c
|
|
|
|
)
|
2015-01-14 23:55:17 +08:00
|
|
|
endif ()
|
|
|
|
|
2017-07-13 03:33:30 +08:00
|
|
|
if (NOT FUCHSIA)
|
|
|
|
set(GENERIC_SOURCES
|
|
|
|
${GENERIC_SOURCES}
|
2019-04-06 05:30:40 +08:00
|
|
|
clear_cache.c
|
|
|
|
)
|
2017-07-13 03:33:30 +08:00
|
|
|
endif()
|
|
|
|
|
2020-07-17 06:10:22 +08:00
|
|
|
# These files are used on 32-bit and 64-bit x86.
|
2020-07-17 06:29:48 +08:00
|
|
|
set(x86_ARCH_SOURCES
|
|
|
|
cpu_model.c
|
|
|
|
)
|
2020-07-17 06:10:22 +08:00
|
|
|
|
|
|
|
if (NOT MSVC)
|
|
|
|
set(x86_ARCH_SOURCES
|
|
|
|
${x86_ARCH_SOURCES}
|
|
|
|
i386/fp_mode.c
|
|
|
|
)
|
|
|
|
endif ()
|
|
|
|
|
|
|
|
# Implement extended-precision builtins, assuming long double is 80 bits.
|
|
|
|
# long double is not 80 bits on Android or MSVC.
|
|
|
|
set(x86_80_BIT_SOURCES
|
2017-12-01 03:39:33 +08:00
|
|
|
divxc3.c
|
|
|
|
fixxfdi.c
|
|
|
|
fixxfti.c
|
|
|
|
fixunsxfdi.c
|
|
|
|
fixunsxfsi.c
|
|
|
|
fixunsxfti.c
|
|
|
|
floatdixf.c
|
|
|
|
floattixf.c
|
|
|
|
floatundixf.c
|
|
|
|
floatuntixf.c
|
|
|
|
mulxc3.c
|
|
|
|
powixf2.c
|
|
|
|
)
|
|
|
|
|
2015-10-15 10:47:19 +08:00
|
|
|
if (NOT MSVC)
|
2015-07-18 00:23:05 +08:00
|
|
|
set(x86_64_SOURCES
|
2020-06-19 14:59:36 +08:00
|
|
|
${GENERIC_SOURCES}
|
2019-04-19 03:29:03 +08:00
|
|
|
${GENERIC_TF_SOURCES}
|
2020-06-19 14:59:36 +08:00
|
|
|
${x86_ARCH_SOURCES}
|
2019-04-06 05:30:40 +08:00
|
|
|
x86_64/floatdidf.c
|
|
|
|
x86_64/floatdisf.c
|
|
|
|
x86_64/floatundidf.S
|
|
|
|
x86_64/floatundisf.S
|
|
|
|
)
|
2020-06-19 14:59:36 +08:00
|
|
|
|
2020-07-17 06:10:22 +08:00
|
|
|
if (NOT ANDROID)
|
|
|
|
set(x86_64_SOURCES
|
|
|
|
${x86_64_SOURCES}
|
|
|
|
${x86_80_BIT_SOURCES}
|
|
|
|
x86_64/floatdixf.c
|
|
|
|
x86_64/floatundixf.S
|
|
|
|
)
|
|
|
|
endif()
|
|
|
|
|
2020-06-19 14:59:36 +08:00
|
|
|
# Darwin x86_64 Haswell
|
2015-10-15 10:47:19 +08:00
|
|
|
set(x86_64h_SOURCES ${x86_64_SOURCES})
|
2015-07-18 00:23:05 +08:00
|
|
|
|
2015-10-15 10:47:19 +08:00
|
|
|
if (WIN32)
|
|
|
|
set(x86_64_SOURCES
|
2019-04-06 05:30:40 +08:00
|
|
|
${x86_64_SOURCES}
|
|
|
|
x86_64/chkstk.S
|
|
|
|
x86_64/chkstk2.S
|
|
|
|
)
|
2015-10-15 10:47:19 +08:00
|
|
|
endif()
|
2014-02-14 17:20:33 +08:00
|
|
|
|
2015-07-18 00:23:05 +08:00
|
|
|
set(i386_SOURCES
|
2020-06-19 14:59:36 +08:00
|
|
|
${GENERIC_SOURCES}
|
|
|
|
${x86_ARCH_SOURCES}
|
2019-04-06 05:30:40 +08:00
|
|
|
i386/ashldi3.S
|
|
|
|
i386/ashrdi3.S
|
|
|
|
i386/divdi3.S
|
|
|
|
i386/floatdidf.S
|
|
|
|
i386/floatdisf.S
|
|
|
|
i386/floatundidf.S
|
|
|
|
i386/floatundisf.S
|
|
|
|
i386/lshrdi3.S
|
|
|
|
i386/moddi3.S
|
|
|
|
i386/muldi3.S
|
|
|
|
i386/udivdi3.S
|
|
|
|
i386/umoddi3.S
|
|
|
|
)
|
2015-07-18 00:23:05 +08:00
|
|
|
|
2020-07-17 06:10:22 +08:00
|
|
|
if (NOT ANDROID)
|
|
|
|
set(i386_SOURCES
|
|
|
|
${i386_SOURCES}
|
|
|
|
${x86_80_BIT_SOURCES}
|
|
|
|
i386/floatdixf.S
|
|
|
|
i386/floatundixf.S
|
|
|
|
)
|
|
|
|
endif()
|
|
|
|
|
2015-10-15 10:47:19 +08:00
|
|
|
if (WIN32)
|
|
|
|
set(i386_SOURCES
|
2019-04-06 05:30:40 +08:00
|
|
|
${i386_SOURCES}
|
|
|
|
i386/chkstk.S
|
|
|
|
i386/chkstk2.S
|
|
|
|
)
|
2015-10-15 10:47:19 +08:00
|
|
|
endif()
|
|
|
|
else () # MSVC
|
|
|
|
# Use C versions of functions when building on MSVC
|
2016-02-20 20:56:04 +08:00
|
|
|
# MSVC's assembler takes Intel syntax, not AT&T syntax.
|
|
|
|
# Also use only MSVC compilable builtin implementations.
|
2015-10-15 10:47:19 +08:00
|
|
|
set(x86_64_SOURCES
|
2020-06-19 14:59:36 +08:00
|
|
|
${GENERIC_SOURCES}
|
|
|
|
${x86_ARCH_SOURCES}
|
2019-04-06 05:30:40 +08:00
|
|
|
x86_64/floatdidf.c
|
|
|
|
x86_64/floatdisf.c
|
|
|
|
)
|
2020-06-19 14:59:36 +08:00
|
|
|
set(i386_SOURCES ${GENERIC_SOURCES} ${x86_ARCH_SOURCES})
|
2015-10-15 10:47:19 +08:00
|
|
|
endif () # if (NOT MSVC)
|
2014-10-01 20:55:06 +08:00
|
|
|
|
2014-02-14 17:20:33 +08:00
|
|
|
set(arm_SOURCES
|
2019-09-05 09:05:05 +08:00
|
|
|
arm/fp_mode.c
|
2016-08-05 05:58:39 +08:00
|
|
|
arm/bswapdi2.S
|
|
|
|
arm/bswapsi2.S
|
|
|
|
arm/clzdi2.S
|
|
|
|
arm/clzsi2.S
|
|
|
|
arm/comparesf2.S
|
|
|
|
arm/divmodsi4.S
|
|
|
|
arm/divsi3.S
|
|
|
|
arm/modsi3.S
|
|
|
|
arm/sync_fetch_and_add_4.S
|
|
|
|
arm/sync_fetch_and_add_8.S
|
|
|
|
arm/sync_fetch_and_and_4.S
|
|
|
|
arm/sync_fetch_and_and_8.S
|
|
|
|
arm/sync_fetch_and_max_4.S
|
|
|
|
arm/sync_fetch_and_max_8.S
|
|
|
|
arm/sync_fetch_and_min_4.S
|
|
|
|
arm/sync_fetch_and_min_8.S
|
|
|
|
arm/sync_fetch_and_nand_4.S
|
|
|
|
arm/sync_fetch_and_nand_8.S
|
|
|
|
arm/sync_fetch_and_or_4.S
|
|
|
|
arm/sync_fetch_and_or_8.S
|
|
|
|
arm/sync_fetch_and_sub_4.S
|
|
|
|
arm/sync_fetch_and_sub_8.S
|
|
|
|
arm/sync_fetch_and_umax_4.S
|
|
|
|
arm/sync_fetch_and_umax_8.S
|
|
|
|
arm/sync_fetch_and_umin_4.S
|
|
|
|
arm/sync_fetch_and_umin_8.S
|
|
|
|
arm/sync_fetch_and_xor_4.S
|
|
|
|
arm/sync_fetch_and_xor_8.S
|
|
|
|
arm/udivmodsi4.S
|
|
|
|
arm/udivsi3.S
|
2019-04-06 05:30:40 +08:00
|
|
|
arm/umodsi3.S
|
2020-06-19 14:59:36 +08:00
|
|
|
${GENERIC_SOURCES}
|
2019-04-06 05:30:40 +08:00
|
|
|
)
|
2016-08-05 05:58:39 +08:00
|
|
|
|
2017-01-20 02:46:11 +08:00
|
|
|
set(thumb1_SOURCES
|
|
|
|
arm/divsi3.S
|
|
|
|
arm/udivsi3.S
|
|
|
|
arm/comparesf2.S
|
2017-02-06 14:04:10 +08:00
|
|
|
arm/addsf3.S
|
2019-04-06 05:30:40 +08:00
|
|
|
${GENERIC_SOURCES}
|
|
|
|
)
|
2017-01-20 02:46:11 +08:00
|
|
|
|
2016-08-05 05:58:39 +08:00
|
|
|
set(arm_EABI_SOURCES
|
2015-08-21 08:25:37 +08:00
|
|
|
arm/aeabi_cdcmp.S
|
|
|
|
arm/aeabi_cdcmpeq_check_nan.c
|
|
|
|
arm/aeabi_cfcmp.S
|
|
|
|
arm/aeabi_cfcmpeq_check_nan.c
|
2014-02-14 17:20:33 +08:00
|
|
|
arm/aeabi_dcmp.S
|
2014-09-07 05:34:02 +08:00
|
|
|
arm/aeabi_div0.c
|
2015-08-19 02:10:33 +08:00
|
|
|
arm/aeabi_drsub.c
|
2014-02-14 17:20:33 +08:00
|
|
|
arm/aeabi_fcmp.S
|
2015-08-19 02:10:33 +08:00
|
|
|
arm/aeabi_frsub.c
|
2014-02-14 17:20:33 +08:00
|
|
|
arm/aeabi_idivmod.S
|
|
|
|
arm/aeabi_ldivmod.S
|
|
|
|
arm/aeabi_memcmp.S
|
|
|
|
arm/aeabi_memcpy.S
|
|
|
|
arm/aeabi_memmove.S
|
|
|
|
arm/aeabi_memset.S
|
|
|
|
arm/aeabi_uidivmod.S
|
2019-04-06 05:30:40 +08:00
|
|
|
arm/aeabi_uldivmod.S
|
|
|
|
)
|
2017-01-20 02:46:11 +08:00
|
|
|
|
2016-08-06 00:24:56 +08:00
|
|
|
set(arm_Thumb1_JT_SOURCES
|
|
|
|
arm/switch16.S
|
|
|
|
arm/switch32.S
|
|
|
|
arm/switch8.S
|
2019-04-06 05:30:40 +08:00
|
|
|
arm/switchu8.S
|
|
|
|
)
|
2016-08-06 00:24:56 +08:00
|
|
|
set(arm_Thumb1_SjLj_EH_SOURCES
|
|
|
|
arm/restore_vfp_d8_d15_regs.S
|
2019-04-06 05:30:40 +08:00
|
|
|
arm/save_vfp_d8_d15_regs.S
|
|
|
|
)
|
2020-11-12 22:44:54 +08:00
|
|
|
set(arm_Thumb1_VFPv2_DP_SOURCES
|
2016-08-05 05:58:39 +08:00
|
|
|
arm/adddf3vfp.S
|
2014-02-14 17:20:33 +08:00
|
|
|
arm/divdf3vfp.S
|
|
|
|
arm/eqdf2vfp.S
|
|
|
|
arm/extendsfdf2vfp.S
|
|
|
|
arm/fixdfsivfp.S
|
|
|
|
arm/fixunsdfsivfp.S
|
|
|
|
arm/floatsidfvfp.S
|
|
|
|
arm/floatunssidfvfp.S
|
|
|
|
arm/gedf2vfp.S
|
|
|
|
arm/gtdf2vfp.S
|
|
|
|
arm/ledf2vfp.S
|
|
|
|
arm/ltdf2vfp.S
|
|
|
|
arm/muldf3vfp.S
|
|
|
|
arm/nedf2vfp.S
|
|
|
|
arm/negdf2vfp.S
|
|
|
|
arm/subdf3vfp.S
|
|
|
|
arm/truncdfsf2vfp.S
|
|
|
|
arm/unorddf2vfp.S
|
2020-11-12 22:44:54 +08:00
|
|
|
)
|
|
|
|
set(arm_Thumb1_VFPv2_SP_SOURCES
|
|
|
|
arm/addsf3vfp.S
|
|
|
|
arm/divsf3vfp.S
|
|
|
|
arm/eqsf2vfp.S
|
|
|
|
arm/fixsfsivfp.S
|
|
|
|
arm/fixunssfsivfp.S
|
|
|
|
arm/floatsisfvfp.S
|
|
|
|
arm/floatunssisfvfp.S
|
|
|
|
arm/gesf2vfp.S
|
|
|
|
arm/gtsf2vfp.S
|
|
|
|
arm/lesf2vfp.S
|
|
|
|
arm/ltsf2vfp.S
|
|
|
|
arm/mulsf3vfp.S
|
|
|
|
arm/negsf2vfp.S
|
|
|
|
arm/nesf2vfp.S
|
|
|
|
arm/subsf3vfp.S
|
2019-04-06 05:30:40 +08:00
|
|
|
arm/unordsf2vfp.S
|
|
|
|
)
|
2016-08-06 00:24:56 +08:00
|
|
|
set(arm_Thumb1_icache_SOURCES
|
2019-04-06 05:30:40 +08:00
|
|
|
arm/sync_synchronize.S
|
|
|
|
)
|
2018-05-25 05:36:27 +08:00
|
|
|
set(arm_Thumb1_SOURCES
|
|
|
|
${arm_Thumb1_JT_SOURCES}
|
|
|
|
${arm_Thumb1_SjLj_EH_SOURCES}
|
2020-11-12 22:44:54 +08:00
|
|
|
${arm_Thumb1_VFPv2_DP_SOURCES}
|
|
|
|
${arm_Thumb1_VFPv2_SP_SOURCES}
|
2019-04-06 05:30:40 +08:00
|
|
|
${arm_Thumb1_icache_SOURCES}
|
|
|
|
)
|
2016-08-05 05:58:39 +08:00
|
|
|
|
2016-11-20 05:22:38 +08:00
|
|
|
if(MINGW)
|
|
|
|
set(arm_SOURCES
|
2019-04-06 05:30:40 +08:00
|
|
|
arm/aeabi_idivmod.S
|
|
|
|
arm/aeabi_ldivmod.S
|
|
|
|
arm/aeabi_uidivmod.S
|
|
|
|
arm/aeabi_uldivmod.S
|
|
|
|
arm/chkstk.S
|
|
|
|
mingw_fixfloat.c
|
2021-03-12 04:17:48 +08:00
|
|
|
${arm_SOURCES}
|
2019-04-06 05:30:40 +08:00
|
|
|
)
|
2016-12-02 06:00:54 +08:00
|
|
|
elseif(NOT WIN32)
|
2016-08-06 00:24:56 +08:00
|
|
|
# TODO the EABI sources should only be added to EABI targets
|
2016-08-05 05:58:39 +08:00
|
|
|
set(arm_SOURCES
|
|
|
|
${arm_SOURCES}
|
|
|
|
${arm_EABI_SOURCES}
|
2019-04-06 05:30:40 +08:00
|
|
|
${arm_Thumb1_SOURCES}
|
|
|
|
)
|
2017-01-20 02:46:11 +08:00
|
|
|
|
|
|
|
set(thumb1_SOURCES
|
|
|
|
${thumb1_SOURCES}
|
2019-04-06 05:30:40 +08:00
|
|
|
${arm_EABI_SOURCES}
|
|
|
|
)
|
2016-08-05 05:58:39 +08:00
|
|
|
endif()
|
2014-02-14 17:20:33 +08:00
|
|
|
|
[compiler-rt] Add AArch64 to CMake configuration and several missing builtins
Summary:
Currently CMake doesn't build builtins for AArch64 and if one does this anyway
it's likely that at least `__multc3`, `__floatditf` and `__floatunditf` will be
missing. There is actually more builtins to add, but these come from
different libc implementations, thus providing them makes compiler-rt for
AArch64 good enough at least for basic usage.
Builtins implementation were originally taken from FreeBSD project:
* [[ https://reviews.freebsd.org/D2173 | __multc3 ]]
* [[ https://reviews.freebsd.org/D2174 | __floatditf and __floatunditf ]]
Until they have been tested to find mistakes in `__float*` functions.
`__floatditf` was based on `__floatsitf`, which had the same mistakes
(fixed it in r243746).
Version of the builtins in this patch are fixed and complemented with basic
tests. Additionally they were tested via GCC's torture (this is what revealed
these issues).
P.S. Ed (author of FreeBSD patches) asked for feedback on the list some time ago (here [[ http://lists.cs.uiuc.edu/pipermail/llvmdev/2015-March/084064.html | here ]])
and got no response, but it seems to be worth adding these builtins as is and
extracting common part later.
Reviewers: howard.hinnant, t.p.northover, jmolloy, enefaim, rengolin, zatrazz
Subscribers: asl, emaste, samsonov, aemerson, llvm-commits, rengolin
Differential Revision: http://reviews.llvm.org/D11679
llvm-svn: 245296
2015-08-18 21:43:37 +08:00
|
|
|
set(aarch64_SOURCES
|
2017-05-04 21:34:17 +08:00
|
|
|
${GENERIC_TF_SOURCES}
|
2019-04-06 05:30:40 +08:00
|
|
|
${GENERIC_SOURCES}
|
2020-11-20 23:02:57 +08:00
|
|
|
cpu_model.c
|
2019-09-05 09:05:05 +08:00
|
|
|
aarch64/fp_mode.c
|
2019-04-06 05:30:40 +08:00
|
|
|
)
|
[compiler-rt] Add AArch64 to CMake configuration and several missing builtins
Summary:
Currently CMake doesn't build builtins for AArch64 and if one does this anyway
it's likely that at least `__multc3`, `__floatditf` and `__floatunditf` will be
missing. There is actually more builtins to add, but these come from
different libc implementations, thus providing them makes compiler-rt for
AArch64 good enough at least for basic usage.
Builtins implementation were originally taken from FreeBSD project:
* [[ https://reviews.freebsd.org/D2173 | __multc3 ]]
* [[ https://reviews.freebsd.org/D2174 | __floatditf and __floatunditf ]]
Until they have been tested to find mistakes in `__float*` functions.
`__floatditf` was based on `__floatsitf`, which had the same mistakes
(fixed it in r243746).
Version of the builtins in this patch are fixed and complemented with basic
tests. Additionally they were tested via GCC's torture (this is what revealed
these issues).
P.S. Ed (author of FreeBSD patches) asked for feedback on the list some time ago (here [[ http://lists.cs.uiuc.edu/pipermail/llvmdev/2015-March/084064.html | here ]])
and got no response, but it seems to be worth adding these builtins as is and
extracting common part later.
Reviewers: howard.hinnant, t.p.northover, jmolloy, enefaim, rengolin, zatrazz
Subscribers: asl, emaste, samsonov, aemerson, llvm-commits, rengolin
Differential Revision: http://reviews.llvm.org/D11679
llvm-svn: 245296
2015-08-18 21:43:37 +08:00
|
|
|
|
2020-11-20 23:02:57 +08:00
|
|
|
# Generate outline atomics helpers from lse.S base
|
2020-12-06 04:45:22 +08:00
|
|
|
set(OA_HELPERS_DIR "${CMAKE_CURRENT_BINARY_DIR}/outline_atomic_helpers.dir")
|
2020-12-15 14:15:58 +08:00
|
|
|
file(MAKE_DIRECTORY "${OA_HELPERS_DIR}")
|
2020-11-20 23:02:57 +08:00
|
|
|
|
2021-03-06 17:45:57 +08:00
|
|
|
if(CMAKE_HOST_UNIX)
|
|
|
|
set(COMPILER_RT_LINK_OR_COPY create_symlink)
|
|
|
|
else()
|
|
|
|
set(COMPILER_RT_LINK_OR_COPY copy)
|
|
|
|
endif()
|
|
|
|
|
2020-11-20 23:02:57 +08:00
|
|
|
foreach(pat cas swp ldadd ldclr ldeor ldset)
|
|
|
|
foreach(size 1 2 4 8 16)
|
|
|
|
foreach(model 1 2 3 4)
|
|
|
|
if(pat STREQUAL "cas" OR NOT size STREQUAL "16")
|
2020-12-15 14:15:58 +08:00
|
|
|
set(helper_asm "${OA_HELPERS_DIR}/outline_atomic_${pat}${size}_${model}.S")
|
2020-11-20 23:02:57 +08:00
|
|
|
add_custom_command(
|
|
|
|
OUTPUT ${helper_asm}
|
2021-03-06 17:45:57 +08:00
|
|
|
COMMAND ${CMAKE_COMMAND} -E ${COMPILER_RT_LINK_OR_COPY} "${CMAKE_CURRENT_SOURCE_DIR}/aarch64/lse.S" "${helper_asm}"
|
2020-11-20 23:02:57 +08:00
|
|
|
)
|
2020-12-15 14:15:58 +08:00
|
|
|
set_source_files_properties("${helper_asm}"
|
|
|
|
PROPERTIES
|
|
|
|
COMPILE_DEFINITIONS "L_${pat};SIZE=${size};MODEL=${model}"
|
|
|
|
INCLUDE_DIRECTORIES "${CMAKE_CURRENT_SOURCE_DIR}"
|
2020-11-20 23:02:57 +08:00
|
|
|
)
|
2020-12-15 14:15:58 +08:00
|
|
|
list(APPEND aarch64_SOURCES "${helper_asm}")
|
2020-11-20 23:02:57 +08:00
|
|
|
endif()
|
|
|
|
endforeach(model)
|
|
|
|
endforeach(size)
|
|
|
|
endforeach(pat)
|
|
|
|
|
2017-12-20 14:52:52 +08:00
|
|
|
if (MINGW)
|
|
|
|
set(aarch64_SOURCES
|
2019-04-06 05:30:40 +08:00
|
|
|
${aarch64_SOURCES}
|
|
|
|
aarch64/chkstk.S
|
|
|
|
)
|
2017-12-20 14:52:52 +08:00
|
|
|
endif()
|
|
|
|
|
2015-09-26 11:26:01 +08:00
|
|
|
set(armhf_SOURCES ${arm_SOURCES})
|
2015-09-01 05:24:50 +08:00
|
|
|
set(armv7_SOURCES ${arm_SOURCES})
|
|
|
|
set(armv7s_SOURCES ${arm_SOURCES})
|
2016-02-02 10:01:17 +08:00
|
|
|
set(armv7k_SOURCES ${arm_SOURCES})
|
2015-09-01 05:24:50 +08:00
|
|
|
set(arm64_SOURCES ${aarch64_SOURCES})
|
2020-03-12 10:58:15 +08:00
|
|
|
set(arm64e_SOURCES ${aarch64_SOURCES})
|
2021-04-02 08:15:56 +08:00
|
|
|
set(arm64_32_SOURCES ${aarch64_SOURCES})
|
2015-09-01 05:24:50 +08:00
|
|
|
|
2015-09-30 07:13:45 +08:00
|
|
|
# macho_embedded archs
|
2017-01-20 02:46:11 +08:00
|
|
|
set(armv6m_SOURCES ${thumb1_SOURCES})
|
2015-09-30 07:13:45 +08:00
|
|
|
set(armv7m_SOURCES ${arm_SOURCES})
|
|
|
|
set(armv7em_SOURCES ${arm_SOURCES})
|
2021-03-30 23:57:50 +08:00
|
|
|
set(armv8m.main_SOURCES ${arm_SOURCES})
|
|
|
|
set(armv8.1m.main_SOURCES ${arm_SOURCES})
|
2015-09-30 07:13:45 +08:00
|
|
|
|
2018-05-09 22:44:54 +08:00
|
|
|
# hexagon arch
|
|
|
|
set(hexagon_SOURCES
|
|
|
|
hexagon/common_entry_exit_abi1.S
|
|
|
|
hexagon/common_entry_exit_abi2.S
|
|
|
|
hexagon/common_entry_exit_legacy.S
|
|
|
|
hexagon/dfaddsub.S
|
|
|
|
hexagon/dfdiv.S
|
|
|
|
hexagon/dffma.S
|
|
|
|
hexagon/dfminmax.S
|
|
|
|
hexagon/dfmul.S
|
|
|
|
hexagon/dfsqrt.S
|
|
|
|
hexagon/divdi3.S
|
|
|
|
hexagon/divsi3.S
|
|
|
|
hexagon/fastmath2_dlib_asm.S
|
|
|
|
hexagon/fastmath2_ldlib_asm.S
|
|
|
|
hexagon/fastmath_dlib_asm.S
|
|
|
|
hexagon/memcpy_forward_vp4cp4n2.S
|
|
|
|
hexagon/memcpy_likely_aligned.S
|
|
|
|
hexagon/moddi3.S
|
|
|
|
hexagon/modsi3.S
|
|
|
|
hexagon/sfdiv_opt.S
|
|
|
|
hexagon/sfsqrt_opt.S
|
|
|
|
hexagon/udivdi3.S
|
|
|
|
hexagon/udivmoddi4.S
|
|
|
|
hexagon/udivmodsi4.S
|
|
|
|
hexagon/udivsi3.S
|
|
|
|
hexagon/umoddi3.S
|
2019-04-06 05:30:40 +08:00
|
|
|
hexagon/umodsi3.S
|
2020-02-22 03:41:22 +08:00
|
|
|
${GENERIC_SOURCES}
|
|
|
|
${GENERIC_TF_SOURCES}
|
2019-04-06 05:30:40 +08:00
|
|
|
)
|
2018-05-09 22:44:54 +08:00
|
|
|
|
|
|
|
|
2015-10-06 17:02:38 +08:00
|
|
|
set(mips_SOURCES ${GENERIC_SOURCES})
|
|
|
|
set(mipsel_SOURCES ${mips_SOURCES})
|
2017-05-04 21:34:17 +08:00
|
|
|
set(mips64_SOURCES ${GENERIC_TF_SOURCES}
|
|
|
|
${mips_SOURCES})
|
|
|
|
set(mips64el_SOURCES ${GENERIC_TF_SOURCES}
|
|
|
|
${mips_SOURCES})
|
2015-10-06 17:02:38 +08:00
|
|
|
|
2020-09-03 23:40:13 +08:00
|
|
|
set(powerpc_SOURCES ${GENERIC_SOURCES})
|
|
|
|
|
2017-12-01 05:04:11 +08:00
|
|
|
set(powerpc64_SOURCES
|
|
|
|
ppc/divtc3.c
|
|
|
|
ppc/fixtfdi.c
|
|
|
|
ppc/fixunstfdi.c
|
|
|
|
ppc/floatditf.c
|
|
|
|
ppc/floatunditf.c
|
|
|
|
ppc/gcc_qadd.c
|
|
|
|
ppc/gcc_qdiv.c
|
|
|
|
ppc/gcc_qmul.c
|
|
|
|
ppc/gcc_qsub.c
|
|
|
|
ppc/multc3.c
|
2019-04-06 05:30:40 +08:00
|
|
|
${GENERIC_SOURCES}
|
|
|
|
)
|
2020-08-25 23:30:17 +08:00
|
|
|
# These routines require __int128, which isn't supported on AIX.
|
|
|
|
if (NOT ${CMAKE_SYSTEM_NAME} MATCHES "AIX")
|
|
|
|
set(powerpc64_SOURCES
|
|
|
|
ppc/floattitf.c
|
|
|
|
ppc/fixtfti.c
|
|
|
|
ppc/fixunstfti.c
|
|
|
|
${powerpc64_SOURCES}
|
|
|
|
)
|
|
|
|
endif()
|
2017-12-01 05:04:11 +08:00
|
|
|
set(powerpc64le_SOURCES ${powerpc64_SOURCES})
|
|
|
|
|
2020-11-13 00:33:03 +08:00
|
|
|
set(riscv_SOURCES
|
|
|
|
riscv/save.S
|
|
|
|
riscv/restore.S
|
|
|
|
${GENERIC_SOURCES}
|
|
|
|
${GENERIC_TF_SOURCES}
|
|
|
|
)
|
2018-03-01 15:47:27 +08:00
|
|
|
set(riscv32_SOURCES
|
|
|
|
riscv/mulsi3.S
|
2019-04-06 05:30:40 +08:00
|
|
|
${riscv_SOURCES}
|
|
|
|
)
|
2020-08-21 20:04:25 +08:00
|
|
|
set(riscv64_SOURCES
|
|
|
|
riscv/muldi3.S
|
|
|
|
${riscv_SOURCES}
|
|
|
|
)
|
2018-03-01 15:47:27 +08:00
|
|
|
|
2019-07-12 16:30:17 +08:00
|
|
|
set(sparc_SOURCES ${GENERIC_SOURCES} ${GENERIC_TF_SOURCES})
|
|
|
|
set(sparcv9_SOURCES ${GENERIC_SOURCES} ${GENERIC_TF_SOURCES})
|
|
|
|
|
2017-11-08 03:03:11 +08:00
|
|
|
set(wasm32_SOURCES
|
|
|
|
${GENERIC_TF_SOURCES}
|
2019-04-06 05:30:40 +08:00
|
|
|
${GENERIC_SOURCES}
|
|
|
|
)
|
2017-11-08 03:03:11 +08:00
|
|
|
set(wasm64_SOURCES
|
|
|
|
${GENERIC_TF_SOURCES}
|
2019-04-06 05:30:40 +08:00
|
|
|
${GENERIC_SOURCES}
|
|
|
|
)
|
2016-01-14 00:56:15 +08:00
|
|
|
|
2020-05-27 15:39:39 +08:00
|
|
|
set(ve_SOURCES
|
|
|
|
ve/grow_stack.S
|
|
|
|
ve/grow_stack_align.S
|
|
|
|
${GENERIC_TF_SOURCES}
|
|
|
|
${GENERIC_SOURCES})
|
|
|
|
|
2014-02-18 17:33:45 +08:00
|
|
|
add_custom_target(builtins)
|
2016-07-12 05:51:56 +08:00
|
|
|
set_target_properties(builtins PROPERTIES FOLDER "Compiler-RT Misc")
|
2014-02-18 17:33:45 +08:00
|
|
|
|
2015-09-01 05:24:50 +08:00
|
|
|
if (APPLE)
|
2015-09-30 07:21:07 +08:00
|
|
|
add_subdirectory(Darwin-excludes)
|
|
|
|
add_subdirectory(macho_embedded)
|
2015-09-23 23:18:17 +08:00
|
|
|
darwin_add_builtin_libraries(${BUILTIN_SUPPORTED_OS})
|
2016-02-20 20:56:04 +08:00
|
|
|
else ()
|
2016-08-23 04:33:47 +08:00
|
|
|
set(BUILTIN_CFLAGS "")
|
2016-10-29 07:19:03 +08:00
|
|
|
|
2020-12-04 02:29:45 +08:00
|
|
|
append_list_if(COMPILER_RT_HAS_FLOAT16 -DCOMPILER_RT_HAS_FLOAT16 BUILTIN_CFLAGS)
|
|
|
|
|
2016-11-29 10:31:40 +08:00
|
|
|
append_list_if(COMPILER_RT_HAS_STD_C11_FLAG -std=c11 BUILTIN_CFLAGS)
|
2016-08-23 04:33:47 +08:00
|
|
|
|
|
|
|
# These flags would normally be added to CMAKE_C_FLAGS by the llvm
|
|
|
|
# cmake step. Add them manually if this is a standalone build.
|
|
|
|
if(COMPILER_RT_STANDALONE_BUILD)
|
2020-02-01 07:57:18 +08:00
|
|
|
if(COMPILER_RT_BUILTINS_ENABLE_PIC)
|
|
|
|
append_list_if(COMPILER_RT_HAS_FPIC_FLAG -fPIC BUILTIN_CFLAGS)
|
|
|
|
endif()
|
2016-08-23 04:33:47 +08:00
|
|
|
append_list_if(COMPILER_RT_HAS_FNO_BUILTIN_FLAG -fno-builtin BUILTIN_CFLAGS)
|
[builtins] Add COMPILER_RT_BUILTINS_HIDE_SYMBOLS
On Android, when the builtins are linked into a binary, they are
typically linked using -Wl,--exclude-libs so that the symbols aren't
reexported. For the NDK, compiler-rt's default behavior (build the
builtins archive with -fvisibility=hidden) is better so that builtins
are hidden even without -Wl,--exclude-libs.
Android needs the builtins with non-hidden symbols only for a special
case: for backwards compatibility with old binaries, the libc.so and
libm.so DSOs in the platform need to export some builtins for arm32 and
32-bit x86. See D56977.
Control the behavior with a new flag,
`COMPILER_RT_BUILTINS_HIDE_SYMBOLS`, that behaves similarly to the
`*_HERMETIC_STATIC_LIBRARY` in libunwind/libcxx/libcxxabi, so that
Android can build a special builtins variant for libc.so/libm.so.
Unlike the hermetic flags for other projects, this new flag is enabled
by default.
Reviewed By: compnerd, MaskRay
Differential Revision: https://reviews.llvm.org/D93431
2021-01-08 09:49:29 +08:00
|
|
|
if(COMPILER_RT_BUILTINS_HIDE_SYMBOLS)
|
2019-01-23 09:59:35 +08:00
|
|
|
append_list_if(COMPILER_RT_HAS_VISIBILITY_HIDDEN_FLAG -fvisibility=hidden BUILTIN_CFLAGS)
|
|
|
|
endif()
|
2016-08-23 04:33:47 +08:00
|
|
|
if(NOT COMPILER_RT_DEBUG)
|
|
|
|
append_list_if(COMPILER_RT_HAS_OMIT_FRAME_POINTER_FLAG -fomit-frame-pointer BUILTIN_CFLAGS)
|
|
|
|
endif()
|
|
|
|
endif()
|
2015-11-20 11:37:12 +08:00
|
|
|
|
2016-10-29 07:19:03 +08:00
|
|
|
set(BUILTIN_DEFS "")
|
|
|
|
|
[builtins] Add COMPILER_RT_BUILTINS_HIDE_SYMBOLS
On Android, when the builtins are linked into a binary, they are
typically linked using -Wl,--exclude-libs so that the symbols aren't
reexported. For the NDK, compiler-rt's default behavior (build the
builtins archive with -fvisibility=hidden) is better so that builtins
are hidden even without -Wl,--exclude-libs.
Android needs the builtins with non-hidden symbols only for a special
case: for backwards compatibility with old binaries, the libc.so and
libm.so DSOs in the platform need to export some builtins for arm32 and
32-bit x86. See D56977.
Control the behavior with a new flag,
`COMPILER_RT_BUILTINS_HIDE_SYMBOLS`, that behaves similarly to the
`*_HERMETIC_STATIC_LIBRARY` in libunwind/libcxx/libcxxabi, so that
Android can build a special builtins variant for libc.so/libm.so.
Unlike the hermetic flags for other projects, this new flag is enabled
by default.
Reviewed By: compnerd, MaskRay
Differential Revision: https://reviews.llvm.org/D93431
2021-01-08 09:49:29 +08:00
|
|
|
if(COMPILER_RT_BUILTINS_HIDE_SYMBOLS)
|
2019-01-23 09:59:35 +08:00
|
|
|
append_list_if(COMPILER_RT_HAS_VISIBILITY_HIDDEN_FLAG VISIBILITY_HIDDEN BUILTIN_DEFS)
|
|
|
|
endif()
|
2016-10-29 07:19:03 +08:00
|
|
|
|
2020-12-15 14:15:58 +08:00
|
|
|
append_list_if(COMPILER_RT_HAS_ASM_LSE HAS_ASM_LSE BUILTIN_DEFS)
|
|
|
|
|
2015-09-01 05:24:50 +08:00
|
|
|
foreach (arch ${BUILTIN_SUPPORTED_ARCH})
|
2014-07-27 07:44:22 +08:00
|
|
|
if (CAN_TARGET_${arch})
|
2021-06-01 20:26:51 +08:00
|
|
|
set(BUILTIN_CFLAGS_${arch} ${BUILTIN_CFLAGS})
|
[cmake] [ARM] Exclude any VFP builtins if VFP is not supported
Summary:
rL325492 disables FPU features when using soft floating point
(-mfloat-abi=soft), which is used internally when building for arm. This causes
errors with builtins that utililize VFP instructions.
With this change we check if VFP is enabled (by checking if the preprocessor
macro __VFP_FP__ is defined), and exclude such builtins if it is not enabled.
Reviewers: rengolin, samsonov, compnerd, smeenai, javed.absar, peter.smith
Reviewed By: peter.smith
Subscribers: delcypher, peter.smith, mgorny, kristof.beyls, chrib, llvm-commits
Differential Revision: https://reviews.llvm.org/D47217
llvm-svn: 338284
2018-07-31 02:18:59 +08:00
|
|
|
# For ARM archs, exclude any VFP builtins if VFP is not supported
|
2021-03-30 23:57:50 +08:00
|
|
|
if (${arch} MATCHES "^(arm|armhf|armv7|armv7s|armv7k|armv7m|armv7em|armv8m.main|armv8.1m.main)$")
|
[cmake] [ARM] Exclude any VFP builtins if VFP is not supported
Summary:
rL325492 disables FPU features when using soft floating point
(-mfloat-abi=soft), which is used internally when building for arm. This causes
errors with builtins that utililize VFP instructions.
With this change we check if VFP is enabled (by checking if the preprocessor
macro __VFP_FP__ is defined), and exclude such builtins if it is not enabled.
Reviewers: rengolin, samsonov, compnerd, smeenai, javed.absar, peter.smith
Reviewed By: peter.smith
Subscribers: delcypher, peter.smith, mgorny, kristof.beyls, chrib, llvm-commits
Differential Revision: https://reviews.llvm.org/D47217
llvm-svn: 338284
2018-07-31 02:18:59 +08:00
|
|
|
string(REPLACE ";" " " _TARGET_${arch}_CFLAGS "${TARGET_${arch}_CFLAGS}")
|
2020-12-05 12:53:23 +08:00
|
|
|
check_compile_definition(__ARM_FP "${CMAKE_C_FLAGS} ${_TARGET_${arch}_CFLAGS}" COMPILER_RT_HAS_${arch}_VFP)
|
[cmake] [ARM] Exclude any VFP builtins if VFP is not supported
Summary:
rL325492 disables FPU features when using soft floating point
(-mfloat-abi=soft), which is used internally when building for arm. This causes
errors with builtins that utililize VFP instructions.
With this change we check if VFP is enabled (by checking if the preprocessor
macro __VFP_FP__ is defined), and exclude such builtins if it is not enabled.
Reviewers: rengolin, samsonov, compnerd, smeenai, javed.absar, peter.smith
Reviewed By: peter.smith
Subscribers: delcypher, peter.smith, mgorny, kristof.beyls, chrib, llvm-commits
Differential Revision: https://reviews.llvm.org/D47217
llvm-svn: 338284
2018-07-31 02:18:59 +08:00
|
|
|
if(NOT COMPILER_RT_HAS_${arch}_VFP)
|
2020-11-12 22:44:54 +08:00
|
|
|
list(REMOVE_ITEM ${arch}_SOURCES ${arm_Thumb1_VFPv2_DP_SOURCES} ${arm_Thumb1_VFPv2_SP_SOURCES} ${arm_Thumb1_SjLj_EH_SOURCES})
|
|
|
|
else()
|
|
|
|
# Exclude any double-precision builtins if VFP is single-precision-only
|
2021-03-12 04:14:45 +08:00
|
|
|
try_compile_only(COMPILER_RT_HAS_${arch}_VFP_DP
|
|
|
|
SOURCE "#if !(__ARM_FP & 0x8)
|
2020-11-12 22:44:54 +08:00
|
|
|
#error No double-precision support!
|
|
|
|
#endif
|
2021-03-12 04:14:45 +08:00
|
|
|
int main() { return 0; }")
|
2020-11-12 22:44:54 +08:00
|
|
|
if(NOT COMPILER_RT_HAS_${arch}_VFP_DP)
|
|
|
|
list(REMOVE_ITEM ${arch}_SOURCES ${arm_Thumb1_VFPv2_DP_SOURCES})
|
|
|
|
endif()
|
[cmake] [ARM] Exclude any VFP builtins if VFP is not supported
Summary:
rL325492 disables FPU features when using soft floating point
(-mfloat-abi=soft), which is used internally when building for arm. This causes
errors with builtins that utililize VFP instructions.
With this change we check if VFP is enabled (by checking if the preprocessor
macro __VFP_FP__ is defined), and exclude such builtins if it is not enabled.
Reviewers: rengolin, samsonov, compnerd, smeenai, javed.absar, peter.smith
Reviewed By: peter.smith
Subscribers: delcypher, peter.smith, mgorny, kristof.beyls, chrib, llvm-commits
Differential Revision: https://reviews.llvm.org/D47217
llvm-svn: 338284
2018-07-31 02:18:59 +08:00
|
|
|
endif()
|
|
|
|
endif()
|
|
|
|
|
2020-06-19 14:59:36 +08:00
|
|
|
# Remove a generic C builtin when an arch-specific builtin is specified.
|
|
|
|
filter_builtin_sources(${arch}_SOURCES ${arch})
|
2014-07-27 07:44:22 +08:00
|
|
|
|
2016-10-26 23:20:33 +08:00
|
|
|
# Needed for clear_cache on debug mode, due to r7's usage in inline asm.
|
|
|
|
# Release mode already sets it via -O2/3, Debug mode doesn't.
|
|
|
|
if (${arch} STREQUAL "armhf")
|
2021-06-01 20:26:51 +08:00
|
|
|
list(APPEND BUILTIN_CFLAGS_${arch} -fomit-frame-pointer -DCOMPILER_RT_ARMHF_TARGET)
|
2016-10-26 23:20:33 +08:00
|
|
|
endif()
|
|
|
|
|
[RISCV] Force enable int128 for compiling long double routines
Summary:
For RISCV32, we must force enable int128 for compiling long double routines using the flag -fforce-enable-int128.
Related clang patch: https://reviews.llvm.org/D43105
Reviewers: asb, kito-cheng, apazos, compnerd, howard.hinnant
Reviewed By: kito-cheng
Subscribers: shiva0217, efriedma, mgorny, hintonda, llvm-commits, #sanitizers
Differential Revision: https://reviews.llvm.org/D43106
llvm-svn: 326346
2018-03-01 02:24:09 +08:00
|
|
|
# For RISCV32, we must force enable int128 for compiling long
|
|
|
|
# double routines.
|
|
|
|
if("${arch}" STREQUAL "riscv32")
|
2021-06-01 20:26:51 +08:00
|
|
|
list(APPEND BUILTIN_CFLAGS_${arch} -fforce-enable-int128)
|
[RISCV] Force enable int128 for compiling long double routines
Summary:
For RISCV32, we must force enable int128 for compiling long double routines using the flag -fforce-enable-int128.
Related clang patch: https://reviews.llvm.org/D43105
Reviewers: asb, kito-cheng, apazos, compnerd, howard.hinnant
Reviewed By: kito-cheng
Subscribers: shiva0217, efriedma, mgorny, hintonda, llvm-commits, #sanitizers
Differential Revision: https://reviews.llvm.org/D43106
llvm-svn: 326346
2018-03-01 02:24:09 +08:00
|
|
|
endif()
|
|
|
|
|
2015-08-26 03:53:09 +08:00
|
|
|
add_compiler_rt_runtime(clang_rt.builtins
|
|
|
|
STATIC
|
2015-09-01 05:24:50 +08:00
|
|
|
ARCHS ${arch}
|
2014-07-27 07:44:22 +08:00
|
|
|
SOURCES ${${arch}_SOURCES}
|
2016-10-29 07:19:03 +08:00
|
|
|
DEFS ${BUILTIN_DEFS}
|
2021-06-01 20:26:51 +08:00
|
|
|
CFLAGS ${BUILTIN_CFLAGS_${arch}}
|
2015-08-26 03:53:09 +08:00
|
|
|
PARENT_TARGET builtins)
|
2014-07-27 07:44:22 +08:00
|
|
|
endif ()
|
|
|
|
endforeach ()
|
|
|
|
endif ()
|
2014-02-18 17:33:45 +08:00
|
|
|
|
2021-05-16 13:03:10 +08:00
|
|
|
option(COMPILER_RT_BUILD_STANDALONE_LIBATOMIC
|
|
|
|
"Build standalone shared atomic library."
|
|
|
|
OFF)
|
|
|
|
|
|
|
|
if(COMPILER_RT_BUILD_STANDALONE_LIBATOMIC)
|
|
|
|
add_custom_target(builtins-standalone-atomic)
|
|
|
|
set(BUILTIN_DEPS "")
|
2021-06-12 07:21:40 +08:00
|
|
|
set(BUILTIN_TYPE SHARED)
|
2021-05-16 13:03:10 +08:00
|
|
|
if(${CMAKE_SYSTEM_NAME} MATCHES "AIX")
|
|
|
|
if(NOT COMPILER_RT_LIBATOMIC_LINK_FLAGS)
|
|
|
|
get_aix_libatomic_default_link_flags(COMPILER_RT_LIBATOMIC_LINK_FLAGS
|
|
|
|
"${CMAKE_CURRENT_SOURCE_DIR}/ppc/atomic.exp")
|
|
|
|
endif()
|
|
|
|
# The compiler needs builtins to link any other binaries, so let
|
|
|
|
# clang_rt.atomic be built after builtins.
|
|
|
|
set(BUILTIN_DEPS builtins)
|
2021-06-12 07:21:40 +08:00
|
|
|
# For different versions of cmake, SHARED behaves differently. For some
|
|
|
|
# versions, we might need MODULE rather than SHARED.
|
|
|
|
get_aix_libatomic_type(BUILTIN_TYPE)
|
2021-05-16 13:03:10 +08:00
|
|
|
endif()
|
|
|
|
foreach (arch ${BUILTIN_SUPPORTED_ARCH})
|
|
|
|
if(CAN_TARGET_${arch})
|
|
|
|
add_compiler_rt_runtime(clang_rt.atomic
|
2021-06-12 07:21:40 +08:00
|
|
|
${BUILTIN_TYPE}
|
2021-05-16 13:03:10 +08:00
|
|
|
ARCHS ${arch}
|
|
|
|
SOURCES atomic.c
|
|
|
|
LINK_FLAGS ${COMPILER_RT_LIBATOMIC_LINK_FLAGS}
|
|
|
|
DEPS ${BUILTIN_DEPS}
|
|
|
|
PARENT_TARGET builtins-standalone-atomic)
|
|
|
|
endif()
|
|
|
|
endforeach()
|
|
|
|
# FIXME: On AIX, we have to archive built shared libraries into a static
|
|
|
|
# archive, i.e., libatomic.a. Once cmake adds support of such usage for AIX,
|
|
|
|
# this ad-hoc part can be removed.
|
|
|
|
if(${CMAKE_SYSTEM_NAME} MATCHES "AIX")
|
|
|
|
archive_aix_libatomic(clang_rt.atomic
|
|
|
|
ARCHS ${BUILTIN_SUPPORTED_ARCH}
|
|
|
|
PARENT_TARGET builtins-standalone-atomic)
|
|
|
|
endif()
|
|
|
|
add_dependencies(compiler-rt builtins-standalone-atomic)
|
|
|
|
endif()
|
|
|
|
|
2014-02-18 17:33:45 +08:00
|
|
|
add_dependencies(compiler-rt builtins)
|