Problem one is that .seh_endproc needs to occur in the same section as .seh_proc, and the .rdata switch breaks that.
Problem two is that in today's PIC model, this jump table is unnecessarily in the .text section. MSVC also does this, FWIW, but we can definitely put this jump table in a separate COMDAT-associative .rdata section.
We definitely don't want the .quad codegen, since that will produce runtime relocations and waste space. This leaves two choices: image relative relocations, or '.LBBN_M - .Lfunc_beginN', which can be fixed up by the assembler. MSVC uses image relative relocations, which I suppose are nice if you have some kind of post-link tool, but the fixups seem nicer from an object size perspective.
Extended Description
r290569 switched Win64 from the PIC to static relocation model. This uncovered some questionable jump table codegen for COFF objects.
The following LLVM IR switch generates a jump table:
Compiling twice with llc -relocation-model pic and -relocation-model static produces these differing assemblies:
Problem one is that .seh_endproc needs to occur in the same section as .seh_proc, and the .rdata switch breaks that.
Problem two is that in today's PIC model, this jump table is unnecessarily in the .text section. MSVC also does this, FWIW, but we can definitely put this jump table in a separate COMDAT-associative .rdata section.
We definitely don't want the .quad codegen, since that will produce runtime relocations and waste space. This leaves two choices: image relative relocations, or '.LBBN_M - .Lfunc_beginN', which can be fixed up by the assembler. MSVC uses image relative relocations, which I suppose are nice if you have some kind of post-link tool, but the fixups seem nicer from an object size perspective.