8000 bpo-33351: Patches to build on clang-cl by isuruf · Pull Request #18371 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

bpo-33351: Patches to build on clang-cl #18371

8000
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

Closed
wants to merge 9 commits into from
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Fix target flag
Also use the full target triple in the map
  • Loading branch information
isuruf authored Feb 27, 2020
commit 79fe165efe95f7fa87a058a504773ee8397794d6
10 changes: 5 additions & 5 deletions Lib/distutils/_msvccompiler.py
Original file line number Diff line number Diff line change
Expand Up @@ -197,10 +197,10 @@ def _find_exe(exe, paths=None):
# A map keyed by get_platform() return values to value accepted by
# clang as the triple.
PLAT_TO_LLVM_TARGETS = {
'win32': 'i686',
'win-amd64': 'x86_64',
'win-arm32': 'arm',
'win-arm64': 'aarch64',
'win32': 'i686-pc-windows-msvc',
'win-amd64': 'x86_64-pc-windows-msvc',
'win-arm32': 'arm-pc-windows-msvc',
'win-arm64': 'aarch64-pc-windows-msvc',
}

# A set containing the DLLs that are guaranteed to be available for
Expand Down Expand Up @@ -310,7 +310,7 @@ def initialize(self, plat_name=None):
]
if self.use_clang_cl:
# Add target for clang
Copy link

Choose a reason for hiding this comment

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

I don't know if CPython makes use of any intrinsic or built-ins, but I had problems with both.

Intrinsics required removing some of the include directories that are used with MSVC since clang doesn't need the .h files.

Correct builtin support (on 32 bit Windows) required linking agsint the builtin .lib file.

target_flag = "{}-pc-windows-msvc".format(PLAT_TO_LLVM_TARGETS[plat_name])
target_flag = "--target=" + PLAT_TO_LLVM_TARGETS[plat_name]
self.compile_options.append(target_flag)
self.compile_options_debug.append(target_flag)
# Remove whole program optimization flags to avoid warnings about
Expand Down
0