gm arm.debug in M1 MacBook fail

54 views
Skip to first unread message

Feng Yu

unread,
Aug 12, 2022, 9:45:06 AM8/12/22
to v8-dev
I am trying to run arm test `test-assembler-arm.cc`, but I fail to build arm.debug in my m1 MacBook. 

My machine info

```
$ uname -a
Darwin fengs-MacBook-Pro.local 21.5.0 Darwin Kernel Version 21.5.0: Tue Apr 26 21:08:37 PDT 2022; root:xnu-8020.121.3~4/RELEASE_ARM64_T6000 x86_64
```
 
Console output

```
$ gm arm.debug
# autoninja -C out/arm.debug d8
ninja: Entering directory `out/arm.debug'
[1/1467] CXX obj/v8_heap_base/push_registers_asm.o
FAILED: obj/v8_heap_base/push_registers_asm.o
../../third_party/llvm-build/Release+Asserts/bin/clang++ -MMD -MF obj/v8_heap_base/push_registers_asm.o.d -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D_LIBCPP_HAS_NO_ALIGNED_ALLOCATION -DCR_XCODE_VERSION=1341 -DCR_CLANG_REVISION=\"llvmorg-15-init-9576-g75f9e83a-2\" -DCOMPONENT_BUILD -D_LIBCPP_ABI_UNSTABLE -D_LIBCPP_ABI_VERSION=Cr -D_LIBCPP_ENABLE_NODISCARD -D_LIBCPP_DEBUG=0 -DCR_LIBCXX_REVISION=79a2e924d96e2fc1e4b937c42efd08898fa472d7 -D__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES=0 -D_DEBUG -DDYNAMIC_ANNOTATIONS_ENABLED=1 -DCPPGC_VERIFY_HEAP -DENABLE_DISASSEMBLER -DV8_TYPED_ARRAY_MAX_SIZE_IN_HEAP=64 -DOBJECT_PRINT -DVERIFY_HEAP -DV8_TRACE_MAPS -DV8_ENABLE_ALLOCATION_TIMEOUT -DV8_ENABLE_FORCE_SLOW_PATH -DV8_ENABLE_DOUBLE_CONST_STORE_CHECK -DV8_INTL_SUPPORT -DENABLE_HANDLE_ZAPPING -DV8_CODE_COMMENTS -DV8_ENABLE_DEBUG_CODE -DV8_ENABLE_HEAP_SNAPSHOT_VERIFY -DV8_SNAPSHOT_NATIVE_CODE_COUNTERS -DV8_USE_EXTERNAL_STARTUP_DATA -DV8_ATOMIC_OBJECT_FIELD_WRITES -DV8_ENABLE_LAZY_SOURCE_POSITIONS -DV8_SHARED_RO_HEAP -DV8_WIN64_UNWINDING_INFO -DV8_ENABLE_REGEXP_INTERPRETER_THREADED_DISPATCH -DV8_ENABLE_SYSTEM_INSTRUMENTATION -DV8_ENABLE_WEBASSEMBLY -DV8_ALLOCATION_FOLDING -DV8_ALLOCATION_SITE_TRACKING -DV8_ADVANCED_BIGINT_ALGORITHMS -DV8_ENABLE_CHECKS -DV8_DEPRECATION_WARNINGS -DV8_IMMINENT_DEPRECATION_WARNINGS -DV8_TARGET_ARCH_ARM -DCAN_USE_ARMV7_INSTRUCTIONS -DCAN_USE_VFP3_INSTRUCTIONS -DCAN_USE_VFP32DREGS -DCAN_USE_NEON -DUSE_EABI_HARDFLOAT=1 -DV8_HAVE_TARGET_OS -DV8_TARGET_OS_MACOS -DDEBUG -DENABLE_SLOW_DCHECKS -DV8_RUNTIME_CALL_STATS -DBUILDING_V8_SHARED -DUSING_V8_BASE_SHARED -I../.. -Igen -I../../buildtools/third_party/libc++ -I../../include -Igen/include -Wall -Werror -Wextra -Wimplicit-fallthrough -Wunreachable-code-aggressive -Wthread-safety -Wunguarded-availability -Wno-missing-field-initializers -Wno-unused-parameter -Wloop-analysis -Wno-unneeded-internal-declaration -Wenum-compare-conditional -Wno-psabi -Wno-ignored-pragma-optimize -Wno-unqualified-std-cast-call -Xclang -no-opaque-pointers -Wshadow -fno-delete-null-pointer-checks -fno-ident -fno-strict-aliasing -fstack-protector-strong -fcolor-diagnostics -fmerge-all-constants -fcrash-diagnostics-dir=../../tools/clang/crashreports -mllvm -instcombine-lower-dbg-declare=0 -ffp-contract=off -fcomplete-member-pointers -arch i386 -Wno-builtin-macro-redefined -D__DATE__= -D__TIME__= -D__TIMESTAMP__= -ffile-compilation-dir=. -no-canonical-prefixes -ftrivial-auto-var-init=pattern -fno-omit-frame-pointer -gdwarf-4 -g2 -gdwarf-aranges -Xclang -debug-info-kind=limited -isysroot ../../../../../../../Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.3.sdk -mmacosx-version-min=10.11.0 -Wheader-hygiene -Wstring-conversion -Wtautological-overlap-compare -Wmissing-field-initializers -Wctad-maybe-unsupported -Wno-shadow -Wunreachable-code -O0 -fvisibility=default -Wexit-time-destructors -Wno-undefined-bool-conversion -Wno-tautological-undefined-compare -std=c++17 -Wno-trigraphs -fno-aligned-new -fno-exceptions -fno-rtti -nostdinc++ -isystem../../buildtools/third_party/libc++/trunk/include -isystem../../buildtools/third_party/libc++abi/trunk/include -c ../../src/heap/base/asm/ia32/push_registers_asm.cc -o obj/v8_heap_base/push_registers_asm.o
<inline asm>:2:1: error: unknown directive
.type PushAllRegistersAndIterateStack, %function  
^
<inline asm>:3:1: error: unknown directive
.hidden PushAllRegistersAndIterateStack            
^
2 errors generated.
[12/1467] CXX obj/v8_libbase/emulated-virtual-address-subspace.o
ninja: build stopped: subcommand failed.
Error! - V8 compilation finished with errors.
```

Feng Yu

unread,
Aug 12, 2022, 9:51:17 AM8/12/22
to v8-dev
I  am migrating tests from cctest/ to unittests/. The assembler test is arch-specific, I need to run tests for loong, riscv, arm & mips arch. see https://chromium-review.googlesource.com/c/v8/v8/+/3827132 for my work in progress.

Feng Yu

unread,
Aug 12, 2022, 9:57:28 AM8/12/22
to v8-dev
The auto generated gn config file:

```
$ cat out/arm.debug/args.gn
is_component_build = true
is_debug = true
symbol_level = 2
target_cpu = "x86"
v8_target_cpu = "arm"
use_goma = false
v8_enable_backtrace = true
v8_enable_fast_mksnapshot = true
v8_enable_slow_dchecks = true
v8_optimized_debug = false
```

Jakob Kummerow

unread,
Aug 12, 2022, 10:16:59 AM8/12/22
to v8-dev
Set target_cpu to "arm" (using gn args out/arm.debug).

I guess we've fixed the autodetection only for arm64...

--
--
v8-dev mailing list
v8-...@googlegroups.com
http://groups.google.com/group/v8-dev
---
You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to v8-dev+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/v8-dev/c68f4a07-9b17-4d62-a786-95f8e2b723c2n%40googlegroups.com.

Feng Yu

unread,
Aug 12, 2022, 11:10:30 AM8/12/22
to v8-dev
Set target_cpu to "arm" don't work.

```
$ cat out/arm.debug/args.gn
is_component_build = true
is_debug = true
symbol_level = 2
target_cpu = "arm"

v8_target_cpu = "arm"
use_goma = false
v8_enable_backtrace = true
v8_enable_fast_mksnapshot = true
v8_enable_slow_dchecks = true
v8_optimized_debug = false
$ gm arm.debug
# autoninja -C out/arm.debug d8
ninja: Entering directory `out/arm.debug'
[0/1] Regenerating ninja files
ERROR at //build/config/mac/BUILD.gn:26:5: Assertion failed.
    assert(false, "unknown current_cpu $current_cpu")
    ^-----
unknown current_cpu arm
See //build/config/BUILDCONFIG.gn:422:23: which caused the file to be included.
  _linker_configs = [ "//build/config/mac:strip_all" ]
                      ^-----------------------------
FAILED: build.ninja
../../buildtools/mac/gn --root=../.. -q --regeneration gen .
ninja: error: rebuilding 'build.ninja': subcommand failed

Error! - V8 compilation finished with errors.
```

Jakob Kummerow

unread,
Aug 16, 2022, 10:10:57 AM8/16/22
to v8-dev
Looks like building 32-bit arm on Mac-arm64 isn't supported. Feel free to figure out what it would take to make it work. Does MacOS even support executing 32-bit arm binaries? If yes, then probably the changes are rather straightforward. If not, then the only thing V8 could do (which hasn't been done before and is likely difficult) would be to allow simulator builds of 32-bit architectures in 64-bit binaries. Lacking that, you could set up a VM, or install (some "multilib"-capable distro of) Linux on your MacBook, or get a 32-bit arm device (like a Raspberry Pi).

(FWIW, when I tried gm arm.release, I got the correct target_cpu = "arm" automatically, so that at least works.)


Reply all
Reply to author
Forward
0 new messages