From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <SRS0=AcJP=4K=klomp.org=mark@sourceware.org>
Received: from gnu.wildebeest.org (gnu.wildebeest.org [45.83.234.184])
	by sourceware.org (Postfix) with ESMTPS id 201393857C71
	for <elfutils-devel@sourceware.org>; Mon, 12 Dec 2022 13:31:26 +0000 (GMT)
DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 201393857C71
Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=klomp.org
Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=klomp.org
Received: from tarox.wildebeest.org (83-87-18-245.cable.dynamic.v4.ziggo.nl [83.87.18.245])
	(using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))
	(No client certificate requested)
	by gnu.wildebeest.org (Postfix) with ESMTPSA id 0A20F3045FA6;
	Mon, 12 Dec 2022 14:31:25 +0100 (CET)
Received: by tarox.wildebeest.org (Postfix, from userid 1000)
	id BE64C404AC8A; Mon, 12 Dec 2022 14:31:24 +0100 (CET)
Message-ID: <1b9d9b01e459753b5b428f4a9d8113a47801f212.camel@klomp.org>
Subject: Re: [PATCH 14/25] libdw: check __OPTIMIZE__ in dwarf_whatattr.c and
 dwarf_whatform.c to match the header
From: Mark Wielaard <mark@klomp.org>
To: Yonggang Luo <luoyonggang@gmail.com>, elfutils-devel@sourceware.org
Date: Mon, 12 Dec 2022 14:31:24 +0100
In-Reply-To: <20221020182603.815-15-luoyonggang@gmail.com>
References: <20221020182603.815-1-luoyonggang@gmail.com>
	 <20221020182603.815-15-luoyonggang@gmail.com>
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Mailer: Evolution 3.28.5 (3.28.5-10.el7) 
Mime-Version: 1.0
X-Spam-Status: No, score=-3038.7 required=5.0 tests=BAYES_00,GIT_PATCH_0,JMQ_SPF_NEUTRAL,KAM_DMARC_STATUS,SPF_HELO_NONE,SPF_PASS,TXREP autolearn=ham autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org
List-Id: <elfutils-devel.sourceware.org>

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 =3D=3D 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"
> =20
> -
> +#ifndef __OPTIMIZE__
>  unsigned int
>  dwarf_whatform (Dwarf_Attribute *attr)
>  {
>    return attr =3D=3D 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