[PATCH] Fix type and alignment of ARM/Thumb EABI mapping symbols
Julian Brown
julian@codesourcery.com
Mon Mar 28 08:41:00 GMT 2005
Hi,
This patch fixes two problems: the type of mapping symbols is made
STT_NOTYPE (from STT_FUNC or STT_OBJECT from ARM/Thumb or data
respectively), and the alignment is corrected to not have the low bit
set for Thumb mapping symbols, in accordance with the latest version of
the ARM AAELF spec.
Unfortunately altering the symbol type to STT_NOTYPE for mapping symbols
affects the output of disassembly from objdump. $a and $t were
previously treated as functions. When objdump tried to find the closest
symbol for possibly-symbol-relative offsets previously, it found those
mapping symbols since compare_symbols places functions first in a sorted
version of the symbol table. They were then rejected by the
symbol_is_valid hook (arm_symbol_is_valid) from the disassemble_info
struct, and the section name was printed instead.
When the type of mapping symbols is changed to STT_NOTYPE, they are no
longer placed first in the sorted symbol list, so another symbol is used
instead. This causes test regressions, e.g. a symbol-offset address
which was previously output as:
bl 8224 <.text-0xc>
was output instead as:
bl 8224 <_start-0xc>
In the interest of preserving existing behaviour, I have fixed this by
adding a new disassemble_info hook which allows the symbol table used
for disassembly to have a target-specific hook for altering each symbol
(or remove it) in the remove_useless_symbols function. This sets the
BSF_FUNCTION flag for mapping symbols, which makes things behave the way
they used to, and possibly provides useful functionality for other
platforms as well.
It may be better to just change the expected test output instead. Thoughts?
Tested on arm-none-eabi, arm-none-symbianelf, and i686-pc-linux-gnu with
all targets.
OK to apply?
ChangeLog:
* bfd/elf32-arm.c (arm_elf_find_function): include STT_NOTYPE in test
for mapping symbols.
* binutils/objdump.c (remove_useless_symbols): Add disassemble_info
parameter, and call new hook to filter symbols in a target-specific
way.
(disassemble_data): Initialise sorted symbols after disassemble_info
struct, and call remove_useless_symbols before sorting.
* gas/config/tc-arm.c (mapping_state): Update documentation in
function comment. Change type of all mapping symbols to BSF_NO_FLAGS.
(is_mapping_symbol_name): New function.
(arm_adjust_symtab): Don't adjust type of mapping symbols here.
* gas/testsuite/gas/arm/mapping.d: Change expected output for untyped
symbols.
* include/dis-asm.h (disassemble_info): Add filter_symbol hook.
(arm_filter_symbol): Add prototype.
* opcodes/arm-dis.c (arm_filter_symbol): New function to add
BSF_FUNCTION for code mapping symbols.
* opcodes/dis-init.c (init_disassemble_info): Initialise filter_symbol
hook (NULL).
* opcodes/disassemble.c (disassemble_init_for_target): Initialise
filter_symbol hook for ARM.
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: patch-3
URL: <https://sourceware.org/pipermail/binutils/attachments/20050328/90032cf0/attachment.ksh>
More information about the Binutils
mailing list