diff options
author | Kai Tietz <ktietz@redhat.com> | 2012-01-23 20:55:35 +0100 |
---|---|---|
committer | Kai Tietz <ktietz@gcc.gnu.org> | 2012-01-23 20:55:35 +0100 |
commit | 986ce92f7dcac606cfcca7dd6df046d517ced9ba (patch) | |
tree | cec9b202b1fa45f9d2268d51754db993c9a87235 /gcc | |
parent | 135b6fa4d23fc35b68055a8f1717a0fbf4b7a86c (diff) | |
download | gcc-986ce92f7dcac606cfcca7dd6df046d517ced9ba.zip gcc-986ce92f7dcac606cfcca7dd6df046d517ced9ba.tar.gz gcc-986ce92f7dcac606cfcca7dd6df046d517ced9ba.tar.bz2 |
re PR target/51900 (const variable initialization always zero)
PR target/51900
* config/i386/predicates.md (symbolic_operand): Allow
UNSPEC_PCREL as PIC expression for lea.
* config/i386/winnt.c (i386_pe_binds_local_p): Reworked.
* config/i386/i386.c (ix86_delegitimize_address): Handle
UNSPEC_PCREL for none-MEM, too.
From-SVN: r183450
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ChangeLog | 9 | ||||
-rw-r--r-- | gcc/config/i386/i386.c | 4 | ||||
-rw-r--r-- | gcc/config/i386/predicates.md | 1 | ||||
-rw-r--r-- | gcc/config/i386/winnt.c | 17 |
4 files changed, 21 insertions, 10 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index c86d926..82b574a 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,12 @@ +2012-01-23 Kai Tietz <ktietz@redhat.com> + + PR target/51900 + * config/i386/predicates.md (symbolic_operand): Allow + UNSPEC_PCREL as PIC expression for lea. + * config/i386/winnt.c (i386_pe_binds_local_p): Reworked. + * config/i386/i386.c (ix86_delegitimize_address): Handle + UNSPEC_PCREL for none-MEM, too. + 2012-01-23 Aldy Hernandez <aldyh@redhat.com> * trans-mem.c (ipa_tm_create_version): Set externally_visible. diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c index 88637a4..a50d871 100644 --- a/gcc/config/i386/i386.c +++ b/gcc/config/i386/i386.c @@ -13231,10 +13231,10 @@ ix86_delegitimize_address (rtx x) || GET_CODE (XEXP (x, 0)) != UNSPEC || (XINT (XEXP (x, 0), 1) != UNSPEC_GOTPCREL && XINT (XEXP (x, 0), 1) != UNSPEC_PCREL) - || !MEM_P (orig_x)) + || (!MEM_P (orig_x) && XINT (XEXP (x, 0), 1) != UNSPEC_PCREL)) return ix86_delegitimize_tls_address (orig_x); x = XVECEXP (XEXP (x, 0), 0, 0); - if (GET_MODE (orig_x) != GET_MODE (x)) + if (GET_MODE (orig_x) != GET_MODE (x) && MEM_P (orig_x)) { x = simplify_gen_subreg (GET_MODE (orig_x), x, GET_MODE (x), 0); diff --git a/gcc/config/i386/predicates.md b/gcc/config/i386/predicates.md index 1dda585..32f73da 100644 --- a/gcc/config/i386/predicates.md +++ b/gcc/config/i386/predicates.md @@ -410,6 +410,7 @@ || (GET_CODE (op) == UNSPEC && (XINT (op, 1) == UNSPEC_GOT || XINT (op, 1) == UNSPEC_GOTOFF + || XINT (op, 1) == UNSPEC_PCREL || XINT (op, 1) == UNSPEC_GOTPCREL))) return true; if (GET_CODE (op) != PLUS diff --git a/gcc/config/i386/winnt.c b/gcc/config/i386/winnt.c index af3f975..79cbb6b 100644 --- a/gcc/config/i386/winnt.c +++ b/gcc/config/i386/winnt.c @@ -350,21 +350,22 @@ i386_pe_encode_section_info (tree decl, rtx rtl, int first) SYMBOL_REF_FLAGS (symbol) = flags; } + bool i386_pe_binds_local_p (const_tree exp) { - /* PE does not do dynamic binding. Indeed, the only kind of - non-local reference comes from a dllimport'd symbol. */ if ((TREE_CODE (exp) == VAR_DECL || TREE_CODE (exp) == FUNCTION_DECL) && DECL_DLLIMPORT_P (exp)) return false; - /* Or a weak one, now that they are supported. */ - if ((TREE_CODE (exp) == VAR_DECL || TREE_CODE (exp) == FUNCTION_DECL) - && DECL_WEAK (exp)) - return false; - - return true; + /* External public symbols, which aren't weakref-s, + have local-binding for PE targets. */ + if (DECL_P (exp) + && !lookup_attribute ("weakref", DECL_ATTRIBUTES (exp)) + && TREE_PUBLIC (exp) + && DECL_EXTERNAL (exp)) + return true; + return default_binds_local_p_1 (exp, 0); } /* Also strip the fastcall prefix and stdcall suffix. */ |