On Fri, Apr 22, 2016 at 2:54 PM, H.J. Lu <hjl.to...@gmail.com> wrote: > For -fno-plt, we load the external function address via the GOT slot > so that linker won't create an PLT entry for extern function address. > > Tested on x86-64. I also built GCC with -fno-plt. It removes 99% PLT > entries. OK for trunk? > > H.J. > -- > gcc/ > > PR target/pr67400 > * config/i386/i386-protos.h (ix86_force_load_from_GOT_p): New. > * config/i386/i386.c (ix86_force_load_from_GOT_p): New function. > (ix86_legitimate_address_p): Allow UNSPEC_GOTPCREL for > ix86_force_load_from_GOT_p returns true. > (ix86_print_operand_address): Support UNSPEC_GOTPCREL if > ix86_force_load_from_GOT_p returns true. > (ix86_expand_move): Load the external function address via the > GOT slot if ix86_force_load_from_GOT_p returns true. > * config/i386/predicates.md (x86_64_immediate_operand): Return > false if ix86_force_load_from_GOT_p returns true. > > gcc/testsuite/ > > PR target/pr67400 > * gcc.target/i386/pr67400-1.c: New test. > * gcc.target/i386/pr67400-2.c: Likewise. > * gcc.target/i386/pr67400-3.c: Likewise. > * gcc.target/i386/pr67400-4.c: Likewise.
Please get someone that knows this linker magic to review the functionality first. Maybe Jakub can help? Uros.