aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2018-09-26 19:00:49 +0200
committerJakub Jelinek <jakub@gcc.gnu.org>2018-09-26 19:00:49 +0200
commit0974b794c104f403c335a7e6b2376b487ab17659 (patch)
tree64baa62b7b5832f72c92d1478c7e9bd78242a155 /gcc
parent1413a4190f3cd17225841f1c0e2bb7842dd6c507 (diff)
downloadgcc-0974b794c104f403c335a7e6b2376b487ab17659.zip
gcc-0974b794c104f403c335a7e6b2376b487ab17659.tar.gz
gcc-0974b794c104f403c335a7e6b2376b487ab17659.tar.bz2
re PR target/87414 (-mindirect-branch=thunk produces thunk with incorrect CFI on x86_64)
PR target/87414 * config/i386/i386.c: Include debug.h and dwarf2out.h. (output_indirect_thunk): Emit DW_CFA_def_cfa_offset after the call. From-SVN: r264651
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog7
-rw-r--r--gcc/config/i386/i386.c19
2 files changed, 26 insertions, 0 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index c775327..e134f91 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,10 @@
+2018-09-26 Jakub Jelinek <jakub@redhat.com>
+
+ PR target/87414
+ * config/i386/i386.c: Include debug.h and dwarf2out.h.
+ (output_indirect_thunk): Emit DW_CFA_def_cfa_offset after the
+ call.
+
2018-09-25 Andrew Stubbs <ams@codesourcery.com>
* builtins.c (get_builtin_sync_mem): Force address mode conversion.
diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c
index a79cfb5..ef72219 100644
--- a/gcc/config/i386/i386.c
+++ b/gcc/config/i386/i386.c
@@ -89,6 +89,8 @@ along with GCC; see the file COPYING3. If not see
#include "ipa-fnsummary.h"
#include "wide-int-bitmask.h"
#include "tree-vector-builder.h"
+#include "debug.h"
+#include "dwarf2out.h"
/* This file should be included last. */
#include "target-def.h"
@@ -10470,6 +10472,23 @@ output_indirect_thunk (unsigned int regno)
ASM_OUTPUT_INTERNAL_LABEL (asm_out_file, indirectlabel2);
+ /* The above call insn pushed a word to stack. Adjust CFI info. */
+ if (flag_asynchronous_unwind_tables && dwarf2out_do_frame ())
+ {
+ if (! dwarf2out_do_cfi_asm ())
+ {
+ dw_cfi_ref xcfi = ggc_cleared_alloc<dw_cfi_node> ();
+ xcfi->dw_cfi_opc = DW_CFA_advance_loc4;
+ xcfi->dw_cfi_oprnd1.dw_cfi_addr = ggc_strdup (indirectlabel2);
+ vec_safe_push (cfun->fde->dw_fde_cfi, xcfi);
+ }
+ dw_cfi_ref xcfi = ggc_cleared_alloc<dw_cfi_node> ();
+ xcfi->dw_cfi_opc = DW_CFA_def_cfa_offset;
+ xcfi->dw_cfi_oprnd1.dw_cfi_offset = 2 * UNITS_PER_WORD;
+ vec_safe_push (cfun->fde->dw_fde_cfi, xcfi);
+ dwarf2out_emit_cfi (xcfi);
+ }
+
if (regno != INVALID_REGNUM)
{
/* MOV. */