[PATCH] D39673: Toolchain: Normalize dwarf, sjlj and seh eh

Martin Storsjö via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Nov 20 00:10:02 PST 2017


mstorsjo added inline comments.


================
Comment at: lib/Frontend/InitPreprocessor.cpp:684
+    else if (TI.getTriple().isThumb() || TI.getTriple().isARM())
+      Builder.defineMacro("__ARM_DWARF_EH__");
+  }
----------------
martell wrote:
> mstorsjo wrote:
> > Won't this start setting this define also on platforms where ARM EHABI is the default? (I.e. all ELF platforms except netbsd)?
> It will set it on any arm / thumb platform where exceptions are enabled and the current model is dwarf.
> This includes netbsd. The issue we have is that apple set this unconditionally for their watch platform.
> 
> I'm wondering if we should put this behind a `!apple` guard or just add an `if windows or netbsd` guard.
> 
> Or is it okay to just generally have this macro on all platforms where dwarf is exception model and the target is arm?
> 
No, it will set it on any arm/thumb platform where one hasn't indicated preference for any other model. And there are more models than just dwarf/seh/sjlj - there's also the ARM EHABI model. (According to MC/MCTargetOptions.h in llvm, there aren't any more than this currently though.)

Prior to this patch, `clang -x c++ -target armv7-linux-gnueabihf -E -dM - < /dev/null` will not include `__ARM_DWARF_EH__` - while it will after this patch. This will certainly break libunwind for linux on arm. (And prior to this patch, `clang -x c -target armv7-netbsd -E -dM - < /dev/null` did include it, but now it's only included when exceptions are enabled - I think the old behaviour is preferrable wrt that as well.)

So, similarly how we on x86_64 have a default that enables SEH unless something else has been specified, we need to prefer ARM EHABI on everything on ELF except netbsd. I guess you could fold in the apple defaults into that as well?


Repository:
  rL LLVM

https://reviews.llvm.org/D39673





More information about the cfe-commits mailing list