mirror of
https://github.com/darlinghq/darling-gdb.git
synced 2024-11-25 13:09:48 +00:00
Add support for generating ARM unwind tables.
This commit is contained in:
parent
1763908f7c
commit
7ed4c4c5d0
@ -1,3 +1,24 @@
|
||||
2004-10-05 Paul Brook <paul@codesourcery.com>
|
||||
|
||||
* config/tc-arm.c (unwind): New variable.
|
||||
(vfp_sp_encode_reg): New function.
|
||||
(vfp_sp_reg_required_here): Use it.
|
||||
(vfp_sp_reg_list, vfp_dp_reg_list): Remove.
|
||||
(vfp_parse_reg_list): New function.
|
||||
(s_arm_unwind_fnstart, s_arm_unwind_fnend, s_arm_unwind_cantunwind,
|
||||
s_arm_unwind_personality, s_arm_unwind_personalityindex,
|
||||
s_arm_unwind_handlerdata, s_arm_unwind_save, s_arm_unwind_movsp,
|
||||
s_arm_unwind_pad, s_arm_unwind_setfp, s_arm_unwind_raw): New
|
||||
functions.
|
||||
(md_pseudo_table): Add them.
|
||||
(do_vfp_reg2_from_sp2): Use vfp_parse_reg_list and vfp_sp_encode_reg.
|
||||
(do_vfp_sp2_from_reg2, vfp_sp_ldstm, vfp_dp_ldstm): Ditto.
|
||||
(set_section, add_unwind_adjustsp, flush_pending_unwind,
|
||||
finish_unwind_opcodes, start_unwind_section, create_unwind_entry,
|
||||
require_hashconst, add_unwind_opcode): New functions.
|
||||
* doc/tc-arm.text: Document unwinding opcodes.
|
||||
* NEWS: Mention the new feature.
|
||||
|
||||
2004-10-04 Eric Christopher <echristo@redhat.com>
|
||||
|
||||
* config/tc-mips.c (md_apply_fix3): Remove erroneous assert.
|
||||
|
2
gas/NEWS
2
gas/NEWS
@ -1,5 +1,7 @@
|
||||
-*- text -*-
|
||||
|
||||
* Added support for generating unwind tables for ARM ELF targets.
|
||||
|
||||
* Add a -g command line option to generate debug information in the target's
|
||||
preferred debug format.
|
||||
|
||||
|
1429
gas/config/tc-arm.c
1429
gas/config/tc-arm.c
File diff suppressed because it is too large
Load Diff
@ -407,6 +407,104 @@ it prevents accurate control of the placement of literal pools.
|
||||
@item .pool
|
||||
This is a synonym for .ltorg.
|
||||
|
||||
@cindex @code{.fnstart} directive, ARM
|
||||
@item .unwind_fnstart
|
||||
Marks the start of a function with an unwind table entry.
|
||||
|
||||
@cindex @code{.fnend} directive, ARM
|
||||
@item .unwind_fnend
|
||||
Marks the end of a function with an unwind table entry. The unwind index
|
||||
table entry is created when this directive is processed.
|
||||
|
||||
If no personality routine has been specified then standard personality
|
||||
routine 0 or 1 will be used, depending on the number of unwind opcodes
|
||||
required.
|
||||
|
||||
@cindex @code{.cantunwind} directive, ARM
|
||||
@item .cantunwind
|
||||
Prevents unwinding through the current function. No personality routine
|
||||
or exception table data is required or permitted.
|
||||
|
||||
@cindex @code{.personality} directive, ARM
|
||||
@item .personality @var{name}
|
||||
Sets the personality routine for the current function to @var{name}.
|
||||
|
||||
@cindex @code{.personalityindex} directive, ARM
|
||||
@item .personalityindex @var{index}
|
||||
Sets the personality routine for the current function to the EABI standard
|
||||
routine number @var{index}
|
||||
|
||||
@cindex @code{.handlerdata} directive, ARM
|
||||
@item .handlerdata
|
||||
Marks the end of the current function, and the start of the exception table
|
||||
entry for that function. Anything between this directive and the
|
||||
@code{.fnend} directive will be added to the exception table entry.
|
||||
|
||||
Must be preceded by a @code{.personality} or @code{.personalityindex}
|
||||
directive.
|
||||
|
||||
@cindex @code{.save} directive, ARM
|
||||
@item .save @var{reglist}
|
||||
Generate unwinder annotations to restore the registers in @var{reglist}.
|
||||
The format of @var{reglist} is the same as the corresponding store-multiple
|
||||
instruction.
|
||||
|
||||
@smallexample
|
||||
@exdent @emph{core registers}
|
||||
.save @{r4, r5, r6, lr@}
|
||||
stmfd sp!, @{r4, r5, r6, lr@}
|
||||
@exdent @emph{FPA registers}
|
||||
.save f4, 2
|
||||
sfmfd f4, 2, [sp]!
|
||||
@exdent @emph{VFP registers}
|
||||
.save @{d8, d9, d10@}
|
||||
fstmdf sp!, @{d8, d9, d10@}
|
||||
@exdent @emph{iWMMXt registers}
|
||||
.save @{wr10, wr11@}
|
||||
wstrd wr11, [sp, #-8]!
|
||||
wstrd wr10, [sp, #-8]!
|
||||
or
|
||||
.save wr11
|
||||
wstrd wr11, [sp, #-8]!
|
||||
.save wr10
|
||||
wstrd wr10, [sp, #-8]!
|
||||
@end smallexample
|
||||
|
||||
@cindex @code{.pad} directive, ARM
|
||||
@item .pad #@var{count}
|
||||
Generate unwinder annotations for a stack adjustment of @var{count} bytes.
|
||||
A positive value indicates the function prologue allocated stack space by
|
||||
decrementing the stack pointer.
|
||||
|
||||
@cindex @code{.movsp} directive, ARM
|
||||
@item .movsp @var{reg}
|
||||
Tell the unwinder that @var{reg} contains the current stack pointer.
|
||||
|
||||
@cindex @code{.setfp} directive, ARM
|
||||
@item .setfp @var{fpreg}, @var{spreg} [, #@var{offset}]
|
||||
Make all unwinder annotations relaive to a frame pointer. Without this
|
||||
the unwinder will use offsets from the stack pointer.
|
||||
|
||||
The syntax of this directive is the same as the @code{sub} or @code{mov}
|
||||
instruction used to set the frame pointer. @var{spreg} must be either
|
||||
@code{sp} or mentioned in a previous @code{.movsp} directive.
|
||||
|
||||
@smallexample
|
||||
.movsp ip
|
||||
mov ip, sp
|
||||
@dots{}
|
||||
.setfp fp, ip, #4
|
||||
sub fp, ip, #4
|
||||
@end smallexample
|
||||
|
||||
@cindex @code{.unwind_raw} directive, ARM
|
||||
@item .raw @var{offset}, @var{byte1}, @dots{}
|
||||
Insert one of more arbitary unwind opcode bytes, which are known to adjust
|
||||
the stack pointer by @var{offset} bytes.
|
||||
|
||||
For example @code{.unwind_raw 4, 0xb1, 0x01} is equivalent to
|
||||
@code{.save @{r0@}}
|
||||
|
||||
@end table
|
||||
|
||||
@node ARM Opcodes
|
||||
|
@ -58,10 +58,11 @@ if {[istarget *arm*-*-*] || [istarget "xscale-*-*"]} then {
|
||||
run_errors_test "r15-bad" "" "Invalid use of r15 errors"
|
||||
run_errors_test "undefined" "" "Undefined local label error"
|
||||
|
||||
if {[istarget *-*-elf*] || [istarget *-*-linux*]} then {
|
||||
if {[istarget *-*-*elf*] || [istarget *-*-linux*] || [istarget *-*-*eabi]} then {
|
||||
run_dump_test "pic"
|
||||
run_dump_test "mapping"
|
||||
gas_test "bignum1.s" "" $stdoptlist "bignums"
|
||||
run_dump_test "unwind"
|
||||
}
|
||||
|
||||
if {! [istarget arm*-*-aout] && ![istarget arm-*-pe]} then {
|
||||
|
33
gas/testsuite/gas/arm/unwind.d
Normal file
33
gas/testsuite/gas/arm/unwind.d
Normal file
@ -0,0 +1,33 @@
|
||||
#objdump: -sr
|
||||
#name: Unwind table generation
|
||||
|
||||
.*: file format.*
|
||||
|
||||
RELOCATION RECORDS FOR \[.ARM.extab\]:
|
||||
OFFSET TYPE VALUE
|
||||
0000000c R_ARM_PREL31 .text
|
||||
|
||||
|
||||
RELOCATION RECORDS FOR \[.ARM.exidx\]:
|
||||
OFFSET TYPE VALUE
|
||||
00000000 R_ARM_REL32 .text
|
||||
00000008 R_ARM_REL32 .text
|
||||
0000000c R_ARM_PREL31 .ARM.extab
|
||||
00000010 R_ARM_REL32 .text
|
||||
00000014 R_ARM_PREL31 .ARM.extab
|
||||
00000018 R_ARM_REL32 .text
|
||||
0000001c R_ARM_PREL31 .ARM.extab
|
||||
00000020 R_ARM_REL32 .text
|
||||
|
||||
|
||||
Contents of section .text:
|
||||
0000 (0000a0e3 0100a0e3 0200a0e3 0300a0e3|e3a00000 a0e30001 e3a00002 e3a00003) .*
|
||||
0010 (0420|2004) .*
|
||||
Contents of section .ARM.extab:
|
||||
0000 (449b0181 b0b08086|81019b44 8680b0b0) 00000000 00000000 .*
|
||||
0010 (8402b101 b0b0b005 2a000000 00c60181|01b10284 05b0b0b0 000000a2 8101c600) .*
|
||||
0020 (b0b0c1c1|c1c1b0b0) 00000000 .*
|
||||
Contents of section .ARM.exidx:
|
||||
0000 00000000 (b0b0a880 04000000|80a8b0b0 00000004) 00000000 .*
|
||||
0010 (08000000 0c000000 0c000000 1c000000|00000008 0000000c 0000000c 0000001c) .*
|
||||
0020 (10000000 08849780|00000010 80978480) .*
|
46
gas/testsuite/gas/arm/unwind.s
Normal file
46
gas/testsuite/gas/arm/unwind.s
Normal file
@ -0,0 +1,46 @@
|
||||
# Test generation of unwind tables
|
||||
.text
|
||||
foo: @ Simple function
|
||||
.fnstart
|
||||
.save {r4, lr}
|
||||
mov r0, #0
|
||||
.fnend
|
||||
foo1: @ Typical frame pointer prologue
|
||||
.fnstart
|
||||
.movsp ip
|
||||
@mov ip, sp
|
||||
.pad #4
|
||||
.save {fp, ip, lr}
|
||||
@stmfd sp!, {fp, ip, lr, pc}
|
||||
.setfp fp, ip, #4
|
||||
@sub fp, ip, #4
|
||||
mov r0, #1
|
||||
.fnend
|
||||
foo2: @ Custom personality routine
|
||||
.fnstart
|
||||
.save {r1, r4, r6, lr}
|
||||
@stmfd {r1, r4, r6, lr}
|
||||
mov r0, #2
|
||||
.personality foo
|
||||
.handlerdata
|
||||
.word 42
|
||||
.fnend
|
||||
foo3: @ Saving iwmmxt registers
|
||||
.fnstart
|
||||
.save {wr11}
|
||||
.save {wr10}
|
||||
.save {wr10, wr11}
|
||||
.save {wr0}
|
||||
mov r0, #3
|
||||
.fnend
|
||||
.code 16
|
||||
foo4: @ Thumb frame pointer
|
||||
.fnstart
|
||||
.save {r7, lr}
|
||||
@push {r7, lr}
|
||||
.setfp r7, sp
|
||||
@mov r7, sp
|
||||
.pad #8
|
||||
@sub sp, sp, #8
|
||||
mov r0, #4
|
||||
.fnend
|
Loading…
Reference in New Issue
Block a user