Win64 exception handling

Some time ago the patch for Win64 exception handling was finally merged.
There are still serious bugs though and Twobit attached a preliminary patch to that review.

But nothing happened since then.

I tried to fix it according to rnk's comment "the individual .pdata sections should be comdat associative with the individual .text sections" but don't know enough about the respective llvm internals.

Could anybody finalize that patch and get this in?

I intend to take care of this. It’s been on my plate for some time, but not as high priority as 32-bit x86 ABI compatibility with MSVC.

I think this patch works, but it needs additional testing to be confident:

You also need to change this code in Clang to get unwind info emitted:

bool Windows::IsUnwindTablesDefault() const {
// FIXME: LLVM’s lowering of Win64 data is broken right now. MSVC’s linker
// says that our object files provide invalid .pdata contributions. Until
// that is fixed, don’t ask for unwind tables.
return false;
//return getArch() == llvm::Triple::x86_64;

I committed my patch, it seems to work OK when self-hosting clang for win64 and for building Chromium. I don’t actually know if the unwind info is 100% accurate, though, so please try it out and file bugs if the unwinder gets off track in LLVM code.