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 crashing with invalid llvm.linker.options on encountering detect_mismatch pragma #1149

Closed
pendyalasyam opened this issue Dec 9, 2019 · 7 comments
Assignees
Labels
Milestone

Comments

@pendyalasyam
Copy link

pendyalasyam commented Dec 9, 2019

I have a sample program test.cpp where it contains detect_mismatch pragma. While compiling this file with NDK r21 beta2's clang, it seems clang is crashing

test.cpp

#pragma detect_mismatch("Property", "Value")
extern void print();
void function()
{
print();
}

Command

ndk21\toolchains\llvm\prebuilt\windows-x86_64\bin\clang++.exe -cc1 -triple i686-none-linux-android -emit-obj -fms-extensions test.cpp

Output

fatal error: error in backend: invalid llvm.linker.options
Stack dump:
0. Program arguments: ndk21\toolchains\llvm\prebuilt\windows-x86_64\bin\clang++.exe -cc1 -triple i686-none-linux-android -emit-obj -fms-extensions -x c++ test.cpp

  1.  <eof> parser at end of file
    
  2.  Code generation
    

If I remove any of the compiler options (-emit-obj/-fms-extensions/-triple), it is getting compiled with out any issues.

Could you please help check why it is crashing.

Environment Details

  • NDK Version: R21 beta2
  • Build system: Custom
  • Host OS: Windows
@DanAlbert
Copy link
Member

@stephenhines Pirama is out for the year, can you take a look at this?

@pendyalasyam Does this work with r20?

@DanAlbert DanAlbert modified the milestones: r21, r22 Dec 9, 2019
@DanAlbert
Copy link
Member

@pendyalasyam Does this work with r20?

Never mind, easy enough to check that myself. It does not.

@stephenhines
Copy link
Collaborator

https://reviews.llvm.org/rGbb1616ba47261a0767063e85718d546165972120 is almost certainly the commit that fixes this (and I'll confirm that since it doesn't reproduce with upstream LLVM).

@stephenhines
Copy link
Collaborator

Confirmed that this is the commit, but I'll also point out that this pragma is an MS extension that does nothing on other platforms, so I think we can wait for the fix as part of a normal NDK release. Any other thoughts, @DanAlbert ?

@DanAlbert
Copy link
Member

Yeah, it's not a regression, so I've already triaged for r22.

@pendyalasyam
Copy link
Author

Thanks @DanAlbert , @stephenhines for looking into this issue. So, Can I expect the fix in R22?

@stephenhines
Copy link
Collaborator

This is already available in any r377782 release of the toolchain. This will definitely make R22.

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

No branches or pull requests

4 participants