Index: CodeGen/arm64-microsoft-symbol-linkage.cpp =================================================================== --- /dev/null +++ CodeGen/arm64-microsoft-symbol-linkage.cpp @@ -0,0 +1,29 @@ +// REQUIRES: aarch64-registered-target + +// RUN: %clangxx -target aarch64-windows \ +// RUN: -fcxx-exceptions -emit-obj -c -o - %s \ +// RUN: | llvm-objdump -syms - 2>&1 | FileCheck %s --check-prefix LINK-DYN + +// RUN: %clangxx -target aarch64-windows -flto-visibility-public-std \ +// RUN: -fcxx-exceptions -emit-obj -c -o - %s \ +// RUN: | llvm-objdump -syms - 2>&1 | FileCheck %s --check-prefix LINK-STAT + +void foo1() { throw 1; } +// CHECK-LABEL: foo1 +// LINK-DYN: __imp__CxxThrowException +// LINK-STAT-NOT: __imp__CxxThrowException + +void bar(); +void foo2() noexcept(true) { bar(); } +// CHECK-LABEL: foo2 +// LINK-DYN: __imp___std_terminate +// LINK-STAT-NOT: __imp___std_terminate + +struct A {}; +struct B { virtual void f(); }; +struct C : A, virtual B {}; +struct T {}; +T *foo3() { return dynamic_cast((C *)0); } +// CHECK-LABEL: foo3 +// LINK-DYN: __imp___RTDynamicCast +// LINK-STAT-NOT: __imp___RTDynamicCast Index: Driver/ToolChains/Clang.cpp =================================================================== --- Driver/ToolChains/Clang.cpp +++ Driver/ToolChains/Clang.cpp @@ -5210,6 +5210,9 @@ TC.useIntegratedAs())) CmdArgs.push_back("-faddrsig"); + if (Args.hasArg(options::OPT_flto_visibility_public_std)) + CmdArgs.push_back("-flto-visibility-public-std"); + // Finally add the compile command to the compilation. if (Args.hasArg(options::OPT__SLASH_fallback) && Output.getType() == types::TY_Object && Index: clang/Driver/CC1Options.td =================================================================== --- clang/Driver/CC1Options.td +++ clang/Driver/CC1Options.td @@ -345,9 +345,6 @@ 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">; def flto_unit: Flag<["-"], "flto-unit">, HelpText<"Emit IR to support LTO unit features (CFI, whole program vtable opt)">; def fno_lto_unit: Flag<["-"], "fno-lto-unit">; Index: clang/Driver/Options.td =================================================================== --- clang/Driver/Options.td +++ clang/Driver/Options.td @@ -825,6 +825,9 @@ def fcreate_profile : Flag<["-"], "fcreate-profile">, Group; def fcxx_exceptions: Flag<["-"], "fcxx-exceptions">, Group, HelpText<"Enable C++ exceptions">, Flags<[CC1Option]>; +def flto_visibility_public_std: + Flag<["-"], "flto-visibility-public-std">, Group, Flags<[CC1Option]>, + HelpText<"Use public LTO visibility for classes in std and stdext namespaces">; def fcxx_modules : Flag <["-"], "fcxx-modules">, Group, Flags<[DriverOption]>; def fdebug_pass_arguments : Flag<["-"], "fdebug-pass-arguments">, Group;