Skip to content

Commit c3b1143

Browse files
authored
Merge pull request #19607 from Kaiede/debianHost
Enable i686 as a Host Platform
2 parents 3036f81 + 96156be commit c3b1143

File tree

12 files changed

+31
-18
lines changed

12 files changed

+31
-18
lines changed

CMakeLists.txt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -592,7 +592,7 @@ else()
592592
set(SWIFT_HOST_VARIANT_ARCH_default "x86_64")
593593
elseif("${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "IA64")
594594
set(SWIFT_HOST_VARIANT_ARCH_default "itanium")
595-
elseif("${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "x86")
595+
elseif("${CMAKE_SYSTEM_PROCESSOR}" MATCHES "(x86|i686)")
596596
set(SWIFT_HOST_VARIANT_ARCH_default "i686")
597597
else()
598598
message(FATAL_ERROR "Unrecognized architecture on host system: ${CMAKE_SYSTEM_PROCESSOR}")
@@ -647,6 +647,8 @@ if("${SWIFT_HOST_VARIANT_SDK}" STREQUAL "LINUX")
647647
if("${SWIFT_HOST_TRIPLE}" STREQUAL "")
648648
if("${SWIFT_HOST_VARIANT_ARCH}" STREQUAL "x86_64")
649649
set(SWIFT_HOST_TRIPLE "x86_64-unknown-linux-gnu")
650+
elseif("${SWIFT_HOST_VARIANT_ARCH}" STREQUAL "i686")
651+
set(SWIFT_HOST_TRIPLE "i686-unknown-linux-gnu")
650652
elseif("${SWIFT_HOST_VARIANT_ARCH}" STREQUAL "aarch64")
651653
set(SWIFT_HOST_TRIPLE "aarch64-unknown-linux-gnu")
652654
elseif("${SWIFT_HOST_VARIANT_ARCH}" MATCHES "(powerpc64|powerpc64le)")

include/swift/AST/Decl.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1462,7 +1462,7 @@ class alignas(RequirementRepr) TrailingWhereClause final :
14621462
};
14631463

14641464
// A private class for forcing exact field layout.
1465-
class _GenericContext {
1465+
class alignas(8) _GenericContext {
14661466
// Not really public. See GenericContext.
14671467
public:
14681468
GenericParamList *GenericParams = nullptr;
@@ -1599,7 +1599,7 @@ class ImportDecl final : public Decl,
15991599

16001600
ArrayRef<AccessPathElement> getFullAccessPath() const {
16011601
return {getTrailingObjects<AccessPathElement>(),
1602-
Bits.ImportDecl.NumPathElements};
1602+
static_cast<size_t>(Bits.ImportDecl.NumPathElements)};
16031603
}
16041604

16051605
ArrayRef<AccessPathElement> getModulePath() const {

include/swift/AST/Expr.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2114,10 +2114,10 @@ class CollectionExpr : public Expr {
21142114
/// that trailing commas are currently allowed, and that invalid code may have
21152115
/// stray or missing commas.
21162116
MutableArrayRef<SourceLoc> getCommaLocs() {
2117-
return {getTrailingSourceLocs(), Bits.CollectionExpr.NumCommas};
2117+
return {getTrailingSourceLocs(), static_cast<size_t>(Bits.CollectionExpr.NumCommas)};
21182118
}
21192119
ArrayRef<SourceLoc> getCommaLocs() const {
2120-
return {getTrailingSourceLocs(), Bits.CollectionExpr.NumCommas};
2120+
return {getTrailingSourceLocs(), static_cast<size_t>(Bits.CollectionExpr.NumCommas)};
21212121
}
21222122
unsigned getNumCommas() const { return Bits.CollectionExpr.NumCommas; }
21232123

@@ -2911,7 +2911,7 @@ class TupleShuffleExpr final : public ImplicitConversionExpr,
29112911

29122912
ArrayRef<int> getElementMapping() const {
29132913
return {getTrailingObjects<int>(),
2914-
Bits.TupleShuffleExpr.NumElementMappings};
2914+
static_cast<size_t>(Bits.TupleShuffleExpr.NumElementMappings)};
29152915
}
29162916

29172917
/// What is the type impact of this shuffle?
@@ -2938,7 +2938,7 @@ class TupleShuffleExpr final : public ImplicitConversionExpr,
29382938
/// Retrieve the argument indices for the variadic arguments.
29392939
ArrayRef<unsigned> getVariadicArgs() const {
29402940
return {getTrailingObjects<unsigned>(),
2941-
Bits.TupleShuffleExpr.NumVariadicArgs};
2941+
static_cast<size_t>(Bits.TupleShuffleExpr.NumVariadicArgs)};
29422942
}
29432943

29442944
/// Retrieve the owner of the default arguments.
@@ -2947,13 +2947,13 @@ class TupleShuffleExpr final : public ImplicitConversionExpr,
29472947
/// Retrieve the caller-defaulted arguments.
29482948
ArrayRef<Expr *> getCallerDefaultArgs() const {
29492949
return {getTrailingObjects<Expr*>(),
2950-
Bits.TupleShuffleExpr.NumCallerDefaultArgs};
2950+
static_cast<size_t>(Bits.TupleShuffleExpr.NumCallerDefaultArgs)};
29512951
}
29522952

29532953
/// Retrieve the caller-defaulted arguments.
29542954
MutableArrayRef<Expr *> getCallerDefaultArgs() {
29552955
return {getTrailingObjects<Expr*>(),
2956-
Bits.TupleShuffleExpr.NumCallerDefaultArgs};
2956+
static_cast<size_t>(Bits.TupleShuffleExpr.NumCallerDefaultArgs)};
29572957
}
29582958

29592959
static bool classof(const Expr *E) {

include/swift/AST/TypeRepr.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1079,7 +1079,7 @@ class SILBoxTypeRepr final : public TypeRepr,
10791079
}
10801080
ArrayRef<TypeRepr *> getGenericArguments() const {
10811081
return {getTrailingObjects<TypeRepr*>(),
1082-
Bits.SILBoxTypeRepr.NumGenericArgs};
1082+
static_cast<size_t>(Bits.SILBoxTypeRepr.NumGenericArgs)};
10831083
}
10841084

10851085
GenericParamList *getGenericParams() const {

include/swift/AST/Types.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4633,7 +4633,7 @@ class ArchetypeType final : public SubstitutableType,
46334633
/// type shall conform.
46344634
ArrayRef<ProtocolDecl *> getConformsTo() const {
46354635
return { getTrailingObjects<ProtocolDecl *>(),
4636-
Bits.ArchetypeType.NumProtocols };
4636+
static_cast<size_t>(Bits.ArchetypeType.NumProtocols) };
46374637
}
46384638

46394639
/// requiresClass - True if the type can only be substituted with class types.

include/swift/SIL/SILInstruction.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1360,12 +1360,12 @@ class AllocStackInst final
13601360

13611361
ArrayRef<Operand> getAllOperands() const {
13621362
return { getTrailingObjects<Operand>(),
1363-
SILInstruction::Bits.AllocStackInst.NumOperands };
1363+
static_cast<size_t>(SILInstruction::Bits.AllocStackInst.NumOperands) };
13641364
}
13651365

13661366
MutableArrayRef<Operand> getAllOperands() {
13671367
return { getTrailingObjects<Operand>(),
1368-
SILInstruction::Bits.AllocStackInst.NumOperands };
1368+
static_cast<size_t>(SILInstruction::Bits.AllocStackInst.NumOperands) };
13691369
}
13701370

13711371
ArrayRef<Operand> getTypeDependentOperands() const {

lib/IRGen/GenType.cpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1557,8 +1557,12 @@ convertPrimitiveBuiltin(IRGenModule &IGM, CanType canTy) {
15571557
return RetTy{ llvm::Type::getFloatTy(ctx), Size(4), Alignment(4) };
15581558
case BuiltinFloatType::IEEE64:
15591559
return RetTy{ llvm::Type::getDoubleTy(ctx), Size(8), Alignment(8) };
1560-
case BuiltinFloatType::IEEE80:
1561-
return RetTy{ llvm::Type::getX86_FP80Ty(ctx), Size(16), Alignment(16) };
1560+
case BuiltinFloatType::IEEE80: {
1561+
llvm::Type *floatTy = llvm::Type::getX86_FP80Ty(ctx);
1562+
uint64_t ByteSize = IGM.DataLayout.getTypeAllocSize(floatTy);
1563+
unsigned align = IGM.DataLayout.getABITypeAlignment(floatTy);
1564+
return RetTy{ floatTy, Size(ByteSize), Alignment(align) };
1565+
}
15621566
case BuiltinFloatType::IEEE128:
15631567
return RetTy{ llvm::Type::getFP128Ty(ctx), Size(16), Alignment(16) };
15641568
case BuiltinFloatType::PPC128:

lib/SIL/SILLocation.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@
2020

2121
using namespace swift;
2222

23-
static_assert(sizeof(SILLocation) == 3*sizeof(void *),
23+
// 64-bit is 24 bytes, 32-bit is 20 bytes.
24+
static_assert(sizeof(SILLocation) == sizeof(void *) + 4*sizeof(unsigned),
2425
"SILLocation must stay small");
2526

2627
SourceLoc SILLocation::getSourceLoc() const {

stdlib/public/SwiftShims/LibcShims.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ namespace swift { extern "C" {
3333

3434
// This declaration is not universally correct. We verify its correctness for
3535
// the current platform in the runtime code.
36-
#if defined(__linux__) && defined (__arm__)
36+
#if defined(__linux__) && (defined(__arm__) || defined(__i386__))
3737
typedef int __swift_ssize_t;
3838
#elif defined(_WIN32)
3939
#if defined(_M_ARM) || defined(_M_IX86)

stdlib/public/stubs/MathStubs.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ __muloti4(ti_int a, ti_int b, int* overflow)
112112
// lowered to instructions as though MSVC had generated. There does not seem to
113113
// be a MSVC provided multiply with overflow detection that I can see, but this
114114
// avoids an unnecessary dependency on compiler-rt for a single function.
115-
#if (defined(__linux__) && defined(__arm__)) || defined(_WIN32)
115+
#if (defined(__linux__) && (defined(__arm__) || defined(__i386__))) || defined(_WIN32)
116116

117117
// Similar to above, but with mulodi4. Perhaps this is
118118
// something that shouldn't be done, and is a bandaid over

utils/build-script-impl

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -433,6 +433,9 @@ function set_build_options_for_host() {
433433
linux-x86_64)
434434
SWIFT_HOST_VARIANT_ARCH="x86_64"
435435
;;
436+
linux-i686)
437+
SWIFT_HOST_VARIANT_ARCH="i686"
438+
;;
436439
linux-armv6)
437440
SWIFT_HOST_VARIANT_ARCH="armv6"
438441
SWIFT_HOST_TRIPLE="armv6-unknown-linux-gnueabihf"

utils/swift_build_support/swift_build_support/targets.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,7 @@ class StdlibDeploymentTarget(object):
113113

114114
Linux = Platform("linux", archs=[
115115
"x86_64",
116+
"i686",
116117
"armv6",
117118
"armv7",
118119
"aarch64",
@@ -160,6 +161,8 @@ def host_target():
160161
if system == 'Linux':
161162
if machine == 'x86_64':
162163
return StdlibDeploymentTarget.Linux.x86_64
164+
elif machine == 'i686':
165+
return StdlibDeploymentTarget.Linux.i686
163166
elif machine.startswith('armv7'):
164167
# linux-armv7* is canonicalized to 'linux-armv7'
165168
return StdlibDeploymentTarget.Linux.armv7

0 commit comments

Comments
 (0)