[PATCH] XCore target exception handling
robert lytton
robert at xmos.com
Mon Jan 20 03:51:31 PST 2014
split out handling of -fexceptions flag
refactor code to call addExceptionArgs()
Hi echristo, rafael.espindola,
http://llvm-reviews.chandlerc.com/D2570
CHANGE SINCE LAST DIFF
http://llvm-reviews.chandlerc.com/D2570?vs=6509&id=6539#toc
Files:
lib/Driver/Tools.cpp
test/Driver/xcore-opts.c
Index: lib/Driver/Tools.cpp
===================================================================
--- lib/Driver/Tools.cpp
+++ lib/Driver/Tools.cpp
@@ -1534,7 +1534,7 @@
}
// Exceptions are enabled by default.
- bool ExceptionsEnabled = true;
+ bool ExceptionsEnabled = (Triple.getArch() != llvm::Triple::xcore);
// This keeps track of whether exceptions were explicitly turned on or off.
bool DidHaveExplicitExceptionFlag = false;
@@ -7105,6 +7105,11 @@
assert(Output.isNothing() && "Invalid output.");
}
+ // The linker is only intereseted in the master flag (-fexceptions).
+ // Thus we use TY_INVALID, a bogus ObjCRuntime and KernelOrKext is false.
+ addExceptionArgs(Args, types::TY_INVALID, getToolChain().getTriple(),
+ false, ObjCRuntime(), CmdArgs);
+
AddLinkerInputs(getToolChain(), Inputs, Args, CmdArgs);
const char *Exec =
Index: test/Driver/xcore-opts.c
===================================================================
--- test/Driver/xcore-opts.c
+++ test/Driver/xcore-opts.c
@@ -1,13 +1,28 @@
// RUN: %clang -target xcore %s -g -Wl,L1Arg,L2Arg -Wa,A1Arg,A2Arg -fverbose-asm -### -o %t.o 2>&1 | FileCheck %s
+// RUN: %clang -target xcore -x c++ %s -g -Wl,L1Arg,L2Arg -Wa,A1Arg,A2Arg -fverbose-asm -### -o %t.o 2>&1 | FileCheck %s
+// RUN: %clang -target xcore -x c++ %s -fexceptions -### -o %t.o 2>&1 | FileCheck -check-prefix CHECK-EXCEP %s
// CHECK: "-nostdsysteminc"
// CHECK: "-momit-leaf-frame-pointer"
// CHECK-NOT: "-mdisable-fp-elim"
// CHECK: "-fno-signed-char"
// CHECK: "-fno-use-cxa-atexit"
+// CHECK-NOT: "-fcxx-exceptions"
+// CHECK-NOT: "-fexceptions"
// CHECK: "-fno-common"
// CHECH: xcc" "-o"
+// CHECK-EXCEP-NOT: "-fexceptions"
// CHECK: "-c" "-g" "-fverbose-asm" "A1Arg" "A2Arg"
// CHECK: xcc" "-o"
+// CHECK-EXCEP-NOT: "-fexceptions"
// CHECK: "L1Arg" "L2Arg"
+// CHECK-EXCEP: "-fno-use-cxa-atexit"
+// CHECK-EXCEP: "-fcxx-exceptions"
+// CHECK-EXCEP: "-fexceptions"
+// CHECK-EXCEP: "-fno-common"
+// CHECH-EXCEP: xcc" "-o"
+// CHECK-EXCEP-NOT: "-fexceptions"
+// CHECK-EXCEP: xcc" "-o"
+// CHECK-EXCEP: "-fexceptions"
+
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D2570.2.patch
Type: text/x-patch
Size: 2131 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20140120/a80360b7/attachment.bin>
More information about the cfe-commits
mailing list