Skip to content

[stdlib] Added Armv5 support #41686

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 7, 2022
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: 2 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -741,6 +741,8 @@ else()
set(SWIFT_HOST_VARIANT_ARCH_default "powerpc64le")
elseif("${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "s390x")
set(SWIFT_HOST_VARIANT_ARCH_default "s390x")
elseif("${CMAKE_SYSTEM_PROCESSOR}" MATCHES "armv5|armv5te")
set(SWIFT_HOST_VARIANT_ARCH_default "armv5")
# FIXME: Only matches v6l/v7l - by far the most common variants
elseif("${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "armv6l")
set(SWIFT_HOST_VARIANT_ARCH_default "armv6")
Expand Down
2 changes: 1 addition & 1 deletion cmake/modules/AddSwift.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -344,7 +344,7 @@ function(_add_host_variant_link_flags target)
target_link_libraries(${target} PRIVATE
pthread
dl)
if("${SWIFT_HOST_VARIANT_ARCH}" MATCHES "armv6|armv7|i686")
if("${SWIFT_HOST_VARIANT_ARCH}" MATCHES "armv5|armv6|armv7|i686")
target_link_libraries(${target} PRIVATE atomic)
endif()
elseif(SWIFT_HOST_VARIANT_SDK STREQUAL FREEBSD)
Expand Down
2 changes: 1 addition & 1 deletion cmake/modules/AddSwiftUnittests.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ function(add_swift_unittest test_dirname)
if(CMAKE_SYSTEM_PROCESSOR MATCHES "x86_64|AMD64")
target_compile_options(${test_dirname} PRIVATE
-march=core2)
elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "armv6|armv7|i686")
elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "armv5|armv6|armv7|i686")
set_property(TARGET "${test_dirname}" APPEND PROPERTY LINK_LIBRARIES
"atomic")
endif()
Expand Down
4 changes: 3 additions & 1 deletion cmake/modules/SwiftConfigureSDK.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -323,7 +323,9 @@ macro(configure_sdk_unix name architectures)
endif()

if("${prefix}" STREQUAL "LINUX")
if(arch MATCHES "(armv6|armv7)")
if(arch MATCHES "(armv5)")
set(SWIFT_SDK_LINUX_ARCH_${arch}_TRIPLE "${arch}-unknown-linux-gnueabi")
elseif(arch MATCHES "(armv6|armv7)")
set(SWIFT_SDK_LINUX_ARCH_${arch}_TRIPLE "${arch}-unknown-linux-gnueabihf")
elseif(arch MATCHES "(aarch64|i686|powerpc64|powerpc64le|s390x|x86_64)")
set(SWIFT_SDK_LINUX_ARCH_${arch}_TRIPLE "${arch}-unknown-linux-gnu")
Expand Down
1 change: 1 addition & 0 deletions cmake/modules/SwiftSetIfArchBitness.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ function(set_if_arch_bitness var_name)
if("${SIA_ARCH}" STREQUAL "i386" OR
"${SIA_ARCH}" STREQUAL "i686" OR
"${SIA_ARCH}" STREQUAL "x86" OR
"${SIA_ARCH}" STREQUAL "armv5" OR
"${SIA_ARCH}" STREQUAL "armv6" OR
"${SIA_ARCH}" STREQUAL "armv7" OR
"${SIA_ARCH}" STREQUAL "armv7k" OR
Expand Down
2 changes: 2 additions & 0 deletions lib/Basic/Platform.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,8 @@ StringRef swift::getMajorArchitectureName(const llvm::Triple &Triple) {
return "armv7";
case llvm::Triple::SubArchType::ARMSubArch_v6:
return "armv6";
case llvm::Triple::SubArchType::ARMSubArch_v5:
return "armv5";
default:
break;
}
Expand Down
4 changes: 4 additions & 0 deletions lib/IDE/Utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -400,6 +400,10 @@ static std::string adjustClangTriple(StringRef TripleStr) {
OS << "armv6k"; break;
case llvm::Triple::SubArchType::ARMSubArch_v6t2:
OS << "armv6t2"; break;
case llvm::Triple::SubArchType::ARMSubArch_v5:
OS << "armv5"; break;
case llvm::Triple::SubArchType::ARMSubArch_v5te:
OS << "armv5te"; break;
default:
// Adjust i386-macosx to x86_64 because there is no Swift stdlib for i386.
if ((Triple.getOS() == llvm::Triple::MacOSX ||
Expand Down
2 changes: 1 addition & 1 deletion stdlib/cmake/modules/AddSwiftStdlib.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -418,7 +418,7 @@ function(_add_target_variant_link_flags)
MACCATALYST_BUILD_FLAVOR "${LFLAGS_MACCATALYST_BUILD_FLAVOR}")
if("${LFLAGS_SDK}" STREQUAL "LINUX")
list(APPEND link_libraries "pthread" "dl")
if("${LFLAGS_ARCH}" MATCHES "armv6|armv7|i686")
if("${LFLAGS_ARCH}" MATCHES "armv5|armv6|armv7|i686")
list(APPEND link_libraries "atomic")
endif()
elseif("${LFLAGS_SDK}" STREQUAL "FREEBSD")
Expand Down
7 changes: 6 additions & 1 deletion utils/build-script-impl
Original file line number Diff line number Diff line change
Expand Up @@ -458,6 +458,7 @@ function verify_host_is_supported() {
| haiku-x86_64 \
| linux-x86_64 \
| linux-i686 \
| linux-armv5 \
| linux-armv6 \
| linux-armv7 \
| linux-aarch64 \
Expand Down Expand Up @@ -551,6 +552,10 @@ function set_build_options_for_host() {
;;
esac
;;
linux-armv5)
SWIFT_HOST_TRIPLE="armv5-unknown-linux-gnueabi"
llvm_target_arch="ARM"
;;
linux-armv6)
SWIFT_HOST_TRIPLE="armv6-unknown-linux-gnueabihf"
llvm_target_arch="ARM"
Expand Down Expand Up @@ -1105,7 +1110,7 @@ function false_true() {
CROSS_COMPILE_HOSTS=($CROSS_COMPILE_HOSTS)
for t in "${CROSS_COMPILE_HOSTS[@]}"; do
case ${t} in
macosx* | iphone* | appletv* | watch* | linux-armv6 | linux-armv7 | android-* )
macosx* | iphone* | appletv* | watch* | linux-armv5 | linux-armv6 | linux-armv7 | android-* )
;;
*)
echo "Unknown host to cross-compile for: ${t}"
Expand Down
4 changes: 4 additions & 0 deletions utils/swift_build_support/swift_build_support/targets.py
Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,7 @@ class StdlibDeploymentTarget(object):
Linux = Platform("linux", archs=[
"x86_64",
"i686",
"armv5",
"armv6",
"armv7",
"aarch64",
Expand Down Expand Up @@ -346,6 +347,9 @@ def host_target():
elif machine.startswith('armv6'):
# linux-armv6* is canonicalized to 'linux-armv6'
return StdlibDeploymentTarget.Linux.armv6
elif machine.startswith('armv5'):
# linux-armv5* is canonicalized to 'linux-armv5'
return StdlibDeploymentTarget.Linux.armv5
elif machine == 'aarch64':
return StdlibDeploymentTarget.Linux.aarch64
elif machine == 'ppc64':
Expand Down