Skip to content

Commit c49c65d

Browse files
shushanhfqiaopengchengjkotas
authored
[LoongArch64] Port libraries directory (#62888)
Co-authored-by: qiaopengcheng <[email protected]> Co-authored-by: Jan Kotas <[email protected]>
1 parent 3eccec0 commit c49c65d

File tree

20 files changed

+68
-12
lines changed

20 files changed

+68
-12
lines changed

src/coreclr/System.Private.CoreLib/System.Private.CoreLib.csproj

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,10 @@
7878
<PlatformTarget>AnyCPU</PlatformTarget>
7979
<DefineConstants>$(DefineConstants);TARGET_ARM64</DefineConstants>
8080
</PropertyGroup>
81+
<PropertyGroup Condition="'$(Platform)' == 'loongarch64'">
82+
<PlatformTarget>AnyCPU</PlatformTarget>
83+
<DefineConstants>$(DefineConstants);TARGET_LOONGARCH64</DefineConstants>
84+
</PropertyGroup>
8185

8286
<!-- Configuration specific properties -->
8387
<PropertyGroup Condition="'$(Configuration)' == 'Debug' or '$(Configuration)' == 'Checked'">

src/libraries/Microsoft.NETCore.Platforms/src/runtime.compatibility.json

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3638,6 +3638,14 @@
36383638
"any",
36393639
"base"
36403640
],
3641+
"linux-loongarch64": [
3642+
"linux-loongarch64",
3643+
"linux",
3644+
"unix-loongarch64",
3645+
"unix",
3646+
"any",
3647+
"base"
3648+
],
36413649
"linux-mips64": [
36423650
"linux-mips64",
36433651
"linux",
@@ -8100,6 +8108,12 @@
81008108
"any",
81018109
"base"
81028110
],
8111+
"unix-loongarch64": [
8112+
"unix-loongarch64",
8113+
"unix",
8114+
"any",
8115+
"base"
8116+
],
81038117
"unix-mips64": [
81048118
"unix-mips64",
81058119
"unix",
@@ -8754,4 +8768,4 @@
87548768
"any",
87558769
"base"
87568770
]
8757-
}
8771+
}

src/libraries/Microsoft.NETCore.Platforms/src/runtime.json

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1475,6 +1475,12 @@
14751475
"unix-armel"
14761476
]
14771477
},
1478+
"linux-loongarch64": {
1479+
"#import": [
1480+
"linux",
1481+
"unix-loongarch64"
1482+
]
1483+
},
14781484
"linux-mips64": {
14791485
"#import": [
14801486
"linux",
@@ -3399,6 +3405,11 @@
33993405
"unix"
34003406
]
34013407
},
3408+
"unix-loongarch64": {
3409+
"#import": [
3410+
"unix"
3411+
]
3412+
},
34023413
"unix-mips64": {
34033414
"#import": [
34043415
"unix"
@@ -3743,4 +3754,4 @@
37433754
]
37443755
}
37453756
}
3746-
}
3757+
}

src/libraries/Microsoft.NETCore.Platforms/src/runtimeGroups.props

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@
33
<ItemGroup>
44
<RuntimeGroup Include="unix">
55
<Parent>any</Parent>
6-
<Architectures>x64;x86;arm;armel;arm64;mips64;s390x</Architectures>
6+
<Architectures>x64;x86;arm;armel;arm64;loongarch64;mips64;s390x</Architectures>
77
</RuntimeGroup>
88
<RuntimeGroup Include="linux">
99
<Parent>unix</Parent>
10-
<Architectures>x64;x86;arm;armel;arm64;mips64;s390x</Architectures>
10+
<Architectures>x64;x86;arm;armel;arm64;loongarch64;mips64;s390x</Architectures>
1111
</RuntimeGroup>
1212
<RuntimeGroup Include="linux-musl">
1313
<Parent>linux</Parent>

src/libraries/System.Private.CoreLib/src/Internal/Padding.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ namespace Internal
99
internal static class PaddingHelpers
1010
{
1111
/// <summary>A size greater than or equal to the size of the most common CPU cache lines.</summary>
12-
#if TARGET_ARM64
12+
#if TARGET_ARM64 || TARGET_LOONGARCH64
1313
internal const int CACHE_LINE_SIZE = 128;
1414
#else
1515
internal const int CACHE_LINE_SIZE = 64;

src/libraries/System.Private.CoreLib/src/System.Private.CoreLib.Shared.projitems

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
<SupportsX86Intrinsics Condition="'$(Platform)' == 'x64' or ('$(Platform)' == 'x86' and '$(TargetsUnix)' != 'true')">true</SupportsX86Intrinsics>
1818
<ILLinkSharedDirectory>$(MSBuildThisFileDirectory)ILLink\</ILLinkSharedDirectory>
1919
<IsBigEndian Condition="'$(Platform)' == 's390x'">true</IsBigEndian>
20-
<Is64Bit Condition="'$(Platform)' == 'arm64' or '$(Platform)' == 'x64' or '$(Platform)' == 's390x'">true</Is64Bit>
20+
<Is64Bit Condition="'$(Platform)' == 'arm64' or '$(Platform)' == 'x64' or '$(Platform)' == 's390x' or '$(Platform)' == 'loongarch64'">true</Is64Bit>
2121
<UseMinimalGlobalizationData Condition="'$(TargetsiOS)' == 'true' or '$(TargetstvOS)' == 'true' or '$(TargetsBrowser)' == 'true'">true</UseMinimalGlobalizationData>
2222
</PropertyGroup>
2323
<PropertyGroup>

src/libraries/System.Private.CoreLib/src/System/Buffer.Unix.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ namespace System
55
{
66
public static partial class Buffer
77
{
8-
#if TARGET_ARM64
8+
#if TARGET_ARM64 || TARGET_LOONGARCH64
99
// Managed code is currently faster than glibc unoptimized memmove
1010
// TODO-ARM64-UNIX-OPT revisit when glibc optimized memmove is in Linux distros
1111
// https://github.com/dotnet/runtime/issues/8897

src/libraries/System.Private.CoreLib/src/System/Buffer.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// Licensed to the .NET Foundation under one or more agreements.
22
// The .NET Foundation licenses this file to you under the MIT license.
33

4-
#if TARGET_AMD64 || TARGET_ARM64 || (TARGET_32BIT && !TARGET_ARM)
4+
#if TARGET_AMD64 || TARGET_ARM64 || (TARGET_32BIT && !TARGET_ARM) || TARGET_LOONGARCH64
55
#define HAS_CUSTOM_BLOCKS
66
#endif
77

src/libraries/System.Private.CoreLib/src/System/Runtime/InteropServices/Architecture.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ public enum Architecture
1010
Arm,
1111
Arm64,
1212
Wasm,
13-
S390x
13+
S390x,
14+
LoongArch64
1415
}
1516
}

src/libraries/System.Private.CoreLib/src/System/Runtime/InteropServices/RuntimeInformation.ProcessArchitecture.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ public static Architecture ProcessArchitecture
1818
=> Architecture.Wasm;
1919
#elif TARGET_S390X
2020
=> Architecture.S390x;
21+
#elif TARGET_LOONGARCH64
22+
=> Architecture.LoongArch64;
2123
#else
2224
#error Unknown Architecture
2325
#endif

0 commit comments

Comments
 (0)