llvm-project/clang
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
..
INPUTS
bindings [libclang] Support for querying whether an enum is scoped 2017-07-12 11:35:11 +00:00
cmake Remove LLVMFuzzer from list of bundled libraries for Fuchsia 2017-08-23 00:09:33 +00:00
docs docs: don't say that data flow tracing interface is unstable 2017-08-31 11:02:44 +00:00
examples Add LLVMOption to clang-interpreter, corresponding to r291938. 2017-01-14 08:54:05 +00:00
include [analyzer] Performance optimizations for the CloneChecker 2017-08-31 07:10:46 +00:00
lib [clang-cl] Explicitly set object format to COFF in CL mode 2017-08-31 20:31:30 +00:00
runtime
test Revert r312224: "[ItaniumCXXABI] Always use linkonce_odr linkage for RTTI data on MinGW" 2017-08-31 09:46:27 +00:00
tools [libclang]: Honor LIBCLANG_NOTHREADS for clang_parseTranslationUnit* 2017-08-29 09:08:02 +00:00
unittests Disable clang-format's MemoizationTest as it becomes prohibitive with EXPENSIVE_CHECKS 2017-08-31 18:49:34 +00:00
utils Do not look through pack expansions when looking for unexpanded parameter packs. 2017-08-15 22:58:45 +00:00
www [cxx_status] Update to describe current status a bit better. 2017-08-30 23:10:31 +00:00
.arcconfig
.clang-format
.clang-tidy
.gitignore
CMakeLists.txt CMake: only try to find the Z3 package when `CLANG_ANALYZER_BUILD_Z3` is ON 2017-08-27 20:24:23 +00:00
CODE_OWNERS.TXT
INSTALL.txt
LICENSE.TXT
ModuleInfo.txt
NOTES.txt
README.txt Remove test commit. 2017-06-30 03:03:28 +00:00

README.txt

//===----------------------------------------------------------------------===//
// C Language Family Front-end
//===----------------------------------------------------------------------===//

Welcome to Clang.  This is a compiler front-end for the C family of languages
(C, C++, Objective-C, and Objective-C++) which is built as part of the LLVM
compiler infrastructure project.

Unlike many other compiler frontends, Clang is useful for a number of things
beyond just compiling code: we intend for Clang to be host to a number of
different source-level tools.  One example of this is the Clang Static Analyzer.

If you're interested in more (including how to build Clang) it is best to read
the relevant web sites.  Here are some pointers:

Information on Clang:              http://clang.llvm.org/
Building and using Clang:          http://clang.llvm.org/get_started.html
Clang Static Analyzer:             http://clang-analyzer.llvm.org/
Information on the LLVM project:   http://llvm.org/

If you have questions or comments about Clang, a great place to discuss them is
on the Clang development mailing list:
  http://lists.llvm.org/mailman/listinfo/cfe-dev

If you find a bug in Clang, please file it in the LLVM bug tracker:
  http://llvm.org/bugs/