Hello,
The patch introduces determining e500 cpu from .gnu.attributes; if gnu
attributes section is not present, fall-back to the old way of checking
the presence of .PPC.EMB.apuinfo section.
It also introduces a function for "show powerpc vector-abi" to print
both ABI being used and if different, global setting (output can be seen
below). This could be a separate patch - let me know if you want it
separately.
Background of the patch:
Currently, gdb relies on presence .PPC.EMB.apuinfo section. This is not
completely correct since apuinfo section can contain information about
any APU instructions present, and not only SPE. So we could have a
binary with .PPC.EMB.apuinfo section and without SPE APU. Further,
.PPC.EMB.apuinfo may not be present at all even if -me500 is specified.
This is due to gas emitting this section only if it encounters SPE APU
instructions in the assembly.
.gnu.attributes section records user setting, whether there were SPE
instructions generated or not. We use gnu object attributes in rs6000
already (for determining vector-abi and float-point abi).
The only problem with .gnu.attribute is that if binary is compiled with
pre-4.3 gcc, .gnu.attributes section does not get generated at all.
(.gnu_attribute was added in 4.3). This is why we fall-back to
.PPC.EMB.apuinfo presence.
Results of the patch:
After starting gdb, no executable:
(gdb) show powerpc vector-abi
The vector ABI in use is "generic". Default setting is "auto".
(gdb) file /mnt/win/ppcspetest_g
Reading symbols from /mnt/win/ppcspetest_g...done.
(gdb) show powerpc vector-abi
The vector ABI in use is "spe". Default setting is "auto".
** If user overrides selected vector-abi, this is the display:
(gdb) set powerpc vector-abi generic
(gdb) show powerpc vector-abi
The vector ABI is "generic"
"show powerpc vector-abi" will now display both selected vector-abi and
user setting ("Default setting is ..."). Only if the two concide, it
will only say "Target vector ABI is ...").
Thanks,
Aleksandar Ristovski
QNX Software Systems
ChangeLog
* rs6000-tdep.c (rs6000_gdbarch_init): Use .gnu.attributes to see
if this is a e500 binary (with SPE APU).
(powerpc_show_vector_abi): New function.
(_initialize_rs6000_tdep): Use powerpc_show_vector_abi.