<div dir="ltr">On Thu, Jul 28, 2016 at 6:13 PM, Ramkumar Ramachandra via llvm-dev <span dir="ltr"><<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a>></span> wrote:<br><div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Hi,<br>
<br>
We were just debugging a sporadic crash the other day, when we noticed<br>
that RIP-relative addressing was being used in a JumpTable, even when<br>
code and data were well over 4G apart. This is confusing, because we<br>
picked CodeModel::Large, and expected this to be taken care of. Isn't<br>
that what gcc would do given a Large CodeModel?<br></blockquote><div><br></div><div>This sounds like a bug, but I can't reproduce it.  Testcase?<br></div><div> <br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
The default Relocation Model, Reloc::Default, folds into Reloc::PIC_<br>
in most cases. However, if we explicitly specify Reloc::Static, our<br>
program should work on all platforms except Darwin:<br>
<br>
  // If we are on Darwin, disallow static relocation model in X86-64 mode, since<br>
  // the Mach-O file format doesn't support it.<br>
  if (RM == Reloc::Static && TT.isOSDarwin() && is64Bit)<br>
    RM = Reloc::PIC_;<br>
<br>
(from X86MCTargetDesc.cpp)<br>
<br>
First, is the Mach-O limitation still there?</blockquote><div><br>Yes, the Mach-O limitation still exists as far as I know.<br><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Second, is it okay to<br>
silently fold into Reloc::PIC_ in this case and leave the user with<br>
sporadic crashes?</blockquote><div><br>Large code model and PIC should be compatible.<br><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"> Finally, can we bypass this limitation by simply<br>
appending "-elf" to our Target Triple, forcing ELF generation on all<br>
three platforms?<br></blockquote><div><br></div>What exactly are you planning to do with an ELF object file on OS X?<br></div><br></div><div class="gmail_extra">-Eli<br></div></div>