diff options
author | H.J. Lu <hjl.tools@gmail.com> | 2015-08-28 19:14:49 -0700 |
---|---|---|
committer | H.J. Lu <hjl.tools@gmail.com> | 2015-10-27 07:56:45 -0700 |
commit | c376fd4175a34c3212ad18a21604a89970938d14 (patch) | |
tree | 84ad2663170aacb58297355d7c1faab806e36a36 /gcc/testsuite/gcc.target/i386/avx-vpermilpd-2.c | |
parent | 543d5cb877862a149069011befd5b07fb0d253e7 (diff) | |
download | gcc-c376fd4175a34c3212ad18a21604a89970938d14.tar.gz |
Load specific external function addresses via GOT slothjl/pic/master
Drawbacks with -fno-plt and noplt attribute are
1. -fno-plt may force locally defined functions to be called via their
GOT slots through indirect branch, instead of direct branch.
2. noplt attribute doesn't work on libcalls of builtin functions.
3. noplt attribute requires modifying source codes which may not be
desirable for third party source packages.
Add -fno-plt=file and -fno-plt=[symbol,...] options to specify which
external function addresses should be loaded from the GOT slot to avoid
PLT. We don't set REG_EQUAL note with external function symbols whose
address are loaded from GOT slots so that load from the GOT slot won't
be optimized out by a register load.
gcc/
PR target/67400
* Makefile.in (OBJS): Add noplt-symbols.o.
* common.opt (fno-plt=): New option.
* explow.c (force_reg): Don't set REG_EQUAL if
targetm.cannot_set_reg_equal_const returns true.
* expr.c (emit_move_insn): Likewise.
* noplt-symbols.c: New file.
* noplt-symbols.h: Likewise.
* target.def (cannot_set_reg_equal_const): New target hook.
* toplev.c: Include "noplt-symbols.h".
(process_options): Call noplt_symbols_initialize.
(toplev::main): Call noplt_symbols_finish.
* config/i386/i386-protos.h (ix86_noplt_operand): New.
(ix86_noplt_addr_symbol_rtx): Likewise.
* config/i386/i386.c: Include "noplt-symbols.h".
(ix86_noplt_rtx_p): New function.
(ix86_noplt_operand): Likewise.
(ix86_noplt_addr_symbol_rtx): Likewise.
(ix86_cannot_set_reg_equal_const): Likewise.
(ix86_function_ok_for_sibcall): Replace flag_plt with
!noplt_decl_p.
(ix86_legitimate_address_p): Allow UNSPEC_GOT and UNSPEC_GOTPCREL
if ix86_noplt_addr_symbol_rtx doesn't return NULL.
(ix86_print_operand_address): Support UNSPEC_GOT and
UNSPEC_GOTPCREL if ix86_noplt_addr_symbol_rtx doesn't return
NULL.
(ix86_expand_move): Load the external function address via the
GOT slot if ix86_noplt_operand returns true.
(ix86_expand_call): Replace flag_plt and noplt attribute check
with !ix86_noplt_rtx_p.
(ix86_nopic_noplt_attribute_p): Call ix86_noplt_rtx_p.
(TARGET_CANNOT_SET_REG_EQUAL_CONST): New.
* config/i386/i386.h (SYMBOL_FLAG_PLT): New.
(SYMBOL_REF_PLT_P): Likewise.
(SYMBOL_FLAG_NOPLT): Likewise.
(SYMBOL_REF_NOPLT_P): Likewise.
* doc/tm.texi.in (TARGET_CANNOT_SET_REG_EQUAL_CONST): New hook.
* doc/tm.texi: Updated.
gcc/testsuite/
PR target/67400
* gcc.target/i386/noplt-5.c: New test.
* gcc.target/i386/noplt-6.c: Likweise.
* gcc.target/i386/noplt-7.c: Likweise.
* gcc.target/i386/noplt-8.c: Likweise.
* gcc.target/i386/noplt-9.c: Likweise.
* gcc.target/i386/noplt-10.c: Likweise.
* gcc.target/i386/noplt-11.c: Likweise.
* gcc.target/i386/noplt-12.c: Likweise.
* gcc.target/i386/noplt-13.c: Likweise.
* gcc.target/i386/noplt-14.c: Likweise.
* gcc.target/i386/noplt-15.c: Likweise.
* gcc.target/i386/noplt-16.c: Likweise.
* gcc.target/i386/noplt-17.c: Likweise.
* gcc.target/i386/noplt-18.c: Likweise.
* gcc.target/i386/pr67400-1.c: Likweise.
* gcc.target/i386/pr67400-2.c: Likewise.
* gcc.target/i386/pr67400-3.c: Likewise.
* gcc.target/i386/pr67400-4.c: Likewise.
Diffstat (limited to 'gcc/testsuite/gcc.target/i386/avx-vpermilpd-2.c')
0 files changed, 0 insertions, 0 deletions