[PATCH 14/25] libdw: check __OPTIMIZE__ in dwarf_whatattr.c and dwarf_whatform.c to match the header

Mark Wielaard mark@klomp.org
Mon Dec 12 13:31:24 GMT 2022


Hi,

On Fri, 2022-10-21 at 02:25 +0800, Yonggang Luo via Elfutils-devel
wrote:
> -
> +#ifndef __OPTIMIZE__
>  unsigned int
>  dwarf_whatattr (Dwarf_Attribute *attr)
>  {
>    return attr == NULL ? 0 : attr->code;
>  }
> +#endif
> diff --git a/libdw/dwarf_whatform.c b/libdw/dwarf_whatform.c
> index dee29a9f..01a33424 100644
> --- a/libdw/dwarf_whatform.c
> +++ b/libdw/dwarf_whatform.c
> @@ -34,9 +34,10 @@
>  #include <dwarf.h>
>  #include "libdwP.h"
>  
> -
> +#ifndef __OPTIMIZE__
>  unsigned int
>  dwarf_whatform (Dwarf_Attribute *attr)
>  {
>    return attr == NULL ? 0 : attr->form;
>  }
> +#endif

I don't think this is correct. These functions are defined with extern
inline (if __OPTIMIZE__ is defined). Which means they will not generate
an out-of-line version. But these functions are exported from libdw, so
there must be a real implementation.

So we want to generate code for these functions whether or not
__OPTIMIZE__ is defined.

Cheers,

Mark


More information about the Elfutils-devel mailing list