]> granicus.if.org Git - clang/commit
Introduce code_model macros
authorAli Tamur <tamur@google.com>
Mon, 8 Oct 2018 22:25:20 +0000 (22:25 +0000)
committerAli Tamur <tamur@google.com>
Mon, 8 Oct 2018 22:25:20 +0000 (22:25 +0000)
commitcb44f60cfc0a401ca2c2da40dac0a19391f232a6
treec2838fc9b83de607eace091a48eb8ee3c8182a0a
parent2bce94da8a363b4ffbd7ba2d6a1941942f9bac04
Introduce code_model macros

Summary:
gcc defines macros such as __code_model_small_ based on the user passed command line flag -mcmodel. clang accepts a flag with the same name and similar effects, but does not generate any macro that the user can use. This cl narrows the gap between gcc and clang behaviour.

However, achieving full compatibility with gcc is not trivial: The set of valid values for mcmodel in gcc and clang are not equal. Also, gcc defines different macros for different architectures. In this cl, we only tackle an easy part of the problem and define the macro only for x64 architecture. When the user does not specify a mcmodel, the macro for small code model is produced, as is the case with gcc.

Reviewers: compnerd, MaskRay

Reviewed By: MaskRay

Subscribers: cfe-commits

Tags: #clang

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@344000 91177308-0d34-0410-b5e6-96231b3b80d8
include/clang/Basic/TargetOptions.h
lib/Basic/Targets/X86.cpp
lib/Frontend/CompilerInvocation.cpp
test/Preprocessor/init.c