* config/tc-alpha.c (s_alpha_usepv): New.
authorRichard Henderson <rth@redhat.com>
Thu, 5 Jun 2003 03:27:03 +0000 (03:27 +0000)
committerRichard Henderson <rth@redhat.com>
Thu, 5 Jun 2003 03:27:03 +0000 (03:27 +0000)
        (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.

13 files changed:
gas/ChangeLog
gas/config/tc-alpha.c
gas/config/tc-alpha.h
gas/doc/c-alpha.texi
gas/testsuite/ChangeLog
gas/testsuite/gas/alpha/alpha.exp
gas/testsuite/gas/alpha/elf-usepv-1.d [new file with mode: 0644]
gas/testsuite/gas/alpha/elf-usepv-1.s [new file with mode: 0644]
gas/testsuite/gas/alpha/elf-usepv-2.l [new file with mode: 0644]
gas/testsuite/gas/alpha/elf-usepv-2.s [new file with mode: 0644]
gas/testsuite/gas/cfi/cfi-alpha-3.d [new file with mode: 0644]
gas/testsuite/gas/cfi/cfi-alpha-3.s [new file with mode: 0644]
gas/testsuite/gas/cfi/cfi.exp

index fd23b8f..83a80c0 100644 (file)
@@ -1,3 +1,12 @@
+2003-06-04  Richard Henderson  <rth@redhat.com>
+
+       * 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.
+
 2003-06-04  Jakub Jelinek  <jakub@redhat.com>
 
        * as.c (show_usage): Document --execstack and --noexecstack.
index a775c0d..83dbd34 100644 (file)
@@ -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 44ccd4e..d9275e2 100644 (file)
@@ -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 359dfcc..dfc05f4 100644 (file)
@@ -379,6 +379,18 @@ to perform a load of the GP register; 2 indicates that @code{$27} is
 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 82cef6c..70d8fe8 100644 (file)
@@ -1,3 +1,11 @@
+2003-06-04  Richard Henderson  <rth@redhat.com>
+
+       * 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.
+
 2003-05-31  Richard Henderson  <rth@redhat.com>
 
        * gas/alpha/elf-reloc-8.d: Correct .eh_frame relocs.
index 3281dcb..0afcc7c 100644 (file)
@@ -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"
diff --git a/gas/testsuite/gas/alpha/elf-usepv-1.d b/gas/testsuite/gas/alpha/elf-usepv-1.d
new file mode 100644 (file)
index 0000000..ba150be
--- /dev/null
@@ -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
diff --git a/gas/testsuite/gas/alpha/elf-usepv-1.s b/gas/testsuite/gas/alpha/elf-usepv-1.s
new file mode 100644 (file)
index 0000000..0d447aa
--- /dev/null
@@ -0,0 +1,6 @@
+       .usepv foo, no
+foo:
+       nop
+       .usepv bar, std
+bar:
+       nop
diff --git a/gas/testsuite/gas/alpha/elf-usepv-2.l b/gas/testsuite/gas/alpha/elf-usepv-2.l
new file mode 100644 (file)
index 0000000..35e3b26
--- /dev/null
@@ -0,0 +1,2 @@
+.*: Assembler messages:
+.*:1: Error: unknown argument for .usepv
diff --git a/gas/testsuite/gas/alpha/elf-usepv-2.s b/gas/testsuite/gas/alpha/elf-usepv-2.s
new file mode 100644 (file)
index 0000000..5a583f9
--- /dev/null
@@ -0,0 +1 @@
+       .usepv foo, bar
diff --git a/gas/testsuite/gas/cfi/cfi-alpha-3.d b/gas/testsuite/gas/cfi/cfi-alpha-3.d
new file mode 100644 (file)
index 0000000..b0c7d03
--- /dev/null
@@ -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
+
diff --git a/gas/testsuite/gas/cfi/cfi-alpha-3.s b/gas/testsuite/gas/cfi/cfi-alpha-3.s
new file mode 100644 (file)
index 0000000..a4ff135
--- /dev/null
@@ -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 b6acaad..0c24682 100644 (file)
@@ -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"
     }
 }