This <https://cs.chromium.org/chromium/src/v8/src/snapshot/embedded-file-writer.cc?l=135&rcl=07a4ab041b9731c3feb6c247f74f0920863b28be> is where the _ prefixes are generated. Specifically, mksnapshot generates an embedded.S file based on the host OS, which is incorrect for cross-compilation. A similar issue came up for OSX-to-Fuchsia cross-compiles, see https://crrev.com/c/1377230 for the fix. Something similar should also work for you.
As a more general solution we should dispatch based on the target (instead of host) OS / architecture in this entire file. Could you file a bug? I'm also happy to accept patches for this. On Wed, Feb 6, 2019 at 4:35 PM Darin Dimitrov <darin.dimit...@gmail.com> wrote: > I am trying to cross-compile V8 for ARM on MacOS. At some point of the > compilation process, mksnapshot is used to create the snapshot_blob.bin > file: > > python ../../tools/run.py ./clang_x86_v8_arm/mksnapshot > --turbo_instruction_scheduling > --embedded_src gen/embedded.S --embedded_variant Default --random-seed > 314159265 --startup_blob snapshot_blob.bin > > The resulting embedded.S seems invalid because all label names are > prefixed with _ > > .text > .balign 32 > _v8_Default_embedded_blob_data_: > .octa 0x3200000030c0000000000d96c5c,0x3a0000000380000036000000038 > .... > _Builtins_AdaptorWithExitFrame: > .octa 0xe24dd004e1a04080e2800005e591700f, > 0xee0eca10e51acfc3e52d3004e92d0012 > ... > _Builtins_AdaptorWithBuiltinExitFrame: > .octa 0xe24dd004e1a04080e2800005e591700f, > 0xee0eca10e51acfc3e52d3004e92d0012 > ... > _Builtins_ArgumentsAdaptorTrampoline: > .octa 0xe15000020a000034e152000ce30fcfff, > 0xe92d4813e3a04024e0800000ba000012 > ... > > > > As a result, a compilation error is emitted: > > FAILED: obj/v8_external_snapshot/embedded.o > > ../../third_party/llvm-build/Release+Asserts/bin/clang -MMD -MF obj/ > v8_external_snapshot/embedded.o.d -DV8_DEPRECATION_WARNINGS -DNO_TCMALLOC > -DSAFE_BROWSING_DB_REMOTE -DOFFICIAL_BUILD -DCHROMIUM_BUILD > -DFIELDTRIAL_TESTING_ENABLED > -D_GNU_SOURCE -DANDROID -DHAVE_SYS_UIO_H -DANDROID_NDK_VERSION_ROLL=r16_1 > -DCR_CLANG_REVISION=\"346388-5\" -D__STDC_CONSTANT_MACROS > -D__STDC_FORMAT_MACROS -D_FORTIFY_SOURCE=2 -D__GNU_SOURCE=1 > -DCHROMIUM_CXX_TWEAK_INLINES -DNDEBUG -DNVALGRIND > -DDYNAMIC_ANNOTATIONS_ENABLED=0 -DV8_TYPED_ARRAY_MAX_SIZE_IN_HEAP=64 > -DENABLE_MINOR_MC -DV8_DEPRECATION_WARNINGS > -DV8_IMMINENT_DEPRECATION_WARNINGS -DV8_USE_SNAPSHOT > -DV8_USE_EXTERNAL_STARTUP_DATA -DV8_CONCURRENT_MARKING > -DV8_EMBEDDED_BUILTINS -DV8_TARGET_ARCH_ARM -DCAN_USE_ARMV7_INSTRUCTIONS > -DCAN_USE_VFP3_INSTRUCTIONS -DCAN_USE_VFP32DREGS -DCAN_USE_NEON -I../.. > -Igen -I../.. -Igen -fPIC -fno-strict-aliasing --param=ssp-buffer-size=4 > -fstack-protector -funwind-tables -fPIC -fcolor-diagnostics > -fmerge-all-constants -Xclang -mllvm -Xclang > -instcombine-lower-dbg-declare=0 -no-canonical-prefixes -std=c11 > -ffunction-sections -fno-short-enums --target=arm-linux-androideabi > -isystem../../third_party/android_ndk/sysroot/usr/include/arm-linux-androideabi > -D__ANDROID_API__=16 -DHAVE_PTHREAD_COND_TIMEDWAIT_MONOTONIC=1 > -march=armv7-a -mfloat-abi=softfp -mtune=generic-armv7-a -mfpu=neon -g0 > --sysroot=../../third_party/android_ndk/sysroot -c gen/embedded.S -o > obj/v8_external_snapshot/embedded.o > gen/embedded.S:41481:17: error: unable to emit symbol attribute in > directive > .private_extern _v8_Default_embedded_blob_ > ^ > gen/embedded.S:41486:1: error: unknown directive > .const_data > ^ > gen/embedded.S:41487:17: error: unable to emit symbol attribute in > directive > .private_extern _v8_Default_embedded_blob_size_ > ^ > ninja: build stopped: subcommand failed. > > > > The same process works fine on Ubuntu where the embedded.S labels are not > prefixed with underscores. > > Do you have any idea where this difference in the generated embedded.S > might come from? > > NOTE: I am building from the 7.2.502.24 tag. > > > -- -- v8-users mailing list v8-users@googlegroups.com http://groups.google.com/group/v8-users --- You received this message because you are subscribed to the Google Groups "v8-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to v8-users+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.