__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
['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',