Re: [PATCH] perf dwarf-aux: Fix build with !HAVE_DWARF_GETLOCATIONS_SUPPORT

From: Arnaldo Carvalho de Melo
Date: Tue Oct 01 2024 - 09:47:48 EST


On Tue, Oct 01, 2024 at 01:36:25PM +0100, James Clark wrote:
> The linked fixes commit added an #include "dwarf-aux.h" to disasm.h
> which gets picked up in a lot of places. Without
> HAVE_DWARF_GETLOCATIONS_SUPPORT the stubs return an errno, so include
> errno.h to fix the following build error:
>
> In file included from util/disasm.h:8,
> from util/annotate.h:16,
> from builtin-top.c:23:
> util/dwarf-aux.h: In function 'die_get_var_range':
> util/dwarf-aux.h:183:10: error: 'ENOTSUP' undeclared (first use in this function)
> 183 | return -ENOTSUP;
> | ^~~~~~~
>
> Fixes: 782959ac248a ("perf annotate: Add "update_insn_state" callback function to handle arch specific instruction tracking")
> Signed-off-by: James Clark <james.clark@xxxxxxxxxx>
> ---
> tools/perf/util/dwarf-aux.h | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/tools/perf/util/dwarf-aux.h b/tools/perf/util/dwarf-aux.h
> index 336a3a183a78..bd7505812569 100644
> --- a/tools/perf/util/dwarf-aux.h
> +++ b/tools/perf/util/dwarf-aux.h
> @@ -9,6 +9,7 @@
> #include <elfutils/libdw.h>
> #include <elfutils/libdwfl.h>
> #include <elfutils/version.h>
> +#include <errno.h>

Simple enough, thanks, applied to perf-tools/perf-tools.

- Arnaldo

> struct strbuf;
>
> --
> 2.34.1
>