[ARC] Enable .cfi_* pseudo-ops.
authorClaudiu Zissulescu <claziss@synopsys.com>
Tue, 16 Feb 2016 14:56:04 +0000 (15:56 +0100)
committerClaudiu Zissulescu <claziss@synopsys.com>
Tue, 16 Feb 2016 14:56:04 +0000 (15:56 +0100)
gas/
2016-02-16  Claudiu Zissulescu  <claziss@synopsys.com>

* config/tc-arc.c (tc_arc_frame_initial_instructions): New
function.
(tc_arc_regname_to_dw2regnum): Likewise.
* config/tc-arc.h (TARGET_USE_CFIPOP): Define
(tc_cfi_frame_initial_instructions): Likewise.
(tc_regname_to_dw2regnum): Likewise.

gas/testsuite
2016-02-16  Claudiu Zissulescu  <claziss@synopsys.com>

* gas/cfi/cfi-arc-1.d: New file.
* gas/cfi/cfi-arc-1.s: Likewise.
* gas/cfi/cfi.exp: Allow running tests for arc.

binutils/
2016-02-16  Claudiu Zissulescu  <claziss@synopsys.com>

* readelf.c (is_32bit_pcrel_reloc): Add R_ARC_32_PCREL.

binutils/ChangeLog
binutils/readelf.c
gas/ChangeLog
gas/config/tc-arc.c
gas/config/tc-arc.h
gas/testsuite/ChangeLog [new file with mode: 0644]
gas/testsuite/gas/cfi/cfi-arc-1.d [new file with mode: 0644]
gas/testsuite/gas/cfi/cfi-arc-1.s [new file with mode: 0644]
gas/testsuite/gas/cfi/cfi.exp

index 96ce7a8425955a5ad25e82729d340b488b0092f9..4ac0e2d1ecc7041f5677848f7c6a4bad2af491fb 100644 (file)
@@ -1,3 +1,7 @@
+2016-02-16  Claudiu Zissulescu  <claziss@synopsys.com>
+
+       * readelf.c (is_32bit_pcrel_reloc): Add R_ARC_32_PCREL.
+
 2016-02-15  Nick Clifton  <nickc@redhat.com>
 
        * readelf.c (get_section_type_name): Add hex prefix to offsets
index f33257bc04754bcac7ce233bb4ea136878c414f4..d6abab800af2d12c72145aba6c1e1c3994bce89a 100644 (file)
@@ -11558,6 +11558,9 @@ is_32bit_pcrel_reloc (unsigned int reloc_type)
       return reloc_type == 6;
     case EM_ALPHA:
       return reloc_type == 10; /* R_ALPHA_SREL32.  */
+    case EM_ARC_COMPACT:
+    case EM_ARC_COMPACT2:
+      return reloc_type == 49; /* R_ARC_32_PCREL.  */
     case EM_ARM:
       return reloc_type == 3;  /* R_ARM_REL32 */
     case EM_MICROBLAZE:
index ce09b011022a0897502ba3e9e2da813970dd2a77..220b5b10e2f30b443aebe2d6a9df4fd375baf13b 100644 (file)
@@ -1,3 +1,12 @@
+2016-02-16  Claudiu Zissulescu  <claziss@synopsys.com>
+
+       * config/tc-arc.c (tc_arc_frame_initial_instructions): New
+       function.
+       (tc_arc_regname_to_dw2regnum): Likewise.
+       * config/tc-arc.h (TARGET_USE_CFIPOP): Define
+       (tc_cfi_frame_initial_instructions): Likewise.
+       (tc_regname_to_dw2regnum): Likewise.
+
 2016-02-16  Trevor Saunders  <tbsaunde@tbsaunde.org>
 
        * doc/internals.texi (S_IS_EXTERN): Remove.
index f2d3a0e52c8ffc5b18f92d834474feb8355e9a15..bfe9ae1448841240f92c6fac049765fb007e924c 100644 (file)
@@ -24,6 +24,7 @@
 #include "subsegs.h"
 #include "struc-symbol.h"
 #include "dwarf2dbg.h"
+#include "dw2gencfi.h"
 #include "safe-ctype.h"
 
 #include "opcode/arc.h"
@@ -3675,3 +3676,24 @@ arc_pcrel_adjust (fragS *fragP)
 
   return 0;
 }
+
+/* Initialize the DWARF-2 unwind information for this procedure.  */
+
+void
+tc_arc_frame_initial_instructions (void)
+{
+  /* Stack pointer is register 28.  */
+  cfi_add_CFA_def_cfa_register (28);
+}
+
+int
+tc_arc_regname_to_dw2regnum (char *regname)
+{
+  struct symbol *sym;
+
+  sym = hash_find (arc_reg_hash, regname);
+  if (sym)
+    return S_GET_VALUE (sym);
+
+  return -1;
+}
index acd007bb50327cbb9f762dd166a929e03e11bd34..95efd77236332450a1dad862c1e10948fa2b451a 100644 (file)
@@ -191,12 +191,21 @@ extern void arc_handle_align (fragS *);
 extern void arc_cons_fix_new (fragS *, int, int, expressionS *,
                              bfd_reloc_code_real_type);
 extern void arc_frob_label (symbolS *);
+extern void tc_arc_frame_initial_instructions (void);
+extern int tc_arc_regname_to_dw2regnum (char *regname);
 
 /* The blink register is r31.  */
 #define DWARF2_DEFAULT_RETURN_COLUMN   31
 /* Registers are generally saved at negative offsets to the CFA.  */
 #define DWARF2_CIE_DATA_ALIGNMENT      (-4)
 
+/* We want .cfi_* pseudo-ops for generating unwind info.  */
+#define TARGET_USE_CFIPOP 1
+
+/* CFI hooks.  */
+#define tc_cfi_frame_initial_instructions  tc_arc_frame_initial_instructions
+#define tc_regname_to_dw2regnum tc_arc_regname_to_dw2regnum
+
 /* Define the NOPs.  */
 #define NOP_OPCODE_S   0x000078E0
 #define NOP_OPCODE_L   0x264A7000 /* mov 0,0.  */
diff --git a/gas/testsuite/ChangeLog b/gas/testsuite/ChangeLog
new file mode 100644 (file)
index 0000000..e9652f8
--- /dev/null
@@ -0,0 +1,5 @@
+2016-02-16  Claudiu Zissulescu  <claziss@synopsys.com>
+
+       * gas/cfi/cfi-arc-1.d: New file.
+       * gas/cfi/cfi-arc-1.s: Likewise.
+       * gas/cfi/cfi.exp: Allow running tests for arc.
diff --git a/gas/testsuite/gas/cfi/cfi-arc-1.d b/gas/testsuite/gas/cfi/cfi-arc-1.d
new file mode 100644 (file)
index 0000000..cdb75bd
--- /dev/null
@@ -0,0 +1,30 @@
+#readelf: -wf
+#name: CFI on ARC
+
+Contents of the .eh_frame section:
+
+00000000 00000010 00000000 CIE
+  Version:               1
+  Augmentation:          "zR"
+  Code alignment factor: 1
+  Data alignment factor: -4
+  Return address column: 31
+  Augmentation data:     1b
+
+  DW_CFA_def_cfa_register: r28
+  DW_CFA_nop
+
+00000014 00000020 00000018 FDE cie=00000000 pc=00000000..00000010
+  DW_CFA_advance_loc: 4 to 00000004
+  DW_CFA_def_cfa_offset: 48
+  DW_CFA_offset: r13 at cfa-48
+  DW_CFA_advance_loc: 4 to 00000008
+  DW_CFA_def_cfa_offset: 52
+  DW_CFA_offset: r14 at cfa-44
+  DW_CFA_offset: r15 at cfa-40
+  DW_CFA_advance_loc: 4 to 0000000c
+  DW_CFA_offset: r27 at cfa-52
+  DW_CFA_advance_loc: 2 to 0000000e
+  DW_CFA_def_cfa_register: r27
+  DW_CFA_nop
+
diff --git a/gas/testsuite/gas/cfi/cfi-arc-1.s b/gas/testsuite/gas/cfi/cfi-arc-1.s
new file mode 100644 (file)
index 0000000..5d4f99d
--- /dev/null
@@ -0,0 +1,21 @@
+       .file   "foo.c"
+       .cpu HS
+       .section        .text
+       .align  4
+       .cfi_startproc
+foo:
+       st.a r13,[sp,-48]
+       .cfi_def_cfa_offset 48
+       .cfi_offset r13, -48
+.LCFI0:
+       std r14,[sp,4]
+       .cfi_adjust_cfa_offset 4
+       .cfi_offset r14, -44
+       .cfi_rel_offset r15, 12
+       st.a fp,[sp,-4]
+       .cfi_rel_offset fp, 0
+       mov_s fp,sp
+       .cfi_def_cfa_register fp
+       j_s     [blink]
+       .cfi_endproc
+       .size   foo, .-foo
index 379e6f4f3be743a6d4bcf3b1e433d74dd061c74f..4a8d3bae62afe47643a6f4a5fcda5e03234177c3 100644 (file)
@@ -91,7 +91,8 @@ if  { [istarget "i*86-*-*"] || [istarget "x86_64-*-*"] } then {
     } else {
        run_dump_test "cfi-sh-1"
     }
-
+} elseif { [istarget "arc*-*-*"] } then {
+    run_dump_test "cfi-arc-1"
 } elseif { [istarget "arm*-*"] } then {
     # Only ELF based ARM targets support CFI.
     if { [is_pecoff_format] } then {
This page took 0.037398 seconds and 4 git commands to generate.