This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug target/70146] missed-optimization: i386 hidden references should use PC32 relocations instead of GOTOFF


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

--- Comment #1 from H.J. Lu <hjl.tools at gmail dot com> ---
We do it for MacOS:

#if TARGET_MACHO
      /* Output the Mach-O "canonical" pic base label name ("Lxx$pb") here.
         This is what will be referenced by the Mach-O PIC subsystem.  */
      if (machopic_should_output_picbase_label () || !label)
        ASM_OUTPUT_LABEL (asm_out_file, MACHOPIC_FUNCTION_BASE_NAME);

      /* When we are restoring the pic base at the site of a nonlocal label,
         and we decided to emit the pic base above, we will still output a
         local label used for calculating the correction offset (even though
         the offset will be 0 in that case).  */
      if (label)
        targetm.asm_out.internal_label (asm_out_file, "L",
                                           CODE_LABEL_NUMBER (label));
#endif

        .text
        .align 4,0x90
        .globl _get_foo
_get_foo:
LFB0:
        call    ___x86.get_pc_thunk.ax
L1$pb:
        movl    L_foo$non_lazy_ptr-L1$pb(%eax), %eax
        ret
LFE0:
        .section __TEXT,__textcoal_nt,coalesced,pure_instructions

We should do something similar for Linux.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]