Skip to content
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

Clang crash with x86_64 architecture in ndk21 (works in ndk20b) [BUG] #1184

Closed
chrisbabcock-epic opened this issue Feb 6, 2020 · 11 comments
Closed
Assignees
Milestone

Comments

@chrisbabcock-epic
Copy link

Description

Getting a crash in clang with NDK 21 for x86_64 which does not repro on NDK 20b.

  1. parser at end of file
  2. Code generation
  3. Running pass 'Function Pass Manager' on module 'G:/RenderPlat/Engine/Source/Runtime/Core/Private/Internationalization/TextLocalizationManager.cpp'.
  4. Running pass 'Live DEBUG_VALUE analysis' on function '@"_ZZ27ApplyDefaultCultureSettings22ELocalizationLoadFlagsENK3$_3clERK7FStringS3_PKDsb"'
    #0 0x00007ff65ff3222a (g:\android-ndk-r21\toolchains\llvm\prebuilt\windows-x86_64\bin\clang++.exe+0x156222a)
    Clang3.8 cross-compile linker issues libc (undefined references) #1 0x00007ff65ff2fd54 (g:\android-ndk-r21\toolchains\llvm\prebuilt\windows-x86_64\bin\clang++.exe+0x155fd54)
    ndk-gdb fails on OS X #2 0x00007ff65f0ba9a2 (g:\android-ndk-r21\toolchains\llvm\prebuilt\windows-x86_64\bin\clang++.exe+0x6ea9a2)
    ndk-gdb.py fails #3 0x00007ff65ebd329b (g:\android-ndk-r21\toolchains\llvm\prebuilt\windows-x86_64\bin\clang++.exe+0x20329b)
    ndk-gdb.py --project option treats ~/... as a relative path #4 0x00007ff65ebd35e3 (g:\android-ndk-r21\toolchains\llvm\prebuilt\windows-x86_64\bin\clang++.exe+0x2035e3)
    Unknown argument -mandroid #5 0x00007ff65ebd3c35 (g:\android-ndk-r21\toolchains\llvm\prebuilt\windows-x86_64\bin\clang++.exe+0x203c35)
    asan_device_setup error bricks phone #6 0x00007ff65f9cd67f (g:\android-ndk-r21\toolchains\llvm\prebuilt\windows-x86_64\bin\clang++.exe+0xffd67f)
    no renderscript headers/library in r11 #7 0x00007ff65fce8362 (g:\android-ndk-r21\toolchains\llvm\prebuilt\windows-x86_64\bin\clang++.exe+0x1318362)
    clang __thread caused linker error #8 0x00007ff660c0fc03 (g:\android-ndk-r21\toolchains\llvm\prebuilt\windows-x86_64\bin\clang++.exe+0x223fc03)
    Clang not compiled with OpenMP support #9 0x00007ff65fc54ae0 (g:\android-ndk-r21\toolchains\llvm\prebuilt\windows-x86_64\bin\clang++.exe+0x1284ae0)
    error: undefined reference to '__atomic_exchange_4' #10 0x00007ff65ef8edff (g:\android-ndk-r21\toolchains\llvm\prebuilt\windows-x86_64\bin\clang++.exe+0x5bedff)
    Support for _POSIX_THREAD_SAFE_FUNCTIONS #11 0x00007ff65efdab76 (g:\android-ndk-r21\toolchains\llvm\prebuilt\windows-x86_64\bin\clang++.exe+0x60ab76)
    ld.bfd 2.25.51 packaged with NDK r11 produces unsupported R_ARM_COPY relocation #12 0x00007ff65e9d6576 (g:\android-ndk-r21\toolchains\llvm\prebuilt\windows-x86_64\bin\clang++.exe+0x6576)
    No support for debugging library projects #13 0x00007ff65e9d43fa (g:\android-ndk-r21\toolchains\llvm\prebuilt\windows-x86_64\bin\clang++.exe+0x43fa)
    Using precompiled header causes compilation error of tagged files #14 0x00007ff65e9d1395 (g:\android-ndk-r21\toolchains\llvm\prebuilt\windows-x86_64\bin\clang++.exe+0x1395)
    Compile error when including <complex> #15 0x00007ff65e9d14c8 (g:\android-ndk-r21\toolchains\llvm\prebuilt\windows-x86_64\bin\clang++.exe+0x14c8)
    Compile error when using clang and precompiled headers #16 0x00007fff68721fe4 (C:\WINDOWS\System32\KERNEL32.DLL+0x11fe4)
    r11: libc++_static.a contains symbols in libc.a (causes multiple definition error) #17 0x00007fff6af0cb31 (C:\WINDOWS\SYSTEM32\ntdll.dll+0x6cb31)
    clang++: error: clang frontend command failed due to signal (use -v to see invocation)
    Android (5900059 based on r365631c) clang version 9.0.8 (https://android.googlesource.com/toolchain/llvm-project 207d7abc1a2abf3ef8d4301736d6a7ebc224a290) (based on LLVM 9.0.8svn)
    Target: x86_64-none-linux-android21
    Thread model: posix
    InstalledDir: g:\android-ndk-r21\toolchains\llvm\prebuilt\windows-x86_64\bin
    clang++: note: diagnostic msg: PLEASE submit a bug report to https://github.com/android-ndk/ndk/issues and include the crash backtrace, preprocessed source, and associated run script.
    clang++: note: diagnostic msg:

U
clang_bug.zip
PLEASE ATTACH THE FOLLOWING FILES TO THE BUG REPORT:
Preprocessed source(s) and associated run script(s) are located at:
clang++: note: diagnostic msg: C:\Users\CHRIS1.BAB\AppData\Local\Temp\TextLocalizationManager-895af9.cpp
clang++: note: diagnostic msg: C:\Users\CHRIS
1.BAB\AppData\Local\Temp\TextLocalizationManager-895af9.sh
clang++: note: diagnostic msg:

Environment Details

  • NDK Version: 21.0.6113669
  • Build system: UE4 toolchain
  • Host OS: Windows 10
  • ABI: x86_64
  • NDK API level: 21
  • Device API level: 29
@stephenhines
Copy link
Collaborator

This doesn't reproduce if I try this out with the current r370808b version we are using in the platform. I had to fix some of the arguments (replacing -mdisable-fp-elim and -momit-leaf-frame-pointer with -mframe-pointer=non-leaf), but the results should be the same. Chih-hung, can you possibly bisect this, so that we can cherry-pick the fix for an update to NDK r21?

@pirama-arumuga-nainar
Copy link
Collaborator

@gburgessiv helped us bisect clang changes. This regression was caused by upstream change b6e376ddfa1715c0ea0e975fc7fb033da2814661 and fixed by 88729e3dec363e67ab63ce5850b5bb1a6804b242.

@stephenhines
Copy link
Collaborator

Ugh, I mixed this bug up with a different one. This is already in our latest toolchain, so isn't needed for that build. I will make sure this gets fixed in an update to r21 myself.

@chrisbabcock-epic
Copy link
Author

This is now occurring for armv7 and arm64-v8a as well.

@pirama-arumuga-nainar
Copy link
Collaborator

pirama-arumuga-nainar commented Mar 10, 2020

@chrisbabcock-epic The fix for this applies only to (https://android-review.googlesource.com/c/toolchain/llvm-project/+/1251676). Does the same code/reproducer crash on armv7, arm64-v8a? If not, please upload a new reproducer.

@pirama-arumuga-nainar
Copy link
Collaborator

The reproducer does not apply for arm/arm64 because it's been preprocessed for x86_64. @chrisbabcock-epic if you're sure this also happens on non-x86, please file a new bug/reproducer as the current cherry-pick only fixes this for x86.

@DanAlbert
Copy link
Member

(and do so quickly if you want it to be picked up for r21b)

@deathlyrage
Copy link

deathlyrage commented Mar 27, 2020

Also having this issue with UE 4.25 too, only x86

@chrisbabcock-epic
Copy link
Author

This is only happening on x86_64 for me; disregard the arm/arm64 report.

I have confirmed the r21b compiler does not have this issue with UE 4.25.

@stephenhines
Copy link
Collaborator

https://android-review.googlesource.com/c/toolchain/llvm-project/+/1251676 is the patch to the r21b toolchain that fixes this (for completeness).

@DanAlbert
Copy link
Member

Fix is in build 6352462 on https://ci.android.com/builds/branches/aosp-ndk-release-r21/grid?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants