Skip to content

Instantly share code, notes, and snippets.

@uraimo
Created November 24, 2017 19:39
Show Gist options
  • Save uraimo/33715886cef21c37149b6c712fed14a8 to your computer and use it in GitHub Desktop.
Save uraimo/33715886cef21c37149b6c712fed14a8 to your computer and use it in GitHub Desktop.
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 112b5d6..e6f790d 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -552,6 +552,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}" STREQUAL "i686")
+ set(SWIFT_HOST_VARIANT_ARCH_default "i686")
# FIXME: Only matches v6l/v7l - by far the most common variants
elseif("${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "armv6l")
set(SWIFT_HOST_VARIANT_ARCH_default "armv6")
@@ -623,6 +625,8 @@ if("${SWIFT_HOST_VARIANT_SDK}" STREQUAL "LINUX")
set(SWIFT_HOST_TRIPLE "${SWIFT_HOST_VARIANT_ARCH}-unknown-linux-gnu")
elseif("${SWIFT_HOST_VARIANT_ARCH}" MATCHES "s390x")
set(SWIFT_HOST_TRIPLE "s390x-unknown-linux-gnu")
+ elseif("${SWIFT_HOST_VARIANT_ARCH}" STREQUAL "i686")
+ set(SWIFT_HOST_TRIPLE "i686-unknown-linux-gnu")
elseif("${SWIFT_HOST_VARIANT_ARCH}" MATCHES "(armv6|armv7)")
set(SWIFT_HOST_TRIPLE "${SWIFT_HOST_VARIANT_ARCH}-unknown-linux-gnueabihf")
else()
diff --git a/stdlib/public/SwiftShims/LibcShims.h b/stdlib/public/SwiftShims/LibcShims.h
index e726a62..ec67789 100644
--- a/stdlib/public/SwiftShims/LibcShims.h
+++ b/stdlib/public/SwiftShims/LibcShims.h
@@ -33,7 +33,7 @@ namespace swift { extern "C" {
// This declaration is not universally correct. We verify its correctness for
// the current platform in the runtime code.
-#if defined(__linux__) && defined (__arm__)
+#if defined(__linux__) && (defined (__arm__)||defined(__i386__))
typedef int __swift_ssize_t;
#elif defined(_WIN32)
#if defined(_M_ARM) || defined(_M_IX86)
diff --git a/stdlib/public/core/FloatingPoint.swift.gyb b/stdlib/public/core/FloatingPoint.swift.gyb
index ea40f05..0cb1863 100644
--- a/stdlib/public/core/FloatingPoint.swift.gyb
+++ b/stdlib/public/core/FloatingPoint.swift.gyb
@@ -1473,13 +1473,6 @@ public protocol BinaryFloatingPoint: FloatingPoint, ExpressibleByFloatLiteral {
/// - Parameter value: A floating-point value.
init(_ value: Double)
-#if !os(Windows) && (arch(i386) || arch(x86_64))
- /// Creates a new instance from the given value, rounded to the closest
- /// possible representation.
- ///
- /// - Parameter value: A floating-point value.
- init(_ value: Float80)
-#endif
/* TODO: Implement these once it becomes possible to do so (requires revised
Integer protocol).
diff --git a/stdlib/public/core/FloatingPointParsing.swift.gyb b/stdlib/public/core/FloatingPointParsing.swift.gyb
index 676d670..45f26bb 100644
--- a/stdlib/public/core/FloatingPointParsing.swift.gyb
+++ b/stdlib/public/core/FloatingPointParsing.swift.gyb
@@ -14,17 +14,15 @@ import SwiftShims
%{
-allFloatBits = [32, 64, 80]
+allFloatBits = [32, 64]
def floatName(bits):
if bits == 32:
return 'Float'
if bits == 64:
return 'Double'
- if bits == 80:
- return 'Float80'
-cFuncSuffix2 = {32: 'f', 64: 'd', 80: 'ld'}
+cFuncSuffix2 = {32: 'f', 64: 'd'}
}%
diff --git a/stdlib/public/core/Integers.swift.gyb b/stdlib/public/core/Integers.swift.gyb
index ab5e7f6..9c57491 100644
--- a/stdlib/public/core/Integers.swift.gyb
+++ b/stdlib/public/core/Integers.swift.gyb
@@ -2930,7 +2930,7 @@ public struct ${Self}
% end
% for (FloatType, FloatBits) in [
-% ('Float', 32), ('Double', 64), ('Float80', 80)]:
+% ('Float', 32), ('Double', 64)]:
% (lower, upper) = getFtoIBounds(floatBits=FloatBits, intBits=int(bits), signed=signed)
% if FloatType == 'Float80':
diff --git a/stdlib/public/core/Runtime.swift.gyb b/stdlib/public/core/Runtime.swift.gyb
index 587b17d..fb1894b 100644
--- a/stdlib/public/core/Runtime.swift.gyb
+++ b/stdlib/public/core/Runtime.swift.gyb
@@ -387,7 +387,7 @@ internal struct _Buffer72 {
}
}
-% for bits in [ 32, 64, 80 ]:
+% for bits in [ 32, 64 ]:
% if bits == 80:
#if !os(Windows) && (arch(i386) || arch(x86_64))
diff --git a/utils/SwiftFloatingPointTypes.py b/utils/SwiftFloatingPointTypes.py
index 4638c4d..26541a0 100644
--- a/utils/SwiftFloatingPointTypes.py
+++ b/utils/SwiftFloatingPointTypes.py
@@ -42,8 +42,8 @@ def floating_point_bits_to_type():
exponentBits=8, significandSize=32, totalBits=32),
64: SwiftFloatType(name="Double", cFuncSuffix="", significandBits=52,
exponentBits=11, significandSize=64, totalBits=64),
- 80: SwiftFloatType(name="Float80", cFuncSuffix="l", significandBits=63,
- exponentBits=15, significandSize=64, totalBits=80),
+ ###80: SwiftFloatType(name="Float80", cFuncSuffix="l", significandBits=63,
+ ### exponentBits=15, significandSize=64, totalBits=80),
}
diff --git a/utils/build-script-impl b/utils/build-script-impl
index 1bfbcc5..b058b22 100755
--- a/utils/build-script-impl
+++ b/utils/build-script-impl
@@ -449,6 +449,9 @@ function set_build_options_for_host() {
--$(tolower "${PLAYGROUNDLOGGER_BUILD_TYPE}")
)
;;
+ linux-i686)
+ SWIFT_HOST_VARIANT_ARCH="i686"
+ ;;
linux-armv6)
SWIFT_HOST_VARIANT_ARCH="armv6"
SWIFT_HOST_TRIPLE="armv6-unknown-linux-gnueabihf"
diff --git a/utils/swift_build_support/swift_build_support/targets.py b/utils/swift_build_support/swift_build_support/targets.py
index f4b5bb0..8b29aef 100644
--- a/utils/swift_build_support/swift_build_support/targets.py
+++ b/utils/swift_build_support/swift_build_support/targets.py
@@ -113,6 +113,7 @@ class StdlibDeploymentTarget(object):
Linux = Platform("linux", archs=[
"x86_64",
+ "i686",
"armv6",
"armv7",
"aarch64",
@@ -160,6 +161,8 @@ class StdlibDeploymentTarget(object):
if system == 'Linux':
if machine == 'x86_64':
return StdlibDeploymentTarget.Linux.x86_64
+ elif machine == 'i686':
+ return StdlibDeploymentTarget.Linux.i686
elif machine.startswith('armv7'):
# linux-armv7* is canonicalized to 'linux-armv7'
return StdlibDeploymentTarget.Linux.armv7
@uraimo
Copy link
Author

uraimo commented Nov 24, 2017

Adds i686 platforms and removes Float80.
And then you get an "undefined reference to '__mulodi4'" near the end, an llvm bug: https://llvm.org/bugs/show_bug.cgi?id=28629
There are workarounds that have been implemented in the android ndk:
android/ndk#184
ldc-developers/ldc#813

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment