diff options
| author | Peter Collingbourne <peter@pcc.me.uk> | 2016-04-27 20:39:53 +0000 |
|---|---|---|
| committer | Peter Collingbourne <peter@pcc.me.uk> | 2016-04-27 20:39:53 +0000 |
| commit | a8b2f7c0d7d2432c4574cc564b6b4488c6f970b7 (patch) | |
| tree | a2e99c8c523cbd9ff2fa7963cedfc91f014f088b /clang/include | |
| parent | 60c4e6aafa8904eecb79a2109ed4c8b8be942005 (diff) | |
| download | bcm5719-llvm-a8b2f7c0d7d2432c4574cc564b6b4488c6f970b7.tar.gz bcm5719-llvm-a8b2f7c0d7d2432c4574cc564b6b4488c6f970b7.zip | |
Rework interface for bitset-using features to use a notion of LTO visibility.
Bitsets, and the compiler features they rely on (vtable opt, CFI),
only have visibility within the LTO'd part of the linkage unit. Therefore,
only enable these features for classes with hidden LTO visibility. This
notion is based on object file visibility or (on Windows)
dllimport/dllexport attributes.
We provide the [[clang::lto_visibility_public]] attribute to override the
compiler's LTO visibility inference in cases where the class is defined
in the non-LTO'd part of the linkage unit, or where the ABI supports
calling classes derived from abstract base classes with hidden visibility
in other linkage units (e.g. COM on Windows).
If the cross-DSO CFI mode is enabled, bitset checks are emitted even for
classes with public LTO visibility, as that mode uses a separate mechanism
to cause bitsets to be exported.
This mechanism replaces the whole-program-vtables blacklist, so remove the
-fwhole-program-vtables-blacklist flag.
Because __declspec(uuid()) now implies [[clang::lto_visibility_public]], the
support for the special attr:uuid blacklist entry is removed.
Differential Revision: http://reviews.llvm.org/D18635
llvm-svn: 267784
Diffstat (limited to 'clang/include')
| -rw-r--r-- | clang/include/clang/Basic/Attr.td | 6 | ||||
| -rw-r--r-- | clang/include/clang/Basic/AttrDocs.td | 7 | ||||
| -rw-r--r-- | clang/include/clang/Driver/CC1Options.td | 3 | ||||
| -rw-r--r-- | clang/include/clang/Driver/Options.td | 3 | ||||
| -rw-r--r-- | clang/include/clang/Frontend/CodeGenOptions.def | 4 | ||||
| -rw-r--r-- | clang/include/clang/Frontend/CodeGenOptions.h | 3 |
6 files changed, 20 insertions, 6 deletions
diff --git a/clang/include/clang/Basic/Attr.td b/clang/include/clang/Basic/Attr.td index 1f86b09cc97..d5dcdc06354 100644 --- a/clang/include/clang/Basic/Attr.td +++ b/clang/include/clang/Basic/Attr.td @@ -1611,6 +1611,12 @@ def WeakRef : InheritableAttr { let Documentation = [Undocumented]; } +def LTOVisibilityPublic : InheritableAttr { + let Spellings = [CXX11<"clang", "lto_visibility_public">]; + let Subjects = SubjectList<[Record]>; + let Documentation = [LTOVisibilityDocs]; +} + def AnyX86Interrupt : InheritableAttr, TargetSpecificAttr<TargetAnyX86> { // NOTE: If you add any additional spellings, ARMInterrupt's, // MSP430Interrupt's and MipsInterrupt's spellings must match. diff --git a/clang/include/clang/Basic/AttrDocs.td b/clang/include/clang/Basic/AttrDocs.td index b1b9e444383..39c4257ddfe 100644 --- a/clang/include/clang/Basic/AttrDocs.td +++ b/clang/include/clang/Basic/AttrDocs.td @@ -2380,3 +2380,10 @@ The ``ifunc`` attribute may only be used on a function declaration. A function Not all targets support this attribute. ELF targets support this attribute when using binutils v2.20.1 or higher and glibc v2.11.1 or higher. Non-ELF targets currently do not support this attribute. }]; } + +def LTOVisibilityDocs : Documentation { + let Category = DocCatType; + let Content = [{ +See :doc:`LTOVisibility`. + }]; +} diff --git a/clang/include/clang/Driver/CC1Options.td b/clang/include/clang/Driver/CC1Options.td index e88e4bd259f..7c1777fc186 100644 --- a/clang/include/clang/Driver/CC1Options.td +++ b/clang/include/clang/Driver/CC1Options.td @@ -282,6 +282,9 @@ def fprofile_instrument_path_EQ : Joined<["-"], "fprofile-instrument-path=">, def fprofile_instrument_use_path_EQ : Joined<["-"], "fprofile-instrument-use-path=">, HelpText<"Specify the profile path in PGO use compilation">; +def flto_visibility_public_std: + Flag<["-"], "flto-visibility-public-std">, + HelpText<"Use public LTO visibility for classes in std and stdext namespaces">; //===----------------------------------------------------------------------===// // Dependency Output Options diff --git a/clang/include/clang/Driver/Options.td b/clang/include/clang/Driver/Options.td index d2e66572884..aaa4ce92f7b 100644 --- a/clang/include/clang/Driver/Options.td +++ b/clang/include/clang/Driver/Options.td @@ -1152,9 +1152,6 @@ def fwhole_program_vtables : Flag<["-"], "fwhole-program-vtables">, Group<f_Grou Flags<[CC1Option]>, HelpText<"Enables whole-program vtable optimization. Requires -flto">; def fno_whole_program_vtables : Flag<["-"], "fno-whole-program-vtables">, Group<f_Group>; -def fwhole_program_vtables_blacklist_EQ : Joined<["-"], "fwhole-program-vtables-blacklist=">, - Group<f_Group>, Flags<[CC1Option]>, - HelpText<"Path to a blacklist file for whole-program vtable optimization">; def fwrapv : Flag<["-"], "fwrapv">, Group<f_Group>, Flags<[CC1Option]>, HelpText<"Treat signed integer overflow as two's complement">; def fwritable_strings : Flag<["-"], "fwritable-strings">, Group<f_Group>, Flags<[CC1Option]>, diff --git a/clang/include/clang/Frontend/CodeGenOptions.def b/clang/include/clang/Frontend/CodeGenOptions.def index 14a6ae50c1a..49b306fd777 100644 --- a/clang/include/clang/Frontend/CodeGenOptions.def +++ b/clang/include/clang/Frontend/CodeGenOptions.def @@ -187,6 +187,10 @@ CODEGENOPT(EmitLLVMUseLists, 1, 0) ///< Control whether to serialize use-lists. CODEGENOPT(WholeProgramVTables, 1, 0) ///< Whether to apply whole-program /// vtable optimization. +/// Whether to use public LTO visibility for entities in std and stdext +/// namespaces. This is enabled by clang-cl's /MT and /MTd flags. +CODEGENOPT(LTOVisibilityPublicStd, 1, 0) + /// The user specified number of registers to be used for integral arguments, /// or 0 if unspecified. VALUE_CODEGENOPT(NumRegisterParameters, 32, 0) diff --git a/clang/include/clang/Frontend/CodeGenOptions.h b/clang/include/clang/Frontend/CodeGenOptions.h index be176df7f7b..71acfc6da40 100644 --- a/clang/include/clang/Frontend/CodeGenOptions.h +++ b/clang/include/clang/Frontend/CodeGenOptions.h @@ -199,9 +199,6 @@ public: /// \brief A list of all -fno-builtin-* function names (e.g., memset). std::vector<std::string> NoBuiltinFuncs; - /// List of blacklist files for the whole-program vtable optimization feature. - std::vector<std::string> WholeProgramVTablesBlacklistFiles; - public: // Define accessors/mutators for code generation options of enumeration type. #define CODEGENOPT(Name, Bits, Default) |

