Skip to content

Commit 120337d

Browse files
sstricklCommit Queue
authored andcommitted
[build] Rework handling of compressed pointers in configurations.
Currently, the VM assumes that both host and target architecture either use compressed pointers or use uncompressed pointers. In addition, some architecture backends fail to build if DART_COMPRESSED_POINTERS is set: * The RISCV64 assembler doesn't currently handle compressed pointers appropriately and fails to build due to not overriding pure virtual methods in AssemblerBase. * Attempting to build the ARM assembler with DART_COMPRESSED_POINTERS set fails due to an #ifdef/#error check. Thus, to appropriately build cross compilers for these architectures when building an SDK with compressed pointers enabled, only add the DART_COMPRESSED_POINTERS define if the target architecture supports compressed pointers (currently, arm64 and x64). This also ensures that the current cross compilers for Linux ARM64 and Linux X64 do not use compressed pointers, even when being built as part of an SDK with compressed pointers enabled. TEST=ci and manual testing of create_sdk for ARM64C/X64C. Issue: #28617 Change-Id: I6093d6e39b5e50ca4e8b689dc86181692faf9dc3 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/438520 Reviewed-by: Martin Kustermann <[email protected]> Commit-Queue: Tess Strickland <[email protected]>
1 parent 88f4c1c commit 120337d

File tree

2 files changed

+15
-25
lines changed

2 files changed

+15
-25
lines changed

runtime/BUILD.gn

Lines changed: 11 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -129,39 +129,31 @@ config("dart_os_config") {
129129
}
130130
}
131131

132-
# We need to build gen_snapshot targeting Linux ARM64 during a build
133-
# of the SDK. This configuration is used to unconditionally target
134-
# Linux ARM64. It should not be combined with dart_os_config and dart_arch_config.
132+
# The dart_linux_<arch>_config configs below are used for building cross
133+
# compilers when building the SDK. They should not be combined with
134+
# dart_os_config and dart_arch_config.
135+
135136
config("dart_linux_arm64_config") {
136137
defines = [
137138
"DART_TARGET_OS_LINUX",
138139
"TARGET_ARCH_ARM64",
139140
]
140141
}
141142

142-
# We need to build gen_snapshot targeting Linux ARM64 during a build
143-
# of the SDK. This configuration is used to unconditionally target
144-
# Linux ARM64. It should not be combined with dart_os_config and dart_arch_config.
145143
config("dart_linux_x64_config") {
146144
defines = [
147145
"DART_TARGET_OS_LINUX",
148146
"TARGET_ARCH_X64",
149147
]
150148
}
151149

152-
# We need to build gen_snapshot targeting Linux ARM during a build
153-
# of the SDK. This configuration is used to unconditionally target
154-
# Linux ARM. It should not be combined with dart_os_config and dart_arch_config.
155150
config("dart_linux_arm_config") {
156151
defines = [
157152
"DART_TARGET_OS_LINUX",
158153
"TARGET_ARCH_ARM",
159154
]
160155
}
161156

162-
# We need to build gen_snapshot targeting Linux RISCV64 during a build
163-
# of the SDK. This configuration is used to unconditionally target
164-
# Linux RISCV64. It should not be combined with dart_os_config and dart_arch_config.
165157
config("dart_linux_riscv64_config") {
166158
defines = [
167159
"DART_TARGET_OS_LINUX",
@@ -188,6 +180,13 @@ config("dart_arch_config") {
188180
print("Invalid dart_target_arch: $dart_target_arch")
189181
assert(false)
190182
}
183+
if (dart_use_compressed_pointers) {
184+
if (dart_target_arch != "arm64" && dart_target_arch != "x64") {
185+
print("Invalid architecture for compressed pointers: $dart_target_arch")
186+
assert(false)
187+
}
188+
defines += [ "DART_COMPRESSED_POINTERS" ]
189+
}
191190
if (dart_force_simulator) {
192191
defines += [ "DART_INCLUDE_SIMULATOR" ]
193192
if (dart_target_arch == "arm64") {
@@ -211,10 +210,6 @@ config("dart_config") {
211210
defines += [ "FORCE_FORCE_INCLUDE_SAMPLING_HEAP_PROFILER" ]
212211
}
213212

214-
if (dart_use_compressed_pointers) {
215-
defines += [ "DART_COMPRESSED_POINTERS" ]
216-
}
217-
218213
if (dart_support_perfetto) {
219214
defines += [ "SUPPORT_PERFETTO" ]
220215
}

sdk/BUILD.gn

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -880,18 +880,13 @@ group("create_full_sdk") {
880880
# SDK, but add them as a dependency, so that they are built.
881881
public_deps += [
882882
"../runtime/bin:gen_snapshot_product_linux_arm64",
883+
"../runtime/bin:gen_snapshot_product_linux_riscv64",
883884
"../runtime/bin:gen_snapshot_product_linux_x64",
884885
]
885886

886-
# Don't add cross compilers for architectures that do not support
887-
# compressed pointers in SDKs built for compressed pointers.
888-
if (!dart_use_compressed_pointers) {
889-
public_deps += [ "../runtime/bin:gen_snapshot_product_linux_riscv64" ]
890-
891-
# assembler_arm.cc disallows ARM cross-compilation on Windows.
892-
if (!is_win) {
893-
public_deps += [ "../runtime/bin:gen_snapshot_product_linux_arm" ]
894-
}
887+
# assembler_arm.cc disallows ARM cross-compilation on Windows.
888+
if (!is_win) {
889+
public_deps += [ "../runtime/bin:gen_snapshot_product_linux_arm" ]
895890
}
896891
}
897892
}

0 commit comments

Comments
 (0)