gcc

~vcs-imports/gcc/+git/gcc:hjl/got/master

Last commit made on 2015-10-20
Get this branch:
git clone -b hjl/got/master https://git.launchpad.net/~vcs-imports/gcc/+git/gcc

Branch merges

Branch information

Name:
hjl/got/master
Repository:
lp:~vcs-imports/gcc/+git/gcc

Recent commits

a013bbe... by "H.J. Lu" <email address hidden>

Put local/global relocs in rw section for -freloc-rw

Add an option, -freloc-rw, to put local and global relocations in a
read-write section.

gcc/

 PR target/67400
 * common.opt (freloc-rw): New option.
 * targhooks.c (default_reloc_rw_mask): Return 3 for -freloc-rw.

gcc/testsuite/

 PR target/67400
 * gcc.target/i386/pr67400-5.c: New test.
 * gcc.target/i386/pr67400-6.c: Likewise.

2189fda... by "H.J. Lu" <email address hidden>

Load specific external function addresses via GOT slot

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.

ccbe5ec... by "H.J. Lu" <email address hidden>

Compare address of external function via its GOT slot

Load address of external function from its GOT slot for -fno-plt -fno-pic
if assembler and linker support R_386_GOT32X and R_X86_64_GOTPCRELX to
avoid the PLT slot. R_386_GOT32X and R_X86_64_GOTPCRELX instruct linker
to re-encode the instruction to convert loading function address from its
GOT slot to immediate if the function is defined locally.

gcc/

 PR target/67400
 * config/i386/i386.md (*cmp<mode>_1): Replace
 nonimmediate_operand with ix86_cmp_destination_operand.
 * config/i386/predicates.md (got_slot_operand): New.
 (ix86_cmp_destination_operand): Likewise.
 (x86_64_immediate_operand): Return false if got_slot_operand
 returns true.
 (x86_64_general_operand): Likewise.

gcc/testsuite/

 PR target/67400
 * gcc.target/i386/pr67400-7.c: New test.

e5c4887... by "H.J. Lu" <email address hidden>

Generate R_386_GOT32x relocation for -fno-plt -fno-pic

This patch extends -fno-plt to non-PIC on x86. -fno-plt works in 64-bit
mode with the existing binutils. For 32-bit, we need the updated
assembler and linker to support "call/jmp *foo@GOT", which accesses the
GOT slot without a base register, with a new R_386_GOT32x relocation.

gcc/

 * config/i386/i386.c (ix86_nopic_noplt_attribute_p): Check
 HAVE_LD_R_386_GOT32X == 0 before returning false.
 (ix86_output_call_insn): Generate "%!jmp/call\t*%p0@GOT" for
 32-bit.

gcc/testsuite/

 * gcc.target/i386/pr66232-10.c: New file.
 * gcc.target/i386/pr66232-11.c: Likewise.
 * gcc.target/i386/pr66232-12.c: Likewise.
 * gcc.target/i386/pr66232-13.c: Likewise.
 * lib/target-supports.exp (check_effective_target_r_386_got32x):
 New.
 (check_effective_target_r_x86_64_gotpcrelx): Likewise.

5f37065... by "H.J. Lu" <email address hidden>

Check if x86 binutils supports R_386_GOT32X/R_X86_64_GOTPCRELX

Define HAVE_LD_R_386_GOT32X to 1 if 32-bit x86 assembler generates
R_386_GOT32X for "jmp *foo@GOT". Define HAVE_LD_R_X86_64_GOTPCRELX
to 1 if 64-bit x86 assembler generates R_X86_64_GOTPCRELX for
"jmp *foo@GOTPCREL(%rip)".

 * configure.ac (HAVE_LD_R_386_GOT32X): New. Defined to 1
 if 32-bit assembler generates R_386_GOT32X for "jmp *foo@GOT".
 Otherise, defined to 0.
 (HAVE_LD_R_X86_64_GOTPCRELX): New. Defined to 1 if 64-bit
 x86 assembler generates R_X86_64_GOTPCRELX for
 "jmp *foo@GOTPCREL(%rip)".
 * config.in: Regenerated.
 * configure: Likewise.

65bbdf8... by "H.J. Lu" <email address hidden>

Properly handle -fno-plt in ix86_expand_call

prepare_call_address in calls.c is the wrong place to handle -fno-plt.
We shoudn't force function address into register and hope that load
function address via GOT and indirect call via register will be folded
into indirect call via GOT, which doesn't always happen. Also non-PIC
case can only be handled in backend. Instead, backend should expand
external function call into indirect call via GOT for -fno-plt.

This patch reverts -fno-plt in prepare_call_address and handles it in
ix86_expand_call. Other backends may need similar changes to support
-fno-plt. Alternately, we can introduce a target hook to indicate
whether an external function should be called via register for -fno-plt
so that i386 backend can disable it in prepare_call_address.

gcc/

 PR target/67215
 * calls.c (prepare_call_address): Don't handle -fno-plt here.
 * config/i386/i386.c (ix86_expand_call): Generate indirect call
 via GOT for -fno-plt. Support indirect call via GOT for x32.
 * config/i386/predicates.md (sibcall_memory_operand): Allow
 GOT memory operand.

gcc/testsuite/

 PR target/67215
 * gcc.target/i386/pr67215-1.c: New test.
 * gcc.target/i386/pr67215-2.c: Likewise.
 * gcc.target/i386/pr67215-3.c: Likewise.

6b5e0fa... by ian <ian@138bc75d-0d04-0410-961f-82ee72b054a4>

    compiler: Report errors for non-integral shift counts.

    Fixes golang/go#12618.

    Reviewed-on: https://go-review.googlesource.com/14647

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@229096 138bc75d-0d04-0410-961f-82ee72b054a4

885c11f... by nsz <nsz@138bc75d-0d04-0410-961f-82ee72b054a4>

musl support for sh

 * config/sh/linux.h (MUSL_DYNAMIC_LINKER): Define.
 (MUSL_DYNAMIC_LINKER_E, MUSL_DYNAMIC_LINKER_FP): Define.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@229095 138bc75d-0d04-0410-961f-82ee72b054a4

9202af5... by ktkachov <ktkachov@138bc75d-0d04-0410-961f-82ee72b054a4>

[AArch64] Add support for 64-bit vector-mode ldp/stp

 * config/aarch64/aarch64.c (aarch64_mode_valid_for_sched_fusion_p):
 New function.
 (fusion_load_store): Use it.
 * config/aarch64/aarch64-ldpstp.md: Add new peephole2s for
 ldp and stp in VD modes.
 * config/aarch64/aarch64-simd.md (load_pair<mode>, VD): New pattern.
 (store_pair<mode>, VD): Likewise.

 * gcc.target/aarch64/stp_vec_64_1.c: New test.
 * gcc.target/aarch64/ldp_vec_64_1.c: Likewise.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@229094 138bc75d-0d04-0410-961f-82ee72b054a4

e11b149... by alalaw01 <alalaw01@138bc75d-0d04-0410-961f-82ee72b054a4>

[Testsuite] Turn on 64-bit-vector tests for AArch64.

 * lib/target-supports.exp (check_effective_target_vect64): Add AArch64.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@229092 138bc75d-0d04-0410-961f-82ee72b054a4