Re: [PATCH perf 3/4] perf tools: Fix unused variables: x86_{32,64}_regoffset_table
From: Arnaldo Carvalho de Melo
Date: Wed Jan 20 2016 - 08:59:39 EST
Em Tue, Jan 19, 2016 at 09:33:06PM +0000, Ben Hutchings escreveu:
> gcc 5 doesn't seem to care about these, but gcc 6 does and that
> results in a build failure.
Ben, please CC the people on the CC list for the patch that introduces
the problem, Wang, He, can I have your Acked-by?
- Arnaldo
> Fixes: bbbe6bf6037d ("perf tools: Introduce regs_query_register_offset() ...")
> Signed-off-by: Ben Hutchings <ben@xxxxxxxxxxxxxxx>
> ---
> tools/perf/arch/x86/util/dwarf-regs.c | 38 ++++++++++++++++-------------------
> 1 file changed, 17 insertions(+), 21 deletions(-)
>
> diff --git a/tools/perf/arch/x86/util/dwarf-regs.c b/tools/perf/arch/x86/util/dwarf-regs.c
> index 9223c16..fe1e516 100644
> --- a/tools/perf/arch/x86/util/dwarf-regs.c
> +++ b/tools/perf/arch/x86/util/dwarf-regs.c
> @@ -55,26 +55,10 @@ struct pt_regs_offset {
>
> #define REG_OFFSET_END {.name = NULL, .offset = 0}
>
> +/* TODO: switching by dwarf address size */
> #ifdef __x86_64__
> -# define REG_OFFSET_NAME_64(n, r) {.name = n, .offset = offsetof(struct pt_regs, r)}
> -# define REG_OFFSET_NAME_32(n, r) {.name = n, .offset = -1}
> -#else
> -# define REG_OFFSET_NAME_64(n, r) {.name = n, .offset = -1}
> -# define REG_OFFSET_NAME_32(n, r) {.name = n, .offset = offsetof(struct pt_regs, r)}
> -#endif
> -
> -static const struct pt_regs_offset x86_32_regoffset_table[] = {
> - REG_OFFSET_NAME_32("%ax", eax),
> - REG_OFFSET_NAME_32("%cx", ecx),
> - REG_OFFSET_NAME_32("%dx", edx),
> - REG_OFFSET_NAME_32("%bx", ebx),
> - REG_OFFSET_NAME_32("$stack", esp), /* Stack address instead of %sp */
> - REG_OFFSET_NAME_32("%bp", ebp),
> - REG_OFFSET_NAME_32("%si", esi),
> - REG_OFFSET_NAME_32("%di", edi),
> - REG_OFFSET_END,
> -};
>
> +#define REG_OFFSET_NAME_64(n, r) {.name = n, .offset = offsetof(struct pt_regs, r)}
> static const struct pt_regs_offset x86_64_regoffset_table[] = {
> REG_OFFSET_NAME_64("%ax", rax),
> REG_OFFSET_NAME_64("%dx", rdx),
> @@ -94,12 +78,24 @@ static const struct pt_regs_offset x86_64_regoffset_table[] = {
> REG_OFFSET_NAME_64("%r15", r15),
> REG_OFFSET_END,
> };
> -
> -/* TODO: switching by dwarf address size */
> -#ifdef __x86_64__
> #define regoffset_table x86_64_regoffset_table
> +
> #else
> +
> +#define REG_OFFSET_NAME_32(n, r) {.name = n, .offset = offsetof(struct pt_regs, r)}
> +static const struct pt_regs_offset x86_32_regoffset_table[] = {
> + REG_OFFSET_NAME_32("%ax", eax),
> + REG_OFFSET_NAME_32("%cx", ecx),
> + REG_OFFSET_NAME_32("%dx", edx),
> + REG_OFFSET_NAME_32("%bx", ebx),
> + REG_OFFSET_NAME_32("$stack", esp), /* Stack address instead of %sp */
> + REG_OFFSET_NAME_32("%bp", ebp),
> + REG_OFFSET_NAME_32("%si", esi),
> + REG_OFFSET_NAME_32("%di", edi),
> + REG_OFFSET_END,
> +};
> #define regoffset_table x86_32_regoffset_table
> +
> #endif
>
> /* Minus 1 for the ending REG_OFFSET_END */
>