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

Martell Malone via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Nov 28 21:53:57 PST 2017


martell added inline comments.


================
Comment at: lib/Driver/ToolChain.cpp:458
+    if (Triple.getArch() == llvm::Triple::x86)
+      return llvm::ExceptionHandling::DwarfCFI;
+    else
----------------
mstorsjo wrote:
> I'd suggest braces around the outer if statement.
> 
> But is there any point to this default fallback here at all? Dwarf isn't right for x86 for MSVC, and we set the right defaults for all the MinGW cases in that driver in any case. So isn't it enough to just return None always here, or possibly WinEH for all windows cases?
Won't need braces with the change I am about to make.

The previous check was `getArch() == llvm::Triple::x86_64` then use seh.
This didn't take into account arm or aarch64 so I flipped this.

I read the wrong llvm class for  `llvm::Triple::x86` `X86MCAsmInfoGNUCOFF`
It should have been `X86MCAsmInfoMicrosoft` I looked at.
```
  if (Triple.getArch() == Triple::x86_64) {
    PrivateGlobalPrefix = ".L";
    PrivateLabelPrefix = ".L";
    CodePointerSize = 8;
    WinEHEncodingType = WinEH::EncodingType::Itanium;
  } else {
    // 32-bit X86 doesn't use CFI, so this isn't a real encoding type. It's just
    // a place holder that the Windows EHStreamer looks for to suppress CFI
    // output. In particular, usesWindowsCFI() returns false.
    WinEHEncodingType = WinEH::EncodingType::X86;
  }

  ExceptionsType = ExceptionHandling::WinEH;
```
I think None in the case of x86 is the behavior that was present previously so I am going to revert from dwarf to none.

https://www.google.com/patents/US5628016
That borland patent has long since expired now and seh is the default in llvm for x86 so we can do seh on x86 for clang but I will leave that to a different patch.


Repository:
  rL LLVM

https://reviews.llvm.org/D39673





More information about the cfe-commits mailing list