aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorUros Bizjak <uros@gcc.gnu.org>2009-01-28 08:58:07 +0100
committerUros Bizjak <uros@gcc.gnu.org>2009-01-28 08:58:07 +0100
commitbef3c57babac2e7ff368cb226a962644575c22e0 (patch)
tree22d772700f3757151c7b5371beb5830a588089c2 /gcc
parent0c6390fae9478618548c4d4c64483b85ae9f28ac (diff)
downloadgcc-bef3c57babac2e7ff368cb226a962644575c22e0.zip
gcc-bef3c57babac2e7ff368cb226a962644575c22e0.tar.gz
gcc-bef3c57babac2e7ff368cb226a962644575c22e0.tar.bz2
re PR target/38988 (Cannot build crtstuff.c with -mcmodel=large -fPIC -O2)
PR target/38988 * config/i386/i386.md (set_rip_rex64): Wrap operand 1 in label_ref. (set_got_offset_rex64): Ditto. From-SVN: r143720
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog9
-rw-r--r--gcc/config/i386/i386.md6
-rw-r--r--gcc/testsuite/gcc.target/i386/pr38988.c24
3 files changed, 36 insertions, 3 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index ad51b27..5300a86 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,9 @@
+2009-01-28 Uros Bizjak <ubizjak@gmail.com>
+
+ PR target/38988
+ * config/i386/i386.md (set_rip_rex64): Wrap operand 1 in label_ref.
+ (set_got_offset_rex64): Ditto.
+
2009-01-27 H.J. Lu <hongjiu.lu@intel.com>
PR target/38941
@@ -511,7 +517,8 @@
used to index the memory access. Do not pass loop_p.
Fix comment. Stop recursion on tcc_constant or tcc_declaration.
(expand_scalar_variables_stmt): Pass to expand_scalar_variables_expr
- the gimple_stmt_iterator where it inserts new code. Do not pass loop_p.
+ the gimple_stmt_iterator where it inserts new code.
+ Do not pass loop_p.
(copy_bb_and_scalar_dependences): Do not pass loop_p.
(translate_clast): Update call to copy_bb_and_scalar_dependences.
diff --git a/gcc/config/i386/i386.md b/gcc/config/i386/i386.md
index 6543cf5..89a3b17 100644
--- a/gcc/config/i386/i386.md
+++ b/gcc/config/i386/i386.md
@@ -15299,7 +15299,7 @@
(define_insn "set_rip_rex64"
[(set (match_operand:DI 0 "register_operand" "=r")
- (unspec:DI [(match_operand:DI 1 "" "")] UNSPEC_SET_RIP))]
+ (unspec:DI [(label_ref (match_operand 1 "" ""))] UNSPEC_SET_RIP))]
"TARGET_64BIT"
"lea{q}\t{%l1(%%rip), %0|%0, %l1[rip]}"
[(set_attr "type" "lea")
@@ -15307,7 +15307,9 @@
(define_insn "set_got_offset_rex64"
[(set (match_operand:DI 0 "register_operand" "=r")
- (unspec:DI [(match_operand:DI 1 "" "")] UNSPEC_SET_GOT_OFFSET))]
+ (unspec:DI
+ [(label_ref (match_operand 1 "" ""))]
+ UNSPEC_SET_GOT_OFFSET))]
"TARGET_64BIT"
"movabs{q}\t{$_GLOBAL_OFFSET_TABLE_-%l1, %0|%0, OFFSET FLAT:_GLOBAL_OFFSET_TABLE_-%l1}"
[(set_attr "type" "imov")
diff --git a/gcc/testsuite/gcc.target/i386/pr38988.c b/gcc/testsuite/gcc.target/i386/pr38988.c
new file mode 100644
index 0000000..8e2c8ea
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr38988.c
@@ -0,0 +1,24 @@
+/* { dg-do compile } */
+/* { dg-require-effective-target lp64 } */
+/* { dg-require-effective-target fpic } */
+/* { dg-options "-O2 -fpic -mcmodel=large" } */
+
+typedef long unsigned int size_t;
+typedef void (*func_ptr) (void);
+
+static func_ptr __DTOR_LIST__[1] = { (func_ptr) (-1) };
+
+void
+__do_global_dtors_aux (void)
+{
+ extern func_ptr __DTOR_END__[];
+ size_t dtor_idx = 0;
+ const size_t max_idx = __DTOR_END__ - __DTOR_LIST__ - 1;
+ func_ptr f;
+
+ while (dtor_idx < max_idx)
+ {
+ f = __DTOR_LIST__[++dtor_idx];
+ f ();
+ }
+}