diff options
author | Srinath Parvathaneni <srinath.parvathaneni@arm.com> | 2019-07-02 12:43:59 +0100 |
---|---|---|
committer | Nick Clifton <nickc@redhat.com> | 2019-07-02 12:43:59 +0100 |
commit | bb32413ff7247f5ac3685ca9075b3432bca69a82 (patch) | |
tree | 7080f32670d5b6264ba6953f4cbd05a9240ffd22 /bfd/elf32-arm.c | |
parent | 01c1ee4a70478178eb37e46692a02fb846a2f77b (diff) | |
download | gdb-bb32413ff7247f5ac3685ca9075b3432bca69a82.zip gdb-bb32413ff7247f5ac3685ca9075b3432bca69a82.tar.gz gdb-bb32413ff7247f5ac3685ca9075b3432bca69a82.tar.bz2 |
Ensure that debug information is retained for ARMv8-M security functions.
Consider a file containing only Armv8-M secure entry functions.
This file is compiled and linked with "-march=armv8-m.main -mfloat-abi=hard
-mfpu=fpv5-sp-d16 -mcmse -static --specs=rdimon.specs
-Wl,--section-start,.gnu.sgstubs=0x190000 -ffunction-sections
-fdata-sections
-Wl,--gc-sections -g" options to generate an executable.
The executable generated does not contain any debug information of these
secure entry functions even though it contains secure entry functions in
the .text section. This patch fixes this problem.
Diffstat (limited to 'bfd/elf32-arm.c')
-rw-r--r-- | bfd/elf32-arm.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/bfd/elf32-arm.c b/bfd/elf32-arm.c index bcace92..fc7a41c 100644 --- a/bfd/elf32-arm.c +++ b/bfd/elf32-arm.c @@ -15903,6 +15903,8 @@ elf32_arm_gc_mark_extra_sections (struct bfd_link_info *info, struct elf_link_hash_entry **sym_hashes; struct elf32_arm_link_hash_entry *cmse_hash; bfd_boolean again, is_v8m, first_bfd_browse = TRUE; + bfd_boolean debug_sec_need_to_be_marked = FALSE; + asection *isec; _bfd_elf_gc_mark_extra_sections (info, gc_mark_hook); @@ -15964,8 +15966,25 @@ elf32_arm_gc_mark_extra_sections (struct bfd_link_info *info, if (!cmse_sec->gc_mark && !_bfd_elf_gc_mark (info, cmse_sec, gc_mark_hook)) return FALSE; + /* The debug sections related to these secure entry + functions are marked on enabling below flag. */ + debug_sec_need_to_be_marked = TRUE; } } + + if (debug_sec_need_to_be_marked) + { + /* Looping over all the sections of the object file containing + Armv8-M secure entry functions and marking all the debug + sections. */ + for (isec = sub->sections; isec != NULL; isec = isec->next) + { + /* If not a debug sections, skip it. */ + if (!isec->gc_mark && (isec->flags & SEC_DEBUGGING)) + isec->gc_mark = 1 ; + } + debug_sec_need_to_be_marked = FALSE; + } } } first_bfd_browse = FALSE; |