From 1b112ecdbd187474b9bfb5603dccc280b75cf9b6 Mon Sep 17 00:00:00 2001 From: mtklein Date: Thu, 23 Jun 2016 11:20:58 -0700 Subject: [PATCH] Work around missing __mulodi4() on ARMv7 + Clang builds. __mulodi4() is roughly, int64_t __mulodi4(int64_t a, int64_t b, int* overflow) { int64_t result = a*b; *overflow = did_overflow(result); return result; } It's used by Clang's __builtin_smulll_overflow(), which is basically the same except it swaps the positions of the return value and the out parameter. DNG SDK in turn uses __builtin_smulll_overflow(). When building ARMv7 binaries with Clang, __mulodi4() turns up as a missing symbol. That's because it's defined in a separate compiler-rt library. I have not been able to link that. Instead, I've provided our own trivial __builtin_smulll_overflow(). Before this patch both nanobench and DM failed dynamically linking __mulodi4(). After this patch nanobench runs for a while, eventually segfaulting. DM immediately segfaults. BUG=skia: GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2011073002 Review-Url: https://codereview.chromium.org/2011073002 --- gyp/dng_sdk.gyp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/gyp/dng_sdk.gyp b/gyp/dng_sdk.gyp index 3d42624..be0c0f9 100644 --- a/gyp/dng_sdk.gyp +++ b/gyp/dng_sdk.gyp @@ -143,6 +143,14 @@ ['skia_os != "linux"', { 'sources': ['<@(headers)'], }], + ['skia_arch_type == "arm" and skia_clang_build', { + # DNG SDK uses __builtin_smulll_overflow() to detect 64x64 bit multiply overflow. + # On ARMv7, Clang implements this with __mulodi4() in libclang_rt. + # I can't quite figure out how to link that here, so instead here's a shim for + # __builtin_smulll_overflow() that multiplies normally assuming no overflow. + # Tracked in b/29412086. + 'defines': [ '__builtin_smulll_overflow(x,y,p)=(*(p)=(x)*(y), false)' ], + }], ], 'dependencies': [ 'libjpeg-turbo-selector.gyp:libjpeg-turbo-selector', -- 2.7.4