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

Add support for clang-cl and llvm-undname #4371

Merged
merged 2 commits into from
Dec 18, 2022

Conversation

tru
Copy link
Contributor

@tru tru commented Nov 30, 2022

This PR adds support for clang-cl and llvm-undname.

This makes it possible to cross-compile from linux to windows with clang-cl and make it behave like msvc.

There is also a bugfix that fixes the parsing of .cv_file.

Here is an example configuration for cross-compiling with clang-cl:

group.clangcl.compilers=clangcl
group.clangcl.groupName=clang-cl win64
group.clangcl.instructionSet=amd64
group.clangcl.compilerType=clang-cl
group.clangcl.options=/winsdkversion 10.0.22000.0 /winsysroot /path/to/sysroot
group.clangcl.demangler=/usr/local/bin/llvm-undname
group.clangcl.demanglerType=win32-llvm
group.clangcl.supportsBinary=false

Copy link
Member

@RubenRBS RubenRBS left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@@ -0,0 +1,72 @@
// Copyright (c) 2018, Compiler Explorer Authors
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copyright header date is outdate

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh funny - I just copied from clang.ts I think, didn't even reflect on the year :)

@@ -0,0 +1,94 @@
// Copyright (c) 2018, Compiler Explorer Authors
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here

@partouf
Copy link
Contributor

partouf commented Nov 30, 2022

re cdecl: I was wondering if maybe fastcall would be the default, but that's not the case https://learn.microsoft.com/en-us/cpp/cpp/cdecl?view=msvc-170 - so removing cdecl should be ok

@partouf
Copy link
Contributor

partouf commented Dec 6, 2022

the undname seems potentially quite intensive with a call for each mangled name

it might be better to use the stdin option as suggested here? https://github.com/microsoft/checkedc-llvm/blob/master/tools/llvm-undname/llvm-undname.cpp#L59

@partouf
Copy link
Contributor

partouf commented Dec 6, 2022

You can set stdin by setting execOptions.stdin = 'string...';

@tru
Copy link
Contributor Author

tru commented Dec 7, 2022

Thanks for the suggestion - it worked fine when I figured out that the execOption variable is input not stdin :)

@tru
Copy link
Contributor Author

tru commented Dec 8, 2022

Any additional feedback on this one?

Copy link
Member

@RubenRBS RubenRBS left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Only one minor nitpick request, but other than that, it looks great! Thanks!

return 'win32-llvm';
}

async execDemangler() {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd love to have a test that ensures this works as expected so future changes to this can be made with some level of confidence :)

@RubenRBS
Copy link
Member

WOuld love to have the tests for the demanging at some point, but it's not a blocker. Merging now, thanks for your patience in this :)

@RubenRBS RubenRBS merged commit 96aa4be into compiler-explorer:main Dec 18, 2022
@jeremy-rifkin
Copy link
Member

This is now live

mattgodbolt pushed a commit that referenced this pull request Dec 20, 2022
* Added llvm demangler code

* Added clang-cl compiler class
mattgodbolt pushed a commit that referenced this pull request Jan 24, 2023
* Added llvm demangler code

* Added clang-cl compiler class
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants