Home | History | Annotate | Line # | Download | only in gdb.arch
      1 /* Copyright 2023-2024 Free Software Foundation, Inc.
      2 
      3    This program is free software; you can redistribute it and/or modify
      4    it under the terms of the GNU General Public License as published by
      5    the Free Software Foundation; either version 3 of the License, or
      6    (at your option) any later version.
      7 
      8    This program is distributed in the hope that it will be useful,
      9    but WITHOUT ANY WARRANTY; without even the implied warranty of
     10    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     11    GNU General Public License for more details.
     12 
     13    You should have received a copy of the GNU General Public License
     14    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
     15 
     16 
     17 /* Simple asm function that makes use of c.li and c.lui in the
     18    function prologue before the return address and frame pointers are
     19    written the stack.  This ensures that GDB's prologue unwinder can
     20    understand these instructions.  */
     21 
     22 	.option pic
     23 	.text
     24 
     25 	.globl	foo
     26 	.type	foo, @function
     27 foo:
     28 	addi	sp,sp,-32
     29 	sd	s1,8(sp)
     30 
     31 	c.li	s1,-4
     32 	c.lui	s1,4
     33 
     34 	sd	fp,24(sp)
     35 	sd	ra,16(sp)
     36 	addi	fp,sp,32
     37 
     38 	call	bar@plt
     39 
     40 	ld	s1,8(sp)
     41 	ld	ra,16(sp)
     42 	ld	fp,24(sp)
     43 	addi	sp,sp,32
     44 	jr	ra
     45 
     46 	.size	foo, .-foo
     47 	.section	.note.GNU-stack,"",@progbits
     48