https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63833
Bug ID: 63833
Summary: REAL_PIC_OFFSET_TABLE_REGNUM is wrong for x86-64
Product: gcc
Version: 5.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: target
Assignee: unassigned at gcc dot gnu.org
Reporter: hjl.tools at gmail dot com
CC: ubizjak at gmail dot com
Target: x86_64-linux
x86-64 psABI uses %r15 to hold the GOT base pointer in large model.
The first entry in the large model PLT is
PLT0: pushq 8(%r15) # GOT[1]
jmpq *16(%r15) # GOT[2]
However, there is a typo in Register Usage table in x86-64 psABI:
%rbx callee-saved register; optionally used as base pointer
Using %rbx for GOT will crash the large model PLT. It should be
%rbx callee-saved register
...
%r15 callee-saved register; optionally used as GOT base pointer
I proposed a change to Register Usage table in x86-64 psABI:
https://gcc.gnu.org/ml/gcc/2014-11/msg00161.html