From e4fee1116af225c63935a2216d9b27453fa3897c Mon Sep 17 00:00:00 2001 From: David Nadlinger Date: Sun, 6 Oct 2013 20:15:28 +0200 Subject: [PATCH] ARM: Use -arm-enable-ehabi(-descriptors). D exception handling does not work at all yet, but with these flags it does for C++/Clang, at least in simple cases. --- driver/targetmachine.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/driver/targetmachine.cpp b/driver/targetmachine.cpp index e6b46c1a..4be79b08 100644 --- a/driver/targetmachine.cpp +++ b/driver/targetmachine.cpp @@ -18,6 +18,7 @@ #include "llvm/ADT/Triple.h" #include "llvm/MC/SubtargetFeature.h" #include "llvm/Support/Host.h" +#include "llvm/Support/CommandLine.h" #include "llvm/Support/TargetRegistry.h" #include "llvm/Support/TargetSelect.h" #include "llvm/Target/TargetMachine.h" @@ -346,6 +347,19 @@ llvm::TargetMachine* createTargetMachine( } } + if (triple.getArch() == llvm::Triple::arm) + { + // On ARM, we want to use EHABI exception handling, as we don't support + // SJLJ EH in druntime. Unfortunately, it is still in a partly + // experimental state, and the -arm-enable-ehabi-descriptors command + // line option is not exposed via an internal API at all. + const char *backendArgs[3] = { + "ldc2", // Fake name, irrelevant. + "-arm-enable-ehabi", + "-arm-enable-ehabi-descriptors" + }; + llvm::cl::ParseCommandLineOptions(3, backendArgs); + } llvm::TargetOptions targetOptions; targetOptions.NoFramePointerElim = genDebugInfo;