targhooks.c (default_hidden_stack_protect_fail): Fall back to default_external_stack_protect_fail if...
* targhooks.c (default_hidden_stack_protect_fail): Fall back to default_external_stack_protect_fail if visibility is not supported or not flag_pic. * config/i386/i386.c (ix86_stack_protect_fail): New function. (TARGET_STACK_PROTECT_FAIL): Define. * config/i386/i386.md (stack_protect_si): Change CLOBBER into SET to zero. (stack_protect_di): Likewise. Use %k2 instead of %2 to avoid invalid instruction xorl %rax, %rax. From-SVN: r101349
This commit is contained in:
parent
7d69de618e
commit
7ce918c59e
4 changed files with 38 additions and 5 deletions
|
@ -1,3 +1,15 @@
|
|||
2005-06-27 Jakub Jelinek <jakub@redhat.com>
|
||||
|
||||
* targhooks.c (default_hidden_stack_protect_fail): Fall back to
|
||||
default_external_stack_protect_fail if visibility is not supported
|
||||
or not flag_pic.
|
||||
* config/i386/i386.c (ix86_stack_protect_fail): New function.
|
||||
(TARGET_STACK_PROTECT_FAIL): Define.
|
||||
* config/i386/i386.md (stack_protect_si): Change CLOBBER into
|
||||
SET to zero.
|
||||
(stack_protect_di): Likewise. Use %k2 instead of %2 to avoid
|
||||
invalid instruction xorl %rax, %rax.
|
||||
|
||||
2005-06-27 Richard Henderson <rth@redhat.com>
|
||||
|
||||
* c-cppbuiltin.c (c_cpp_builtins): Add __SSP_ALL__ and __SSP__.
|
||||
|
|
|
@ -906,6 +906,7 @@ static bool ix86_pass_by_reference (CUMULATIVE_ARGS *, enum machine_mode,
|
|||
static void ix86_init_builtins (void);
|
||||
static rtx ix86_expand_builtin (tree, rtx, rtx, enum machine_mode, int);
|
||||
static const char *ix86_mangle_fundamental_type (tree);
|
||||
static tree ix86_stack_protect_fail (void);
|
||||
|
||||
/* This function is only used on Solaris. */
|
||||
static void i386_solaris_elf_named_section (const char *, unsigned int, tree)
|
||||
|
@ -1082,7 +1083,7 @@ static void init_ext_80387_constants (void);
|
|||
#define TARGET_MANGLE_FUNDAMENTAL_TYPE ix86_mangle_fundamental_type
|
||||
|
||||
#undef TARGET_STACK_PROTECT_FAIL
|
||||
#define TARGET_STACK_PROTECT_FAIL default_hidden_stack_protect_fail
|
||||
#define TARGET_STACK_PROTECT_FAIL ix86_stack_protect_fail
|
||||
|
||||
struct gcc_target targetm = TARGET_INITIALIZER;
|
||||
|
||||
|
@ -17564,4 +17565,17 @@ ix86_mangle_fundamental_type (tree type)
|
|||
}
|
||||
}
|
||||
|
||||
/* For 32-bit code we can save PIC register setup by using
|
||||
__stack_chk_fail_local hidden function instead of calling
|
||||
__stack_chk_fail directly. 64-bit code doesn't need to setup any PIC
|
||||
register, so it is better to call __stack_chk_fail directly. */
|
||||
|
||||
static tree
|
||||
ix86_stack_protect_fail (void)
|
||||
{
|
||||
return TARGET_64BIT
|
||||
? default_external_stack_protect_fail ()
|
||||
: default_hidden_stack_protect_fail ();
|
||||
}
|
||||
|
||||
#include "gt-i386.h"
|
||||
|
|
|
@ -19613,7 +19613,7 @@
|
|||
(define_insn "stack_protect_set_si"
|
||||
[(set (match_operand:SI 0 "memory_operand" "=m")
|
||||
(unspec:SI [(match_operand:SI 1 "memory_operand" "m")] UNSPEC_SP_SET))
|
||||
(clobber (match_scratch:SI 2 "=r"))
|
||||
(set (match_scratch:SI 2 "=&r") (const_int 0))
|
||||
(clobber (reg:CC FLAGS_REG))]
|
||||
""
|
||||
"mov{l}\t{%1, %2|%2, %1}\;mov{l}\t{%2, %0|%0, %2}\;xor{l}\t%2, %2"
|
||||
|
@ -19622,10 +19622,10 @@
|
|||
(define_insn "stack_protect_set_di"
|
||||
[(set (match_operand:DI 0 "memory_operand" "=m")
|
||||
(unspec:DI [(match_operand:DI 1 "memory_operand" "m")] UNSPEC_SP_SET))
|
||||
(clobber (match_scratch:DI 2 "=r"))
|
||||
(set (match_scratch:DI 2 "=&r") (const_int 0))
|
||||
(clobber (reg:CC FLAGS_REG))]
|
||||
"TARGET_64BIT"
|
||||
"mov{q}\t{%1, %2|%2, %1}\;mov{q}\t{%2, %0|%0, %2}\;xor{l}\t%2, %2"
|
||||
"mov{q}\t{%1, %2|%2, %1}\;mov{q}\t{%2, %0|%0, %2}\;xor{l}\t%k2, %k2"
|
||||
[(set_attr "type" "multi")])
|
||||
|
||||
(define_expand "stack_protect_test"
|
||||
|
|
|
@ -380,9 +380,15 @@ default_external_stack_protect_fail (void)
|
|||
tree
|
||||
default_hidden_stack_protect_fail (void)
|
||||
{
|
||||
#ifndef HAVE_GAS_HIDDEN
|
||||
return default_external_stack_protect_fail ();
|
||||
#else
|
||||
tree t = stack_chk_fail_decl;
|
||||
|
||||
if (stack_chk_fail_decl == NULL_TREE)
|
||||
if (!flag_pic)
|
||||
return default_external_stack_protect_fail ();
|
||||
|
||||
if (t == NULL_TREE)
|
||||
{
|
||||
t = build_function_type_list (void_type_node, NULL_TREE);
|
||||
t = build_decl (FUNCTION_DECL,
|
||||
|
@ -402,6 +408,7 @@ default_hidden_stack_protect_fail (void)
|
|||
}
|
||||
|
||||
return build_function_call_expr (t, NULL_TREE);
|
||||
#endif
|
||||
}
|
||||
|
||||
#include "gt-targhooks.h"
|
||||
|
|
Loading…
Add table
Reference in a new issue