[llvm-dev] PIC preferred too strongly, even at CodeModel::Large?

Joerg Sonnenberger via llvm-dev
Thu, 04 Aug 2016 16:36:27 -0000

On Thu, Jul 28, 2016 at 09:13:08PM -0400, Ramkumar Ramachandra via llvm-dev
wrote:
> We were just debugging a sporadic crash the other day, when we noticed
> that RIP-relative addressing was being used in a JumpTable, even when
> code and data were well over 4G apart. This is confusing, because we
> picked CodeModel::Large, and expected this to be taken care of. Isn't
> that what gcc would do given a Large CodeModel?

Just to avoid any confusion, your code is well within 4GB, but the
location of the jump table can be more than 4GB away? I'm asking as one
of the open issues for me in the PowerPC target is supporting
function-relative jump tables, so that the jump table needs only 32bit
entries as long as a single function is not longer than 4GB.

Joerg