From: Alan Modra Date: Tue, 17 Jan 2017 02:54:11 +0000 (+1030) Subject: PR79066, non-PIC code generated for powerpc glibc with -fpic X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=e6750e5ce04bf778fc9bb0d07143b72cc6dc2c79;p=gcc.git PR79066, non-PIC code generated for powerpc glibc with -fpic PR target/79066 * config/rs6000/rs6000.md (elf_high, elf_low): Disable when pic. * config/rs6000/rs6000.c (rs6000_emit_allocate_stack): Don't allow symbolic stack limit when pic. testsuite/ * gcc.target/powerpc/pr79066.c: New. From-SVN: r244515 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index ead236ff5fb..073b53ee843 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,10 @@ +2017-01-17 Alan Modra + + PR target/79066 + * config/rs6000/rs6000.md (elf_high, elf_low): Disable when pic. + * config/rs6000/rs6000.c (rs6000_emit_allocate_stack): Don't allow + symbolic stack limit when pic. + 2017-01-16 Martin Sebor PR tree-optimization/78608 diff --git a/gcc/config/rs6000/rs6000.c b/gcc/config/rs6000/rs6000.c index 29b3fd65624..37ad7d04c2f 100644 --- a/gcc/config/rs6000/rs6000.c +++ b/gcc/config/rs6000/rs6000.c @@ -27669,7 +27669,8 @@ rs6000_emit_allocate_stack (HOST_WIDE_INT size, rtx copy_reg, int copy_off) } else if (GET_CODE (stack_limit_rtx) == SYMBOL_REF && TARGET_32BIT - && DEFAULT_ABI == ABI_V4) + && DEFAULT_ABI == ABI_V4 + && !flag_pic) { rtx toload = gen_rtx_CONST (VOIDmode, gen_rtx_PLUS (Pmode, diff --git a/gcc/config/rs6000/rs6000.md b/gcc/config/rs6000/rs6000.md index b3334749860..f00334a1d09 100644 --- a/gcc/config/rs6000/rs6000.md +++ b/gcc/config/rs6000/rs6000.md @@ -10581,14 +10581,14 @@ (define_insn "elf_high" [(set (match_operand:SI 0 "gpc_reg_operand" "=b*r") (high:SI (match_operand 1 "" "")))] - "TARGET_ELF && ! TARGET_64BIT" + "TARGET_ELF && !TARGET_64BIT && !flag_pic" "lis %0,%1@ha") (define_insn "elf_low" [(set (match_operand:SI 0 "gpc_reg_operand" "=r") (lo_sum:SI (match_operand:SI 1 "gpc_reg_operand" "b") (match_operand 2 "" "")))] - "TARGET_ELF && ! TARGET_64BIT" + "TARGET_ELF && !TARGET_64BIT && !flag_pic" "la %0,%2@l(%1)") ;; Call and call_value insns diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 09c5d52aa4b..c00a050732b 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2017-01-17 Alan Modra + + * gcc.target/powerpc/pr79066.c: New. + 2017-01-16 Jeff Law PR tree-optimization/33562 diff --git a/gcc/testsuite/gcc.target/powerpc/pr79066.c b/gcc/testsuite/gcc.target/powerpc/pr79066.c new file mode 100644 index 00000000000..86b20149bdf --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/pr79066.c @@ -0,0 +1,14 @@ +/* { dg-do compile { target { fpic && ilp32 } } } */ +/* { dg-options "-O2 -fpic" } */ +/* { dg-final { scan-assembler-not "lis.*@ha" } } */ + +union U { double x; int i[2]; }; + +double +foo (double x) +{ + union U v; + v.i[0] = 0x7ff00000; + v.i[1] = 0; + return x / v.x; +}