https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98063

            Bug ID: 98063
           Summary: Emit R_X86_64_GOTOFF64 instead of R_X86_64_GOTPCRELX
                    for -mcmodel=large -fno-plt
           Product: gcc
           Version: 11.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
          Assignee: unassigned at gcc dot gnu.org
          Reporter: i at maskray dot me
  Target Milestone: ---

% cat a.c
#include <stdio.h>

int main() {
  puts("meow");
}

% gcc -mcmodel=large -fno-plt -O1 -S a.c -fpic -o - -O2
-fno-asynchronous-unwind-tables
...
main:
.L2:
        movabsq $_GLOBAL_OFFSET_TABLE_-.L2, %r11
        subq    $8, %rsp
        leaq    .L2(%rip), %rax
        movabsq $.LC0@GOTOFF, %rdx
        addq    %r11, %rax
        leaq    (%rax,%rdx), %rdi
        call    *puts@GOTPCREL(%rip)
        xorl    %eax, %eax
        addq    $8, %rsp
        ret

The distance between the GOT entry and the next instruction of call may be
larger than 32-bit. An R_X86_64_GOTPCRELX relocation cannot be used.

Reply via email to