From f4b97536ed71fbe05b8b0886d63f5ea2c4c66ae8 Mon Sep 17 00:00:00 2001 From: Richard Henderson Date: Thu, 5 Jun 2003 03:27:03 +0000 Subject: [PATCH] * 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. --- gas/ChangeLog | 9 ++++ gas/config/tc-alpha.c | 59 +++++++++++++++++++++++++++ gas/config/tc-alpha.h | 5 +++ gas/doc/c-alpha.texi | 12 ++++++ gas/testsuite/ChangeLog | 8 ++++ gas/testsuite/gas/alpha/alpha.exp | 2 + gas/testsuite/gas/alpha/elf-usepv-1.d | 11 +++++ gas/testsuite/gas/alpha/elf-usepv-1.s | 6 +++ gas/testsuite/gas/alpha/elf-usepv-2.l | 2 + gas/testsuite/gas/alpha/elf-usepv-2.s | 1 + gas/testsuite/gas/cfi/cfi-alpha-3.d | 32 +++++++++++++++ gas/testsuite/gas/cfi/cfi-alpha-3.s | 37 +++++++++++++++++ gas/testsuite/gas/cfi/cfi.exp | 1 + 13 files changed, 185 insertions(+) create mode 100644 gas/testsuite/gas/alpha/elf-usepv-1.d create mode 100644 gas/testsuite/gas/alpha/elf-usepv-1.s create mode 100644 gas/testsuite/gas/alpha/elf-usepv-2.l create mode 100644 gas/testsuite/gas/alpha/elf-usepv-2.s create mode 100644 gas/testsuite/gas/cfi/cfi-alpha-3.d create mode 100644 gas/testsuite/gas/cfi/cfi-alpha-3.s diff --git a/gas/ChangeLog b/gas/ChangeLog index fd23b8f73e1..83a80c0a884 100644 --- a/gas/ChangeLog +++ b/gas/ChangeLog @@ -1,3 +1,12 @@ +2003-06-04 Richard Henderson + + * 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 * as.c (show_usage): Document --execstack and --noexecstack. diff --git a/gas/config/tc-alpha.c b/gas/config/tc-alpha.c index a775c0d597d..83dbd344448 100644 --- a/gas/config/tc-alpha.c +++ b/gas/config/tc-alpha.c @@ -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}, diff --git a/gas/config/tc-alpha.h b/gas/config/tc-alpha.h index 44ccd4eded1..d9275e2aefa 100644 --- a/gas/config/tc-alpha.h +++ b/gas/config/tc-alpha.h @@ -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 diff --git a/gas/doc/c-alpha.texi b/gas/doc/c-alpha.texi index 359dfcc4d5c..dfc05f46eb7 100644 --- a/gas/doc/c-alpha.texi +++ b/gas/doc/c-alpha.texi @@ -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 diff --git a/gas/testsuite/ChangeLog b/gas/testsuite/ChangeLog index 82cef6c7cfc..70d8fe8cf23 100644 --- a/gas/testsuite/ChangeLog +++ b/gas/testsuite/ChangeLog @@ -1,3 +1,11 @@ +2003-06-04 Richard Henderson + + * 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 * gas/alpha/elf-reloc-8.d: Correct .eh_frame relocs. diff --git a/gas/testsuite/gas/alpha/alpha.exp b/gas/testsuite/gas/alpha/alpha.exp index 3281dcba9b9..0afcc7c476e 100644 --- a/gas/testsuite/gas/alpha/alpha.exp +++ b/gas/testsuite/gas/alpha/alpha.exp @@ -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 index 00000000000..ba150befb3b --- /dev/null +++ b/gas/testsuite/gas/alpha/elf-usepv-1.d @@ -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 index 00000000000..0d447aad4e4 --- /dev/null +++ b/gas/testsuite/gas/alpha/elf-usepv-1.s @@ -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 index 00000000000..35e3b26a1ce --- /dev/null +++ b/gas/testsuite/gas/alpha/elf-usepv-2.l @@ -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 index 00000000000..5a583f9eb7e --- /dev/null +++ b/gas/testsuite/gas/alpha/elf-usepv-2.s @@ -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 index 00000000000..b0c7d03c8f0 --- /dev/null +++ b/gas/testsuite/gas/cfi/cfi-alpha-3.d @@ -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 index 00000000000..a4ff13576f8 --- /dev/null +++ b/gas/testsuite/gas/cfi/cfi-alpha-3.s @@ -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 diff --git a/gas/testsuite/gas/cfi/cfi.exp b/gas/testsuite/gas/cfi/cfi.exp index b6acaad6c43..0c24682ff36 100644 --- a/gas/testsuite/gas/cfi/cfi.exp +++ b/gas/testsuite/gas/cfi/cfi.exp @@ -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" } } -- 2.30.2