cronet boringssl build error after switching to clang |
||
Issue descriptionhttps://build.chromium.org/p/chromium.android/builders/Android%20Cronet%20ARMv6%20Builder/builds/5005 [1331/7719] ASM obj/third_party/boringssl/boringssl_asm/chacha-armv4.o FAILED: obj/third_party/boringssl/boringssl_asm/chacha-armv4.o /b/build/slave/cache/goma_client/gomacc ../../third_party/llvm-build/Release+Asserts/bin/clang -MMD -MF obj/third_party/boringssl/boringssl_asm/chacha-armv4.o.d -DBORINGSSL_CLANG_SUPPORTS_DOT_ARCH -DV8_DEPRECATION_WARNINGS -DUSE_OPENSSL_CERTS=1 -DNO_TCMALLOC -DDISABLE_NACL -DSAFE_BROWSING_DB_REMOTE -DOFFICIAL_BUILD -DCHROMIUM_BUILD -DFIELDTRIAL_TESTING_ENABLED -DCR_CLANG_REVISION=\"303910-1\" -D_FILE_OFFSET_BITS=64 -DANDROID -DHAVE_SYS_UIO_H -DANDROID_NDK_VERSION=r12b -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D_FORTIFY_SOURCE=2 -D__GNU_SOURCE=1 -D__compiler_offsetof=__builtin_offsetof -Dnan=__builtin_nan -DNDEBUG -DNVALGRIND -DDYNAMIC_ANNOTATIONS_ENABLED=0 -I../../third_party/boringssl/src/include -I../.. -Igen -fno-integrated-as -B../../third_party/android_tools/ndk/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/bin -fno-strict-aliasing --param=ssp-buffer-size=4 -fstack-protector -funwind-tables -fPIC -pipe -fcolor-diagnostics -ffunction-sections -fno-short-enums --target=arm-linux-androideabi -march=armv6 -mfloat-abi=softfp -mfpu=vfp -gdwarf-3 -g1 --sysroot=../../third_party/android_tools/ndk/platforms/android-16/arch-arm -c ../../third_party/boringssl/linux-arm/crypto/chacha/chacha-armv4.S -o obj/third_party/boringssl/boringssl_asm/chacha-armv4.o ../../third_party/boringssl/linux-arm/crypto/chacha/chacha-armv4.S: Assembler messages: ../../third_party/boringssl/linux-arm/crypto/chacha/chacha-armv4.S:421: Error: bad instruction `ldrbhs r8,[r12],#16' ../../third_party/boringssl/linux-arm/crypto/chacha/chacha-armv4.S:423: Error: bad instruction `ldrbhs r9,[r12,#-12]' ../../third_party/boringssl/linux-arm/crypto/chacha/chacha-armv4.S:430: Error: bad instruction `ldrbhs r10,[r12,#-8]' ../../third_party/boringssl/linux-arm/crypto/chacha/chacha-armv4.S:432: Error: bad instruction `ldrbhs r11,[r12,#-4]' ../../third_party/boringssl/linux-arm/crypto/chacha/chacha-armv4.S:439: Error: bad instruction `ldrbhs r8,[r12,#-15]' We pass -fno-integrated-as, so clang should just call gas as usual. We pass --target=arm-linux-androideabi -march=armv6 which doesn't quite match chacha-arm4.S. Also, no trybot caught this.
,
Jun 10 2017
https://cs.chromium.org/chromium/src/third_party/boringssl/linux-arm/crypto/chacha/chacha-armv4.S?q=chacha-armv4.S+package:%5Echromium$&dr&l=12 #if defined(__thumb2__) || defined(__clang__) #define ldrhsb ldrbhs #endif So that file gets built with clang, with that define, but we then send it to the system assembler which doesn't understand this replacement. clang + arm assembly is (or used to be, at least) a mess (which is why we pass -fno-integrated-as), but boringssl tries to make it work but mostly gets it wrong (by assuming that clang == ios, etc).
,
Jun 10 2017
No, anything specific to iOS in BoringSSL assembly is not going to be done by preprocessor stuff like that. That's going to be handled by the horror that is perlasm. That code is, I believe, actually trying to detect clang's assembler. (Though remember this assembly is third-party code. It comes from upstream OpenSSL.) We and upstream do need to support clang's integrated assembler for iOS, so just taking those out won't work. Does clang not have a way for the preprocessor to tell whether it's using the integrated assembler? That sounds like a problem clang will need to fix so long as its assembler is flaky enough to need a -fno-integrated-as flag. Another possibility is to just switch to the integrated assembler. I tried that recently and it *almost* worked. We might be able to finish it up? https://chromium-review.googlesource.com/c/529565/ But I'm confused why this is only starting to break now. This is not the first time BoringSSL on ARM is being built with clang and -fno-integrated-as.
,
Jun 10 2017
I just enabled clang by default on Android. Most bots are happy, this one isn't. I think it's because that bot sets arm_version=6. Maybe I can stop passing -fno-integrated-as if arm_version==6 to unbreak the bot.
,
Jun 10 2017
Looks like your thing only failed on cros, which doesn't use our hermetic clang. …oh, also you deleted the -B bit, we do always need that.
,
Jun 10 2017
I'm trying the arm_version=6 check at https://codereview.chromium.org/2932043004/ . Maybe it'll also need a !is_chromeos or something.
,
Jun 10 2017
Err, if we tell clang to not shell out to gas, we do not need -B. Sorry. Also sorry about all the emails.
,
Jun 10 2017
Also checked that https://bugs.llvm.org//show_bug.cgi?id=23000#c14 is still an issue for arm-v7
,
Jun 11 2017
The following revision refers to this bug: https://chromium.googlesource.com/chromium/src.git/+/a4fb1dcc42b4f733129e9c3dfba2add43c25d740 commit a4fb1dcc42b4f733129e9c3dfba2add43c25d740 Author: thakis <thakis@chromium.org> Date: Sun Jun 11 00:01:35 2017 clang/arm: Use integrated assembler for boringssl for arm_version 6. An arm_version 6 file assumes that __clang__ means that clang's assembler is being used, while it only really identifies clang is used as preprocessor. Luckily, it looks like only the armv7 assembly code in boringssl is incompatible with clang's built-in assembler. BUG= 732066 ,124610 TBR=davidben Review-Url: https://codereview.chromium.org/2932043004 Cr-Commit-Position: refs/heads/master@{#478524} [modify] https://crrev.com/a4fb1dcc42b4f733129e9c3dfba2add43c25d740/third_party/boringssl/BUILD.gn
,
Jun 11 2017
Good enough for now (https://build.chromium.org/p/chromium.android/builders/Android%20Cronet%20ARMv6%20Builder/builds/5007).
,
Jun 11 2017
I somewhat suspect the bsaes issue can be resolved by swapping all (some of?) those __APPLE__ checks to __clang__. There were other cases where upstream made that swap, but not those. Though I guess this bug suggests that it may, in turn, trigger this bug where the preprocessor does not properly report if -fno-integerated-as is being used. Perhaps we need another BORINGSSL_CLANG_SUPPORTS_DOT_ARCH-like define.
,
Jun 16 2017
I haven't gotten clang (Android NDK r15) to be happy with bsaes-armv7.pl (I think I now understand why upstream doesn't build all its files in Thumb mode...), but I believe this will fix the -fno-integrated-as incompatibility, and has some precedent so hopefully upstream will approve: https://github.com/openssl/openssl/pull/3694 Restoring a -fno-integrated-as is, of course, not the direction we ultimately want to go, but this way we have more options if further problems crop up. We got kinda lucky with r478524 that the problem was isolated to ports where the integrated assembler mattered.
,
Jun 16 2017
Do you know why they don't do .syntax unified unconditionally? I thought that has been working in gcc for a decade or so.
,
Jun 16 2017
Beats me. They love to support truly ancient assemblers, but I'll ask.
,
Jun 28 2017
The following revision refers to this bug: https://boringssl.googlesource.com/boringssl/+/3c9729212be5d30ea5ab1d4007842ec527125342 commit 3c9729212be5d30ea5ab1d4007842ec527125342 Author: David Benjamin <davidben@google.com> Date: Wed Jun 28 13:35:29 2017 Fix chacha-armv4.pl with clang -fno-integrated-as. The __clang__-guarded #defines cause gas to complain if clang is passed -fno-integrated-as. Emitting .syntax unified when those are used fixes this. This matches the change made to ghash-armv4.pl in upstream's 6cf412c473d8145562b76219ce3da73b201b3255. See also https://github.com/openssl/openssl/pull/3694. This fixes the build with the latest Android NDK (use the NDK-supplied toolchain file) with the armeabi ABI. Bug: chromium:732066 Change-Id: Ic6ca633a58edbe8ae8c7d501bd9515c2476fd7c2 Reviewed-on: https://boringssl-review.googlesource.com/17404 Commit-Queue: Steven Valdez <svaldez@google.com> Reviewed-by: Steven Valdez <svaldez@google.com> CQ-Verified: CQ bot account: commit-bot@chromium.org <commit-bot@chromium.org> [modify] https://crrev.com/3c9729212be5d30ea5ab1d4007842ec527125342/crypto/chacha/asm/chacha-armv4.pl |
||
►
Sign in to add a comment |
||
Comment 1 by davidben@chromium.org
, Jun 10 2017