This is the mail archive of the binutils@sources.redhat.com mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

enable generic cfi for alpha


Which also requires finding something to do with the
overloaded semantics of .prologue.  I introduced a new
.usepv directive that just sets the relevant STO field.


r~


        * config/tc-alpha.c (s_alpha_usepv): New.
        (md_pseudo_table): Add it.
        (alpha_cfi_frame_initial_instructions): New.
        * config/tc-alpha.h (TARGET_USE_CFIPOP): New.
        (tc_cfi_frame_initial_instructions): New.
        * doc/c-alpha.texi: Document .usepv.

        * gas/alpha/elf-usepv-1.[sd]: New.
        * gas/alpha/elf-usepv-2.[sd]: New.
        * gas/alpha/alpha.exp: Run them.
        * gas/cfi/cfi-alpha-3.[sd]: New.
        * gas/cfi/cfi.exp: Run it.

Index: config/tc-alpha.c
===================================================================
RCS file: /cvs/src/src/gas/config/tc-alpha.c,v
retrieving revision 1.57
diff -c -p -d -u -r1.57 tc-alpha.c
--- config/tc-alpha.c	30 May 2003 03:01:11 -0000	1.57
+++ config/tc-alpha.c	5 Jun 2003 03:21:57 -0000
@@ -267,6 +267,7 @@ static void s_alpha_file PARAMS ((int));
 static void s_alpha_loc PARAMS ((int));
 static void s_alpha_stab PARAMS ((int));
 static void s_alpha_coff_wrapper PARAMS ((int));
+static void s_alpha_usepv PARAMS ((int));
 #endif
 #ifdef OBJ_EVAX
 static void s_alpha_section PARAMS ((int));
@@ -4822,8 +4823,65 @@ alpha_elf_md_end (void)
 	cfi_end_fde (p->func_end_sym);
       }
 }
+
+static void
+s_alpha_usepv (int unused ATTRIBUTE_UNUSED)
+{
+  char *name, name_end;
+  char *which, which_end;
+  symbolS *sym;
+  int other;
+
+  name = input_line_pointer;
+  name_end = get_symbol_end ();
+
+  if (! is_name_beginner (*name))
+    {
+      as_bad (_(".usepv directive has no name"));
+      *input_line_pointer = name_end;
+      ignore_rest_of_line ();
+      return;
+    }
+
+  sym = symbol_find_or_make (name);
+  *input_line_pointer++ = name_end;
+
+  if (name_end != ',')
+    {
+      as_bad (_(".usepv directive has no type"));
+      ignore_rest_of_line ();
+      return;
+    }
+
+  SKIP_WHITESPACE ();
+  which = input_line_pointer;
+  which_end = get_symbol_end ();
+
+  if (strcmp (which, "no") == 0)
+    other = STO_ALPHA_NOPV;
+  else if (strcmp (which, "std") == 0)
+    other = STO_ALPHA_STD_GPLOAD;
+  else
+    {
+      as_bad (_("unknown argument for .usepv"));
+      other = 0;
+    }
+  
+  *input_line_pointer = which_end;
+  demand_empty_rest_of_line ();
+
+  S_SET_OTHER (sym, other | (S_GET_OTHER (sym) & ~STO_ALPHA_STD_GPLOAD));
+}
 #endif /* OBJ_ELF */
 
+/* Standard calling conventions leaves the CFA at $30 on entry.  */
+
+void
+alpha_cfi_frame_initial_instructions ()
+{
+  cfi_add_CFA_def_cfa_register (30);
+}
+
 #ifdef OBJ_EVAX
 
 /* Handle the section specific pseudo-op.  */
@@ -5669,6 +5727,7 @@ const pseudo_typeS md_pseudo_table[] = {
   {"loc", s_alpha_loc, 9},
   {"stabs", s_alpha_stab, 's'},
   {"stabn", s_alpha_stab, 'n'},
+  {"usepv", s_alpha_usepv, 0},
   /* COFF debugging related pseudos.  */
   {"begin", s_alpha_coff_wrapper, 0},
   {"bend", s_alpha_coff_wrapper, 1},
Index: config/tc-alpha.h
===================================================================
RCS file: /cvs/src/src/gas/config/tc-alpha.h,v
retrieving revision 1.17
diff -c -p -d -u -r1.17 tc-alpha.h
--- config/tc-alpha.h	30 May 2003 03:01:11 -0000	1.17
+++ config/tc-alpha.h	5 Jun 2003 03:21:57 -0000
@@ -161,6 +161,11 @@ do {									\
 	     (long) FIX->tc_fix_data.next_reloc);			\
 } while (0)
 
+#define TARGET_USE_CFIPOP 1
+
+#define tc_cfi_frame_initial_instructions alpha_cfi_frame_initial_instructions
+extern void alpha_cfi_frame_initial_instructions(void);
+
 #define DWARF2_LINE_MIN_INSN_LENGTH	4
 #define DWARF2_DEFAULT_RETURN_COLUMN	26
 #define DWARF2_CIE_DATA_ALIGNMENT	-8
Index: doc/c-alpha.texi
===================================================================
RCS file: /cvs/src/src/gas/doc/c-alpha.texi,v
retrieving revision 1.4
diff -c -p -d -u -r1.4 c-alpha.texi
--- doc/c-alpha.texi	19 Dec 2002 01:11:31 -0000	1.4
+++ doc/c-alpha.texi	5 Jun 2003 03:21:58 -0000
@@ -379,6 +379,18 @@ to perform a load of the GP register; 2 
 used in some non-standard way and so the linker cannot elide the load of
 the procedure vector during relaxation.
 
+@item .usepv @var{function}, @var{which}
+Used to indicate the use of the @code{$27} register, similar to 
+@code{.prologue}, but without the other semantics of needing to 
+be inside an open @code{.ent}/@code{.end} block.
+
+The @var{which} argument should be either @code{no}, indicating that
+@code{$27} is not used, or @code{std}, indicating that the first two
+instructions of the function perform a GP load.
+
+One might use this directive instead of @code{.prologue} if you are
+also using dwarf2 CFI directives.
+
 @item .gprel32 @var{expression}
 Computes the difference between the address in @var{expression} and the
 GP for the current object file, and stores it in 4 bytes.  In addition
Index: testsuite/gas/alpha/alpha.exp
===================================================================
RCS file: /cvs/src/src/gas/testsuite/gas/alpha/alpha.exp,v
retrieving revision 1.6
diff -c -p -d -u -r1.6 alpha.exp
--- testsuite/gas/alpha/alpha.exp	7 Nov 2002 00:42:18 -0000	1.6
+++ testsuite/gas/alpha/alpha.exp	5 Jun 2003 03:21:58 -0000
@@ -34,6 +34,8 @@ if { [istarget alpha*-*-*] } then {
 	run_dump_test "elf-tls-1"
 	run_list_test "elf-tls-2" ""
 	run_list_test "elf-tls-3" ""
+	run_dump_test "elf-usepv-1"
+	run_list_test "elf-usepv-2" ""
     }
 
     run_dump_test "fp"
Index: testsuite/gas/alpha/elf-usepv-1.d
===================================================================
RCS file: testsuite/gas/alpha/elf-usepv-1.d
diff -N testsuite/gas/alpha/elf-usepv-1.d
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ testsuite/gas/alpha/elf-usepv-1.d	5 Jun 2003 03:21:58 -0000
@@ -0,0 +1,11 @@
+#objdump: --syms
+#name: alpha elf-usepv-1
+
+.*:     file format elf64-alpha
+
+SYMBOL TABLE:
+0*0000000 l    d  .text	0*0000000 
+0*0000000 l    d  .data	0*0000000 
+0*0000000 l    d  .bss	0*0000000 
+0*0000000 l       .text	0*0000000 0x80 foo
+0*0000004 l       .text	0*0000000 0x88 bar
Index: testsuite/gas/alpha/elf-usepv-1.s
===================================================================
RCS file: testsuite/gas/alpha/elf-usepv-1.s
diff -N testsuite/gas/alpha/elf-usepv-1.s
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ testsuite/gas/alpha/elf-usepv-1.s	5 Jun 2003 03:21:58 -0000
@@ -0,0 +1,6 @@
+	.usepv foo, no
+foo:
+	nop
+	.usepv bar, std
+bar:
+	nop
Index: testsuite/gas/alpha/elf-usepv-2.l
===================================================================
RCS file: testsuite/gas/alpha/elf-usepv-2.l
diff -N testsuite/gas/alpha/elf-usepv-2.l
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ testsuite/gas/alpha/elf-usepv-2.l	5 Jun 2003 03:21:58 -0000
@@ -0,0 +1,2 @@
+.*: Assembler messages:
+.*:1: Error: unknown argument for .usepv
Index: testsuite/gas/alpha/elf-usepv-2.s
===================================================================
RCS file: testsuite/gas/alpha/elf-usepv-2.s
diff -N testsuite/gas/alpha/elf-usepv-2.s
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ testsuite/gas/alpha/elf-usepv-2.s	5 Jun 2003 03:21:58 -0000
@@ -0,0 +1 @@
+	.usepv foo, bar
Index: testsuite/gas/cfi/cfi-alpha-3.d
===================================================================
RCS file: testsuite/gas/cfi/cfi-alpha-3.d
diff -N testsuite/gas/cfi/cfi-alpha-3.d
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ testsuite/gas/cfi/cfi-alpha-3.d	5 Jun 2003 03:21:58 -0000
@@ -0,0 +1,32 @@
+#readelf: -wf
+#name: CFI on alpha, 3
+The section .eh_frame contains:
+
+00000000 00000010 00000000 CIE
+  Version:               1
+  Augmentation:          "zR"
+  Code alignment factor: 4
+  Data alignment factor: -8
+  Return address column: 26
+  Augmentation data:     1b
+
+  DW_CFA_def_cfa_reg: r30
+  DW_CFA_nop
+
+00000014 00000024 00000018 FDE cie=00000000 pc=0000001c..0000005c
+  DW_CFA_advance_loc: 4 to 00000020
+  DW_CFA_def_cfa_offset: 32
+  DW_CFA_advance_loc: 4 to 00000024
+  DW_CFA_offset: r26 at cfa-32
+  DW_CFA_advance_loc: 4 to 00000028
+  DW_CFA_offset: r9 at cfa-24
+  DW_CFA_advance_loc: 4 to 0000002c
+  DW_CFA_offset: r15 at cfa-16
+  DW_CFA_advance_loc: 4 to 00000030
+  DW_CFA_offset: r34 at cfa-8
+  DW_CFA_advance_loc: 4 to 00000034
+  DW_CFA_def_cfa_reg: r15
+  DW_CFA_advance_loc: 36 to 00000058
+  DW_CFA_def_cfa: r30 ofs 0
+  DW_CFA_nop
+
Index: testsuite/gas/cfi/cfi-alpha-3.s
===================================================================
RCS file: testsuite/gas/cfi/cfi-alpha-3.s
diff -N testsuite/gas/cfi/cfi-alpha-3.s
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ testsuite/gas/cfi/cfi-alpha-3.s	5 Jun 2003 03:21:58 -0000
@@ -0,0 +1,37 @@
+	.file	1 "z.c"
+	.set noat
+	.set noreorder
+.text
+	.align 4
+	.globl f
+	.type f,@function
+	.usepv f,no
+	.cfi_startproc
+f:
+	lda $30,-32($30)
+	.cfi_adjust_cfa_offset 32
+	stq $26,0($30)
+	.cfi_offset $26, -32
+	stq $9,8($30)
+	.cfi_offset $9, -24
+	stq $15,16($30)
+	.cfi_offset $15, -16
+	stt $f2,24($30)
+	.cfi_offset $f2, -8
+	mov $30,$15
+	.cfi_def_cfa_register $15
+
+	nop
+	nop
+	nop
+
+	mov $15,$30
+	ldq $26,0($30)
+	ldq $9,8($30)
+	ldt $f2,24($30)
+	ldq $15,16($30)
+	lda $30,32($30)
+	.cfi_def_cfa $30, 0
+	ret $31,($26),1
+	.size f, .-f
+	.cfi_endproc
Index: testsuite/gas/cfi/cfi.exp
===================================================================
RCS file: /cvs/src/src/gas/testsuite/gas/cfi/cfi.exp,v
retrieving revision 1.3
diff -c -p -d -u -r1.3 cfi.exp
--- testsuite/gas/cfi/cfi.exp	31 May 2003 19:36:45 -0000	1.3
+++ testsuite/gas/cfi/cfi.exp	5 Jun 2003 03:21:58 -0000
@@ -16,5 +16,6 @@ if { [istarget alpha*-*-*] } then {
     if $elf {
 	run_dump_test "cfi-alpha-1"
 	run_dump_test "cfi-alpha-2"
+	run_dump_test "cfi-alpha-3"
     }
 }


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]