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)
|
2016-06-01 04:21:42 +08:00
|
|
|
cmake_minimum_required(VERSION 3.4.3)
|
[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()
|
2019-06-04 10:38:15 +08:00
|
|
|
if(CMAKE_HOST_APPLE AND APPLE)
|
|
|
|
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)
|
|
|
|
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)
|
|
|
|
|
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
|
|
|
|
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
|
|
|
|
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
|
|
|
|
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
|
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()
|
|
|
|
|
2017-12-01 03:39:33 +08:00
|
|
|
# These sources work on all x86 variants, but only x86 variants.
|
|
|
|
set(x86_ARCH_SOURCES
|
|
|
|
cpu_model.c
|
|
|
|
divxc3.c
|
|
|
|
fixxfdi.c
|
|
|
|
fixxfti.c
|
|
|
|
fixunsxfdi.c
|
|
|
|
fixunsxfsi.c
|
|
|
|
fixunsxfti.c
|
|
|
|
floatdixf.c
|
|
|
|
floattixf.c
|
|
|
|
floatundixf.c
|
|
|
|
floatuntixf.c
|
|
|
|
mulxc3.c
|
|
|
|
powixf2.c
|
|
|
|
)
|
|
|
|
|
2019-11-22 06:14:33 +08:00
|
|
|
if (NOT MSVC)
|
|
|
|
set(x86_ARCH_SOURCES
|
|
|
|
${x86_ARCH_SOURCES}
|
|
|
|
i386/fp_mode.c
|
|
|
|
)
|
|
|
|
endif ()
|
|
|
|
|
2015-10-15 10:47:19 +08:00
|
|
|
if (NOT MSVC)
|
2015-07-18 00:23:05 +08:00
|
|
|
set(x86_64_SOURCES
|
2019-04-19 03:29:03 +08:00
|
|
|
${GENERIC_TF_SOURCES}
|
2019-04-06 05:30:40 +08:00
|
|
|
x86_64/floatdidf.c
|
|
|
|
x86_64/floatdisf.c
|
|
|
|
x86_64/floatdixf.c
|
|
|
|
x86_64/floatundidf.S
|
|
|
|
x86_64/floatundisf.S
|
|
|
|
x86_64/floatundixf.S
|
|
|
|
)
|
2017-08-31 01:12:57 +08:00
|
|
|
filter_builtin_sources(x86_64_SOURCES EXCLUDE x86_64_SOURCES "${x86_64_SOURCES};${GENERIC_SOURCES}")
|
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
|
2019-04-06 05:30:40 +08:00
|
|
|
i386/ashldi3.S
|
|
|
|
i386/ashrdi3.S
|
|
|
|
i386/divdi3.S
|
|
|
|
i386/floatdidf.S
|
|
|
|
i386/floatdisf.S
|
|
|
|
i386/floatdixf.S
|
|
|
|
i386/floatundidf.S
|
|
|
|
i386/floatundisf.S
|
|
|
|
i386/floatundixf.S
|
|
|
|
i386/lshrdi3.S
|
|
|
|
i386/moddi3.S
|
|
|
|
i386/muldi3.S
|
|
|
|
i386/udivdi3.S
|
|
|
|
i386/umoddi3.S
|
|
|
|
)
|
2017-08-31 01:12:57 +08:00
|
|
|
filter_builtin_sources(i386_SOURCES EXCLUDE i386_SOURCES "${i386_SOURCES};${GENERIC_SOURCES}")
|
2015-07-18 00:23:05 +08:00
|
|
|
|
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
|
2019-04-06 05:30:40 +08:00
|
|
|
x86_64/floatdidf.c
|
|
|
|
x86_64/floatdisf.c
|
|
|
|
x86_64/floatdixf.c
|
|
|
|
${GENERIC_SOURCES}
|
|
|
|
)
|
2015-10-15 10:47:19 +08:00
|
|
|
set(x86_64h_SOURCES ${x86_64_SOURCES})
|
2017-04-08 00:35:09 +08:00
|
|
|
set(i386_SOURCES ${GENERIC_SOURCES})
|
2015-10-15 10:47:19 +08:00
|
|
|
endif () # if (NOT MSVC)
|
2014-10-01 20:55:06 +08:00
|
|
|
|
2017-12-01 03:39:33 +08:00
|
|
|
set(x86_64h_SOURCES ${x86_64h_SOURCES} ${x86_ARCH_SOURCES})
|
|
|
|
set(x86_64_SOURCES ${x86_64_SOURCES} ${x86_ARCH_SOURCES})
|
|
|
|
set(i386_SOURCES ${i386_SOURCES} ${x86_ARCH_SOURCES})
|
|
|
|
set(i686_SOURCES ${i686_SOURCES} ${x86_ARCH_SOURCES})
|
|
|
|
|
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
|
|
|
|
)
|
2017-08-31 01:12:57 +08:00
|
|
|
filter_builtin_sources(arm_SOURCES EXCLUDE arm_SOURCES "${arm_SOURCES};${GENERIC_SOURCES}")
|
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
|
|
|
|
)
|
2016-08-06 00:24:56 +08:00
|
|
|
set(arm_Thumb1_VFPv2_SOURCES
|
2016-08-05 05:58:39 +08:00
|
|
|
arm/adddf3vfp.S
|
|
|
|
arm/addsf3vfp.S
|
2014-02-14 17:20:33 +08:00
|
|
|
arm/divdf3vfp.S
|
|
|
|
arm/divsf3vfp.S
|
|
|
|
arm/eqdf2vfp.S
|
|
|
|
arm/eqsf2vfp.S
|
|
|
|
arm/extendsfdf2vfp.S
|
|
|
|
arm/fixdfsivfp.S
|
|
|
|
arm/fixsfsivfp.S
|
|
|
|
arm/fixunsdfsivfp.S
|
|
|
|
arm/fixunssfsivfp.S
|
|
|
|
arm/floatsidfvfp.S
|
|
|
|
arm/floatsisfvfp.S
|
|
|
|
arm/floatunssidfvfp.S
|
|
|
|
arm/floatunssisfvfp.S
|
|
|
|
arm/gedf2vfp.S
|
|
|
|
arm/gesf2vfp.S
|
|
|
|
arm/gtdf2vfp.S
|
|
|
|
arm/gtsf2vfp.S
|
|
|
|
arm/ledf2vfp.S
|
|
|
|
arm/lesf2vfp.S
|
|
|
|
arm/ltdf2vfp.S
|
|
|
|
arm/ltsf2vfp.S
|
|
|
|
arm/muldf3vfp.S
|
|
|
|
arm/mulsf3vfp.S
|
|
|
|
arm/nedf2vfp.S
|
|
|
|
arm/negdf2vfp.S
|
|
|
|
arm/negsf2vfp.S
|
|
|
|
arm/nesf2vfp.S
|
|
|
|
arm/subdf3vfp.S
|
|
|
|
arm/subsf3vfp.S
|
|
|
|
arm/truncdfsf2vfp.S
|
|
|
|
arm/unorddf2vfp.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}
|
|
|
|
${arm_Thumb1_VFPv2_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
|
|
|
|
)
|
2017-11-14 15:07:01 +08:00
|
|
|
filter_builtin_sources(arm_SOURCES EXCLUDE arm_SOURCES "${arm_SOURCES};${GENERIC_SOURCES}")
|
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}
|
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
|
|
|
|
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})
|
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})
|
|
|
|
|
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
|
|
|
|
2017-12-01 05:04:11 +08:00
|
|
|
set(powerpc64_SOURCES
|
|
|
|
ppc/divtc3.c
|
2019-11-26 04:06:21 +08:00
|
|
|
ppc/fixtfti.c
|
2017-12-01 05:04:11 +08:00
|
|
|
ppc/fixtfdi.c
|
2019-01-10 20:30:12 +08:00
|
|
|
ppc/fixunstfti.c
|
2017-12-01 05:04:11 +08:00
|
|
|
ppc/fixunstfdi.c
|
2019-01-10 21:23:33 +08:00
|
|
|
ppc/floattitf.c
|
2017-12-01 05:04:11 +08:00
|
|
|
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}
|
|
|
|
)
|
2017-12-01 05:04:11 +08:00
|
|
|
set(powerpc64le_SOURCES ${powerpc64_SOURCES})
|
|
|
|
|
2018-03-01 15:47:27 +08:00
|
|
|
set(riscv_SOURCES ${GENERIC_SOURCES} ${GENERIC_TF_SOURCES})
|
|
|
|
set(riscv32_SOURCES
|
|
|
|
riscv/mulsi3.S
|
2019-04-06 05:30:40 +08:00
|
|
|
${riscv_SOURCES}
|
|
|
|
)
|
2018-03-01 15:47:27 +08:00
|
|
|
set(riscv64_SOURCES ${riscv_SOURCES})
|
|
|
|
|
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
|
|
|
|
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)
|
2019-01-23 09:59:35 +08:00
|
|
|
if(NOT ANDROID)
|
|
|
|
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 "")
|
|
|
|
|
2019-01-23 09:59:35 +08:00
|
|
|
if(NOT ANDROID)
|
|
|
|
append_list_if(COMPILER_RT_HAS_VISIBILITY_HIDDEN_FLAG VISIBILITY_HIDDEN BUILTIN_DEFS)
|
|
|
|
endif()
|
2016-10-29 07:19:03 +08:00
|
|
|
|
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})
|
[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
|
|
|
|
if (${arch} MATCHES "^(arm|armhf|armv7|armv7s|armv7k|armv7m|armv7em)$")
|
|
|
|
string(REPLACE ";" " " _TARGET_${arch}_CFLAGS "${TARGET_${arch}_CFLAGS}")
|
|
|
|
check_compile_definition(__VFP_FP__ "${CMAKE_C_FLAGS} ${_TARGET_${arch}_CFLAGS}" COMPILER_RT_HAS_${arch}_VFP)
|
|
|
|
if(NOT COMPILER_RT_HAS_${arch}_VFP)
|
|
|
|
list(REMOVE_ITEM ${arch}_SOURCES ${arm_Thumb1_VFPv2_SOURCES} ${arm_Thumb1_SjLj_EH_SOURCES})
|
|
|
|
endif()
|
|
|
|
endif()
|
|
|
|
|
2014-07-27 07:44:22 +08:00
|
|
|
# Filter out generic versions of routines that are re-implemented in
|
|
|
|
# architecture specific manner. This prevents multiple definitions of the
|
|
|
|
# same symbols, making the symbol selection non-deterministic.
|
|
|
|
foreach (_file ${${arch}_SOURCES})
|
[Builtins] Fix bug where powerpc builtins specializations didn't remove generic implementations.
Summary:
Previously the CMake code looked for filepaths of the form
`<arch>/<filename>` as an indication that `<arch>/<filename>` provided a
specialization of a top-level file `<filename>`. For powerpc there was a
bug because the powerpc specialized implementations lived in `ppc/` but
the architectures were `powerpc64` and `powerpc64le` which meant that
CMake was looking for files at `powerpc64/<filename>` and
`powerpc64le/<filename>`.
The result of this is that for powerpc the builtins library contained a
duplicate symbol for `divtc3` because it had the generic implementation
and the specialized version in the built static library.
Although we could just add similar code to what there is for arm (i.e.
compute `${_arch}`) to fix this, this is extremely error prone (until
r375150 no error was raised). Instead this patch takes a different
approach that removes looking for the architecture name entirely.
Instead this patch uses the convention that a source file in a
sub-directory might be a specialization of a generic implementation and
if a source file of the same name (ignoring extension) exists at the
top-level then it is the corresponding generic implementation. This
approach is much simpler because it doesn't require keeping track of
different architecture names.
This convention already existed in repository but previously it was
implicit. This change makes it explicit.
This patch is motivated by wanting to revert r375162 which worked around
the powerpc bug found when r375150 landed.
Once it lands we should revert r375162.
Reviewers: phosek, beanz, compnerd, shiva0217, amyk, rupprecht, kongyi, mstorsjo, t.p.northover, weimingz, jroelofs, joerg, sidneym
Subscribers: nemanjai, mgorny, kristof.beyls, jsji, shchenz, steven.zhang, #sanitizers, llvm-commits
Tags: #llvm, #sanitizers
Differential Revision: https://reviews.llvm.org/D69189
2019-10-19 02:09:19 +08:00
|
|
|
get_filename_component(_file_dir "${_file}" DIRECTORY)
|
|
|
|
if (NOT "${_file_dir}" STREQUAL "")
|
|
|
|
# Architecture specific file. We follow the convention that a source
|
|
|
|
# file that exists in a sub-directory (e.g. `ppc/divtc3.c`) is
|
|
|
|
# architecture specific and that if a generic implementation exists
|
|
|
|
# it will be a top-level source file with the same name modulo the
|
|
|
|
# file extension (e.g. `divtc3.c`).
|
2014-07-27 07:44:22 +08:00
|
|
|
get_filename_component(_name ${_file} NAME)
|
|
|
|
string(REPLACE ".S" ".c" _cname "${_name}")
|
[Builtins] Fix bug where powerpc builtins specializations didn't remove generic implementations.
Summary:
Previously the CMake code looked for filepaths of the form
`<arch>/<filename>` as an indication that `<arch>/<filename>` provided a
specialization of a top-level file `<filename>`. For powerpc there was a
bug because the powerpc specialized implementations lived in `ppc/` but
the architectures were `powerpc64` and `powerpc64le` which meant that
CMake was looking for files at `powerpc64/<filename>` and
`powerpc64le/<filename>`.
The result of this is that for powerpc the builtins library contained a
duplicate symbol for `divtc3` because it had the generic implementation
and the specialized version in the built static library.
Although we could just add similar code to what there is for arm (i.e.
compute `${_arch}`) to fix this, this is extremely error prone (until
r375150 no error was raised). Instead this patch takes a different
approach that removes looking for the architecture name entirely.
Instead this patch uses the convention that a source file in a
sub-directory might be a specialization of a generic implementation and
if a source file of the same name (ignoring extension) exists at the
top-level then it is the corresponding generic implementation. This
approach is much simpler because it doesn't require keeping track of
different architecture names.
This convention already existed in repository but previously it was
implicit. This change makes it explicit.
This patch is motivated by wanting to revert r375162 which worked around
the powerpc bug found when r375150 landed.
Once it lands we should revert r375162.
Reviewers: phosek, beanz, compnerd, shiva0217, amyk, rupprecht, kongyi, mstorsjo, t.p.northover, weimingz, jroelofs, joerg, sidneym
Subscribers: nemanjai, mgorny, kristof.beyls, jsji, shchenz, steven.zhang, #sanitizers, llvm-commits
Tags: #llvm, #sanitizers
Differential Revision: https://reviews.llvm.org/D69189
2019-10-19 02:09:19 +08:00
|
|
|
if (EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/${_cname}")
|
|
|
|
message(STATUS "For ${arch} builtins preferring ${_file} to ${_cname}")
|
|
|
|
list(REMOVE_ITEM ${arch}_SOURCES ${_cname})
|
|
|
|
endif()
|
2014-07-27 07:44:22 +08:00
|
|
|
endif ()
|
|
|
|
endforeach ()
|
|
|
|
|
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")
|
2017-03-29 11:36:46 +08:00
|
|
|
list(APPEND BUILTIN_CFLAGS -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")
|
|
|
|
list(APPEND BUILTIN_CFLAGS -fforce-enable-int128)
|
|
|
|
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}
|
2016-08-23 04:33:47 +08:00
|
|
|
CFLAGS ${BUILTIN_CFLAGS}
|
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
|
|
|
|
|
|
|
add_dependencies(compiler-rt builtins)
|