r311397 - [Driver][Darwin] Do not pass -munwind-table if -fno-excpetions is

Akira Hatanaka via cfe-commits cfe-commits at lists.llvm.org
Tue Aug 22 12:02:31 PDT 2017


Hans, can this be merged to 5.0 too? This is a follow-up to r310006.

Thanks.

> On Aug 21, 2017, at 3:46 PM, Akira Hatanaka via cfe-commits <cfe-commits at lists.llvm.org> wrote:
> 
> Author: ahatanak
> Date: Mon Aug 21 15:46:46 2017
> New Revision: 311397
> 
> URL: http://llvm.org/viewvc/llvm-project?rev=311397&view=rev
> Log:
> [Driver][Darwin] Do not pass -munwind-table if -fno-excpetions is
> supplied.
> 
> With this change, -fno-exceptions disables unwind tables unless
> -funwind-tables is supplied too or the target is x86-64 (x86-64 requires
> emitting unwind tables).
> 
> rdar://problem/33934446
> 
> Modified:
>    cfe/trunk/lib/Driver/ToolChains/Darwin.cpp
>    cfe/trunk/test/Driver/clang-translation.c
> 
> Modified: cfe/trunk/lib/Driver/ToolChains/Darwin.cpp
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains/Darwin.cpp?rev=311397&r1=311396&r2=311397&view=diff
> ==============================================================================
> --- cfe/trunk/lib/Driver/ToolChains/Darwin.cpp (original)
> +++ cfe/trunk/lib/Driver/ToolChains/Darwin.cpp Mon Aug 21 15:46:46 2017
> @@ -1845,7 +1845,12 @@ Darwin::TranslateArgs(const DerivedArgLi
> }
> 
> bool MachO::IsUnwindTablesDefault(const ArgList &Args) const {
> -  return !UseSjLjExceptions(Args);
> +  // Unwind tables are not emitted if -fno-exceptions is supplied (except when
> +  // targeting x86_64).
> +  return getArch() == llvm::Triple::x86_64 ||
> +         (!UseSjLjExceptions(Args) &&
> +          Args.hasFlag(options::OPT_fexceptions, options::OPT_fno_exceptions,
> +                       true));
> }
> 
> bool MachO::UseDwarfDebugFlags() const {
> 
> Modified: cfe/trunk/test/Driver/clang-translation.c
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/clang-translation.c?rev=311397&r1=311396&r2=311397&view=diff
> ==============================================================================
> --- cfe/trunk/test/Driver/clang-translation.c (original)
> +++ cfe/trunk/test/Driver/clang-translation.c Mon Aug 21 15:46:46 2017
> @@ -73,6 +73,10 @@
> // RUN: FileCheck -check-prefix=ARM64-APPLE %s
> // ARM64-APPLE: -munwind-table
> 
> +// RUN: %clang -target arm64-apple-ios10 -fno-exceptions -### -S %s -arch arm64 2>&1 | \
> +// RUN: FileCheck -check-prefix=ARM64-APPLE-EXCEP %s
> +// ARM64-APPLE-EXCEP-NOT: -munwind-table
> +
> // RUN: %clang -target armv7k-apple-watchos4.0 -### -S %s -arch armv7k 2>&1 | \
> // RUN: FileCheck -check-prefix=ARMV7K-APPLE %s
> // ARMV7K-APPLE: -munwind-table
> 
> 
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits



More information about the cfe-commits mailing list