Re: [testsuite patch] [ppc64] +kfail: gdb_target_symbol does not support function descriptors

Yao Qi
2016-07-06T07:51:28Z

On Tue, Jul 5, 2016 at 3:54 PM, Jan Kratochvil
<jan.kratochvil@redhat.com> wrote:
> Hi,
>
> Marin Cermak has found various testcases (or one of them) of GDB FAIL on
> ppc64.
>
> https://sourceware.org/bugzilla/show_bug.cgi?id=20328
> # powerpc64-unknown-linux-gnu:
> # FAIL: gdb.dwarf2/dw2-bad-mips-linkage-name.exp: ptype f
> # FAIL: gdb.dwarf2/dw2-bad-mips-linkage-name.exp: ptype g
> # FAIL: gdb.dwarf2/dw2-lexical-block-bare.exp: p testvar
> # FAIL: gdb.dwarf2/atomic-type.exp: ptype f
> #
> # but:
> # powerpc64le-unknown-linux-gnu does PASS them (ppc64le does not use function
> # descriptors anymore)
>
> I do not see how to really fix it, DWARF needs to contain PC addresses, not
> function descriptor addresses. But .o contains only the function descriptor
> address.

In ppc64 ELFv1 abi, symbol "f" is the address of function descriptor,
symbol ".f"
is the address of function entry. If we hack
gdb.dwarf2/dw2-bad-mips-linkage-name.exp like this, "f" -> ".f", and
"g" -> ".g",

DW_TAG_subprogram {
{name f}
{low_pc [gdb_target_symbol .f] addr}
{high_pc f_end_lbl addr}
{type :$b_l}
{DW_AT_MIPS_linkage_name _Z1fv}
}
DW_TAG_subprogram {
{name g}
{low_pc [gdb_target_symbol .g] addr}
{high_pc g_end_lbl addr}
{type :$b_l}
{DW_AT_MIPS_linkage_name 42 DW_FORM_data1}
}

the tests pass. The right fix would be teaching proc gdb_target_symbol to add
prefix "." to symbol if target is powerpc64 and abi is ELFv1, in which function
descriptor is used.

--
Yao (齐尧)