[PATCH v2 3/3] perf dwarf-aux: Fix build fail when HAVE_DWARF_GETLOCATIONS_SUPPORT undefined

Yang Jihong posted 3 patches 1 year, 4 months ago
There is a newer version of this series
[PATCH v2 3/3] perf dwarf-aux: Fix build fail when HAVE_DWARF_GETLOCATIONS_SUPPORT undefined
Posted by Yang Jihong 1 year, 4 months ago
commit 3796eba7c137 move #else block of #ifdef HAVE_DWARF_GETLOCATIONS_SUPPORT
code from dwarf-aux.c to dwarf-aux.h, in which die_get_var_range() used ENOTSUP
macro, but dwarf-aux.h was not self-contained and did not include file errno.h.

As a result, the build failed when HAVE_DWARF_GETLOCATIONS_SUPPORT macro was not
defined, and the error log is as follows:

  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:184:10: error: 'ENOTSUP' undeclared (first use in this function)
    184 |  return -ENOTSUP;
        |          ^~~~~~~
  util/dwarf-aux.h:184:10: note: each undeclared identifier is reported only once for each function it appears

Fixes: 3796eba7c137 ("perf dwarf-aux: Move #else block of #ifdef HAVE_DWARF_GETLOCATIONS_SUPPORT code to the header file")
Signed-off-by: Yang Jihong <yangjihong@bytedance.com>
---
 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 24446412b869..d2903894538e 100644
--- a/tools/perf/util/dwarf-aux.h
+++ b/tools/perf/util/dwarf-aux.h
@@ -5,6 +5,7 @@
  * dwarf-aux.h : libdw auxiliary interfaces
  */
 
+#include <errno.h>
 #include <dwarf.h>
 #include <elfutils/libdw.h>
 #include <elfutils/libdwfl.h>
-- 
2.25.1
Re: [PATCH v2 3/3] perf dwarf-aux: Fix build fail when HAVE_DWARF_GETLOCATIONS_SUPPORT undefined
Posted by Leo Yan 1 year, 4 months ago
On 8/6/2024 12:48 PM, Yang Jihong wrote:
> commit 3796eba7c137 move #else block of #ifdef HAVE_DWARF_GETLOCATIONS_SUPPORT
> code from dwarf-aux.c to dwarf-aux.h, in which die_get_var_range() used ENOTSUP
> macro, but dwarf-aux.h was not self-contained and did not include file errno.h.
> 
> As a result, the build failed when HAVE_DWARF_GETLOCATIONS_SUPPORT macro was not
> defined, and the error log is as follows:
> 
>   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:184:10: error: 'ENOTSUP' undeclared (first use in this function)
>     184 |  return -ENOTSUP;
>         |          ^~~~~~~
>   util/dwarf-aux.h:184:10: note: each undeclared identifier is reported only once for each function it appears
> 
> Fixes: 3796eba7c137 ("perf dwarf-aux: Move #else block of #ifdef HAVE_DWARF_GETLOCATIONS_SUPPORT code to the header file")
> Signed-off-by: Yang Jihong <yangjihong@bytedance.com>
> ---
>  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 24446412b869..d2903894538e 100644
> --- a/tools/perf/util/dwarf-aux.h
> +++ b/tools/perf/util/dwarf-aux.h
> @@ -5,6 +5,7 @@
>   * dwarf-aux.h : libdw auxiliary interfaces
>   */
> 
> +#include <errno.h>
>  #include <dwarf.h>

Please alphabet ordering. With it:

Reviewed-by: Leo Yan <leo.yan@arm.com>

>  #include <elfutils/libdw.h>
>  #include <elfutils/libdwfl.h>
> --
> 2.25.1
> 
>
Re: [PATCH v2 3/3] perf dwarf-aux: Fix build fail when HAVE_DWARF_GETLOCATIONS_SUPPORT undefined
Posted by Yang Jihong 1 year, 4 months ago
Hello,

On 8/7/24 05:34, Leo Yan wrote:
> On 8/6/2024 12:48 PM, Yang Jihong wrote:
>> commit 3796eba7c137 move #else block of #ifdef HAVE_DWARF_GETLOCATIONS_SUPPORT
>> code from dwarf-aux.c to dwarf-aux.h, in which die_get_var_range() used ENOTSUP
>> macro, but dwarf-aux.h was not self-contained and did not include file errno.h.
>>
>> As a result, the build failed when HAVE_DWARF_GETLOCATIONS_SUPPORT macro was not
>> defined, and the error log is as follows:
>>
>>    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:184:10: error: 'ENOTSUP' undeclared (first use in this function)
>>      184 |  return -ENOTSUP;
>>          |          ^~~~~~~
>>    util/dwarf-aux.h:184:10: note: each undeclared identifier is reported only once for each function it appears
>>
>> Fixes: 3796eba7c137 ("perf dwarf-aux: Move #else block of #ifdef HAVE_DWARF_GETLOCATIONS_SUPPORT code to the header file")
>> Signed-off-by: Yang Jihong <yangjihong@bytedance.com>
>> ---
>>   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 24446412b869..d2903894538e 100644
>> --- a/tools/perf/util/dwarf-aux.h
>> +++ b/tools/perf/util/dwarf-aux.h
>> @@ -5,6 +5,7 @@
>>    * dwarf-aux.h : libdw auxiliary interfaces
>>    */
>>
>> +#include <errno.h>
>>   #include <dwarf.h>
> 
> Please alphabet ordering. With it:
> 
> Reviewed-by: Leo Yan <leo.yan@arm.com>
> 
Okay, will change in next version.

Thanks,
Yang