llvm-project/clang/lib
Oleg Ranevskyy 8052318287 [clang-cl] Explicitly set object format to COFF in CL mode
Summary:
Currently object format is taken from the default target triple. For toolchains with a non-COFF default target this may result in an object format inappropriate for pc-windows and lead to compilation issues. 

For example, the default triple `aarch64-linux-elf` may produce something like `aarch64-pc-windows-msvc19.0.24215-elf` in CL mode. Clang creates `MicrosoftARM64TargetInfo` for such triple with data layout `e-m:w-p:64:64-i32:32-i64:64-i128:128-n32:64-S128`. On the other hand, the AArch64 backend in `computeDataLayout` detects a non-COFF target and selects `e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128` as data layout for little endian. Different layouts used by clang and the backend cause an error:
```
error: backend data layout 'e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128'
 does not match expected target description 'e-m:w-p:64:64-i32:32-i64:64-i128:128-n32:64-S128'
```
This can be observed on the clang's Driver/cl-pch.c test with AArch64 as a default target.

This patch enforces COFF in CL mode.

Reviewers: hans

Reviewed By: hans

Subscribers: cfe-commits, aemerson, asl, kristof.beyls

Differential Revision: https://reviews.llvm.org/D37336

llvm-svn: 312275
2017-08-31 20:31:30 +00:00
..
ARCMigrate Added LLVM_FALLTHROUGH to address warning: this statement may fall through. NFC. 2017-06-03 06:23:19 +00:00
AST Revert "Improve constant expression evaluation of arrays of unknown bound." 2017-08-30 10:44:46 +00:00
ASTMatchers [ASTMatchers] Fix use after free. 2017-06-09 17:55:42 +00:00
Analysis [analyzer] Performance optimizations for the CloneChecker 2017-08-31 07:10:46 +00:00
Basic Change Diagnostic Category size error from runtime to compiletime 2017-08-28 18:53:17 +00:00
CodeGen Revert r312224: "[ItaniumCXXABI] Always use linkonce_odr linkage for RTTI data on MinGW" 2017-08-31 09:46:27 +00:00
Driver [clang-cl] Explicitly set object format to COFF in CL mode 2017-08-31 20:31:30 +00:00
Edit [clang] Fix format specifiers fixits for nested macros 2017-06-20 20:46:58 +00:00
Format clang-format: Add preprocessor directive indentation 2017-08-30 14:34:57 +00:00
Frontend [modules] Add ability to specify module name to module file mapping (reapply) 2017-08-31 06:26:43 +00:00
FrontendTool Update after LLVM change r309087 2017-07-26 09:10:17 +00:00
Headers [X86] Implement broadcastf32x2 and broadcasti32x2 intrinsics using __builtin_shufflevector instead builtins 2017-08-30 16:15:12 +00:00
Index Print enum constant values using the original source formatting 2017-08-17 13:41:55 +00:00
Lex [modules] Add ability to specify module name to module file mapping (reapply) 2017-08-31 06:26:43 +00:00
Parse [c++2a] P0683R1: Permit default member initializers for bit-fields. 2017-08-28 00:28:14 +00:00
Rewrite [Analyzer] Add support for displaying cross-file diagnostic paths in HTML output 2017-08-03 18:12:22 +00:00
Sema Suppress -Wdelete-non-virtual-dtor warnings about classes defined in system headers. 2017-08-31 06:17:08 +00:00
Serialization [modules] Add ability to specify module name to module file mapping (reapply) 2017-08-31 06:26:43 +00:00
StaticAnalyzer [analyzer] Performance optimizations for the CloneChecker 2017-08-31 07:10:46 +00:00
Tooling Recommit r312127: [refactor] AST selection tree should contain syntactic 2017-08-30 15:28:01 +00:00
CMakeLists.txt