diff options
author | H.J. Lu <hjl.tools@gmail.com> | 2020-04-08 09:47:35 -0700 |
---|---|---|
committer | H.J. Lu <hjl.tools@gmail.com> | 2020-04-08 09:47:53 -0700 |
commit | c5f379653964a1d2c7037b2de3e947a48370a198 (patch) | |
tree | 4c8c0f81228ae562527397802e41a9d0d02e4931 /gcc/cse.c | |
parent | 8bf5faa9c463f0d53ffe835ba03d4502edfb959d (diff) | |
download | gcc-c5f379653964a1d2c7037b2de3e947a48370a198.zip gcc-c5f379653964a1d2c7037b2de3e947a48370a198.tar.gz gcc-c5f379653964a1d2c7037b2de3e947a48370a198.tar.bz2 |
x86: Insert ENDBR if function will be called indirectly
Since constant_call_address_operand has
;; Test for a pc-relative call operand
(define_predicate "constant_call_address_operand"
(match_code "symbol_ref")
{
if (ix86_cmodel == CM_LARGE || ix86_cmodel == CM_LARGE_PIC
|| flag_force_indirect_call)
return false;
if (TARGET_DLLIMPORT_DECL_ATTRIBUTES && SYMBOL_REF_DLLIMPORT_P (op))
return false;
return true;
})
even if cgraph_node::get (cfun->decl)->only_called_directly_p () returns
false, the fuction may still be called indirectly. Copy the logic from
constant_call_address_operand to rest_of_insert_endbranch to insert ENDBR
at function entry if function will be called indirectly.
gcc/
PR target/94417
* config/i386/i386-features.c (rest_of_insert_endbranch): Insert
ENDBR at function entry if function will be called indirectly.
gcc/testsuite/
PR target/94417
* gcc.target/i386/pr94417-1.c: New test.
* gcc.target/i386/pr94417-2.c: Likewise.
* gcc.target/i386/pr94417-3.c: Likewise.
Diffstat (limited to 'gcc/cse.c')
0 files changed, 0 insertions, 0 deletions