-
Notifications
You must be signed in to change notification settings - Fork 13.6k
[Clang] [Driver] add a Cygwin ToolChain #135691
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
Merged
Merged
Changes from 1 commit
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
949ec2a
[Clang] [Driver] add a Cygwin ToolChain
jeremyd2019 2604448
[Clang][Driver] add test for new Cygwin driver
jeremyd2019 35091a9
fixup! [Clang] [Driver] add a Cygwin ToolChain
jeremyd2019 7cefcc5
fixup! [Clang] [Driver] add a Cygwin ToolChain
jeremyd2019 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
// RUN: %clang -### %s --target=i686-pc-windows-cygnus --sysroot=%S/Inputs/basic_cygwin_tree \ | ||
// RUN: -resource-dir=%S/Inputs/resource_dir \ | ||
// RUN: --stdlib=platform 2>&1 | FileCheck --check-prefix=CHECK %s | ||
// CHECK: "-cc1" | ||
// CHECK-SAME: "-resource-dir" "[[RESOURCE:[^"]+]]" | ||
// CHECK-SAME: "-isysroot" "[[SYSROOT:[^"]+]]" | ||
// CHECK-SAME: {{^}} "-internal-isystem" "[[SYSROOT]]/usr/lib/gcc/i686-pc-cygwin/10/../../../../include/c++/10" | ||
// CHECK-SAME: {{^}} "-internal-isystem" "[[SYSROOT]]/usr/lib/gcc/i686-pc-cygwin/10/../../../../include/i686-pc-cygwin/c++/10" | ||
// CHECK-SAME: {{^}} "-internal-isystem" "[[SYSROOT]]/usr/lib/gcc/i686-pc-cygwin/10/../../../../include/c++/10/backward" | ||
// CHECK-SAME: {{^}} "-internal-isystem" "[[SYSROOT]]/usr/local/include" | ||
// CHECK-SAME: {{^}} "-internal-isystem" "[[RESOURCE]]{{(/|\\\\)}}include" | ||
// CHECK-SAME: {{^}} "-internal-isystem" "[[SYSROOT]]/usr/lib/gcc/i686-pc-cygwin/10/../../../../i686-pc-cygwin/include" | ||
// CHECK-SAME: "-internal-externc-isystem" "[[SYSROOT]]/include" | ||
// CHECK-SAME: {{^}} "-internal-externc-isystem" "[[SYSROOT]]/usr/include" | ||
// CHECK-SAME: {{^}} "-internal-externc-isystem" "[[SYSROOT]]/usr/include/w32api" | ||
// CHECK-SAME: "-femulated-tls" | ||
// CHECK-SAME: "-exception-model=dwarf" | ||
// CHECK: "{{.*}}gcc{{(\.exe)?}}" | ||
// CHECK-SAME: "-m32" | ||
|
||
// RUN: %clang -### %s --target=i686-pc-cygwin --sysroot=%S/Inputs/basic_cygwin_tree \ | ||
// RUN: --stdlib=platform -static 2>&1 | FileCheck --check-prefix=CHECK-STATIC %s | ||
// CHECK-STATIC: "-cc1" "-triple" "i686-pc-windows-cygnus" | ||
// CHECK-STATIC-SAME: "-static-define" | ||
// CHECK-STATIC: "{{.*}}gcc{{(\.exe)?}}" | ||
// CHECK-STATIC-SAME: "-static" | ||
|
||
// RUN: %clang -### %s --target=i686-pc-cygwin --sysroot=%S/Inputs/basic_cygwin_tree \ | ||
// RUN: -shared 2>&1 | FileCheck --check-prefix=CHECK-SHARED %s | ||
// CHECK-SHARED: "{{.*}}gcc{{(\.exe)?}}" | ||
// CHECK-SHARED-SAME: "-shared" | ||
|
||
// RUN: %clang -### -o %t %s 2>&1 -no-integrated-as -fuse-ld=ld \ | ||
// RUN: --gcc-toolchain=%S/Inputs/basic_cross_cygwin_tree/usr \ | ||
// RUN: --target=i686-pc-cygwin \ | ||
// RUN: | FileCheck --check-prefix=CHECK-CROSS %s | ||
// CHECK-CROSS: "-cc1" "-triple" "i686-pc-windows-cygnus" | ||
// CHECK-CROSS: "{{.*}}/Inputs/basic_cross_cygwin_tree/usr/lib/gcc/i686-pc-msys/10/../../../../i686-pc-msys/bin{{(/|\\\\)}}as" "--32" | ||
|
||
// RUN: %clang -### %s --target=x86_64-pc-windows-cygnus --sysroot=%S/Inputs/basic_cygwin_tree \ | ||
// RUN: -resource-dir=%S/Inputs/resource_dir \ | ||
// RUN: --stdlib=platform 2>&1 | FileCheck --check-prefix=CHECK-64 %s | ||
// CHECK-64: "-cc1" | ||
// CHECK-64-SAME: "-resource-dir" "[[RESOURCE:[^"]+]]" | ||
// CHECK-64-SAME: "-isysroot" "[[SYSROOT:[^"]+]]" | ||
// CHECK-64-SAME: {{^}} "-internal-isystem" "[[SYSROOT]]/usr/lib/gcc/x86_64-pc-msys/10/../../../../include/c++/10" | ||
// CHECK-64-SAME: {{^}} "-internal-isystem" "[[SYSROOT]]/usr/lib/gcc/x86_64-pc-msys/10/../../../../include/x86_64-pc-msys/c++/10" | ||
// CHECK-64-SAME: {{^}} "-internal-isystem" "[[SYSROOT]]/usr/lib/gcc/x86_64-pc-msys/10/../../../../include/c++/10/backward" | ||
// CHECK-64-SAME: {{^}} "-internal-isystem" "[[SYSROOT]]/usr/local/include" | ||
// CHECK-64-SAME: {{^}} "-internal-isystem" "[[RESOURCE]]{{(/|\\\\)}}include" | ||
// CHECK-64-SAME: {{^}} "-internal-isystem" "[[SYSROOT]]/usr/lib/gcc/x86_64-pc-msys/10/../../../../x86_64-pc-msys/include" | ||
// CHECK-64-SAME: "-internal-externc-isystem" "[[SYSROOT]]/include" | ||
// CHECK-64-SAME: {{^}} "-internal-externc-isystem" "[[SYSROOT]]/usr/include" | ||
// CHECK-64-SAME: {{^}} "-internal-externc-isystem" "[[SYSROOT]]/usr/include/w32api" | ||
// CHECK-64-SAME: "-femulated-tls" | ||
// CHECK-64-SAME: "-exception-model=seh" | ||
// CHECK-64: "{{.*}}gcc{{(\.exe)?}}" | ||
// CHECK-64-SAME: "-m64" | ||
|
||
// RUN: %clang -### %s --target=x86_64-pc-cygwin --sysroot=%S/Inputs/basic_cygwin_tree \ | ||
// RUN: --stdlib=platform -static 2>&1 | FileCheck --check-prefix=CHECK-64-STATIC %s | ||
// CHECK-64-STATIC: "-cc1" "-triple" "x86_64-pc-windows-cygnus" | ||
// CHECK-64-STATIC-SAME: "-static-define" | ||
// CHECK-64-STATIC: "{{.*}}gcc{{(\.exe)?}}" | ||
// CHECK-64-STATIC-SAME: "-static" | ||
|
||
// RUN: %clang -### %s --target=x86_64-pc-cygwin --sysroot=%S/Inputs/basic_cygwin_tree \ | ||
// RUN: -shared 2>&1 | FileCheck --check-prefix=CHECK-64-SHARED %s | ||
// CHECK-64-SHARED: "{{.*}}gcc{{(\.exe)?}}" | ||
// CHECK-64-SHARED-SAME: "-shared" | ||
|
||
// RUN: %clang -### -o %t %s 2>&1 -no-integrated-as -fuse-ld=ld \ | ||
// RUN: --gcc-toolchain=%S/Inputs/basic_cross_cygwin_tree/usr \ | ||
// RUN: --target=x86_64-pc-cygwin \ | ||
// RUN: | FileCheck --check-prefix=CHECK-64-CROSS %s | ||
// CHECK-64-CROSS: "-cc1" "-triple" "x86_64-pc-windows-cygnus" | ||
// CHECK-64-CROSS: "{{.*}}/Inputs/basic_cross_cygwin_tree/usr/lib/gcc/x86_64-pc-cygwin/10/../../../../x86_64-pc-cygwin/bin{{(/|\\\\)}}as" "--64" |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this mean that we invoke
gcc
to drive the linking? I guess that's what's being done now before this change as well (and the fewer changes in this PR, the better); but I guess that's a nice to have for future changes as well, to be able to call the linker directly without involving gcc inbetween?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes. Once you are not calling GCC, you need to teach the driver about the default library search paths (which should already be taken care of), and default libraries, and the startup object files. Which is probably ultimately necessary, but for now, we can just keep calling gcc.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agree with Jeremy, let's not spread oneselves too thinly.
Adding a dedicated driver is already a bit deal and solves a lot of problems.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, I forgot to follow up here. Yes, calling GCC for linking certainly is fine, as that's what we're doing right now anyway, I guess. Getting rid of that is a future nice-to-have but not a blocker for taking this first step.