-
Notifications
You must be signed in to change notification settings - Fork 259
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
-fsanitize=signed-integer-overflow causes linker errors #184
Comments
Sorry, somehow I didn't see this bug until now.
|
https://llvm.org/bugs/show_bug.cgi?id=28629 is the upstream bug for this. The truth is that we want to switch to compiler-rt, but just haven't had the ability to complete the transition. It is something we are looking at doing, however I don't have a great estimate on when it will be completed. You can add your own weak versions of those symbols in the meantime to get unblocked. |
(For others who might end up here via a search: if you're trying to compile using clang's undefined sanitizer on a regular 32 bit Linux distro and you're hitting the "undefined reference to `__mulodi4'" a workaround might be to link against the appropriate libclang_rt.builtins* : $ cat <<EOF > mulodi4.c
int main(void) {
long long ll = 1;
int i1 = 2;
return (ll * i1);
}
EOF
$ clang-4.0 -fsanitize=undefined mulodi4.c
/tmp/foo-605e44.o: In function `main':
foo.c:(.text+0x5a): undefined reference to `__mulodi4'
clang: error: linker command failed with exit code 1 (use -v to see invocation)
$ clang-4.0 -fsanitize=undefined mulodi4.c /usr/lib/llvm-4.0/lib/clang/4.0.0/lib/linux/libclang_rt.builtins-i686.a
$ echo $?
0 See ldc-developers/ldc#813 for an example of a project that works around the problem) |
The parent change ran into an issue where enabling UBSan on an i686 build caused it to use __mulodi4. android/ndk#184 documents linking against libclang_rt.builtins-i686.a, but that's not available from soong either. Bug: 62378620 Bug: 29412086 Test: x86 builds work again Change-Id: I730d59558aa4ed28f8a11b5393e037111e320f29
This no longer happens for this particular case in r17. Seems Clang isn't generating this call for signed-integer-overflow any more. Closing in favor of #294 as the root cause rather than the symptom. |
The parent change ran into an issue where enabling UBSan on an i686 build caused it to use __mulodi4. android/ndk#184 documents linking against libclang_rt.builtins-i686.a, but that's not available from soong either. Bug: 62378620 Bug: 29412086 Test: x86 builds work again Change-Id: I730d59558aa4ed28f8a11b5393e037111e320f29
Happens again in r18 on armv7, 18.1.5063045: |
It's fixed in r19 though, so nothing to do here: #294. |
Summary: Error message: DerivedSources/ForwardingHeaders/wtf/CheckedArithmetic.h:458: error: undefined reference to '__mulodi4' This happens only on debug build + ARMv7 NDK r19 did fix this: android/ndk#184 To aligned NDK r17c with RN, fallback to use non bulitin overflow check. Related context: https://codereview.chromium.org/2011073002
The parent change ran into an issue where enabling UBSan on an i686 build caused it to use __mulodi4. android/ndk#184 documents linking against libclang_rt.builtins-i686.a, but that's not available from soong either. Bug: 62378620, 29412086 Test: x86 builds work again Change-Id: I730d59558aa4ed28f8a11b5393e037111e320f29
The parent change ran into an issue where enabling UBSan on an i686 build caused it to use __mulodi4. android/ndk#184 documents linking against libclang_rt.builtins-i686.a, but that's not available from soong either. Bug: 62378620 Test: x86 builds work again Change-Id: I730d59558aa4ed28f8a11b5393e037111e320f29
If I compile with
-fsanitize=signed-integer-overflow
flag the binaries try to call the__mulodi4
function and it will give an undefined reference linker error. This happens both on ARM and x86 archs. Most of the other similar sanitizers work well.The text was updated successfully, but these errors were encountered: