[14/25] libdw: check __OPTIMIZE__ in dwarf_whatattr.c and dwarf_whatform.c to match the header
Message ID | 20221020182603.815-15-luoyonggang@gmail.com |
---|---|
State | Superseded |
Headers |
Return-Path: <elfutils-devel-bounces+patchwork=sourceware.org@sourceware.org> X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 451BF384B110 for <patchwork@sourceware.org>; Thu, 20 Oct 2022 18:27:18 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 451BF384B110 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1666290438; bh=Jxq7ttZDjKXncgNEE1Vrh/fNVRQ+k+jg/nND2lR5FTc=; h=To:Subject:Date:In-Reply-To:References:List-Id:List-Unsubscribe: List-Archive:List-Help:List-Subscribe:From:Reply-To:From; b=HaVLnsZjJPH75sxCzOApKFgxv8c6VEZm+/2HUIIO3QbLTCveCGdmPPlSj57auUEPR AMmNScDaLVkbTSoDcoy6vlxdpCcJmftyl95DiJjXwifoiyPnKJovAUuDsmwWQq/G/5 BmIF6/owtgHQXEtQC/LKGristBnRmm/WunTHSCSA= X-Original-To: elfutils-devel@sourceware.org Delivered-To: elfutils-devel@sourceware.org Received: from mail-pg1-x52f.google.com (mail-pg1-x52f.google.com [IPv6:2607:f8b0:4864:20::52f]) by sourceware.org (Postfix) with ESMTPS id CF5FC384D15D for <elfutils-devel@sourceware.org>; Thu, 20 Oct 2022 18:26:54 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org CF5FC384D15D Received: by mail-pg1-x52f.google.com with SMTP id s196so308301pgs.3 for <elfutils-devel@sourceware.org>; Thu, 20 Oct 2022 11:26:54 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Jxq7ttZDjKXncgNEE1Vrh/fNVRQ+k+jg/nND2lR5FTc=; b=vBv/sYVKsYfRRqeet3LiBtB2HlXIh3hAeXEm1Gx+yvXTsBQfCZRCVhBcPFnIDXCFL7 VPS8cvb6TtfP5TZb+hzjJ55HF5s2pa7hig4oGCIDj0UuP4wHT3f8AUd8oaXWZhRrVldB dkcWmrna9k/f+U5vytJAP8OlhVdL08FA8u/4IuOT3M1PqV0FS5NssgD/Nib8vnkm0y/2 sWTQGSpKsJ/ZqSsBEr6/qQu+ssx8SmenNMHozGT3EAMjrHL80O+jNXzzdV8Cqg1UqYcU 0NvjLg7+0/mQGPl6FiyewrSKuG+CwxnUTkAw3eDKI08GsUMVPuNbZ6c7+iCZ0LhLugHw rHhQ== X-Gm-Message-State: ACrzQf3ZmWhIlC3IzhsXGDdV7EW9CdT+5GmpZBMtghdCEkPcZ8fn5PHv dQyuIHhtPuVui91K64qFBv0++MF2qnMowQ== X-Google-Smtp-Source: AMsMyM5zQLYnJOCYfKtGkG5Tnr2DSWM7mM5jNvcqYFtdShP3P5SsRFjrbB8EukDirE5cCtPJGYtHBg== X-Received: by 2002:a65:6c08:0:b0:448:c216:fe9 with SMTP id y8-20020a656c08000000b00448c2160fe9mr12611812pgu.243.1666290413404; Thu, 20 Oct 2022 11:26:53 -0700 (PDT) Received: from localhost.localdomain ([103.94.185.75]) by smtp.googlemail.com with ESMTPSA id w15-20020a17090a460f00b00202fbd9c21dsm115067pjg.48.2022.10.20.11.26.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 20 Oct 2022 11:26:52 -0700 (PDT) To: elfutils-devel@sourceware.org Subject: [PATCH 14/25] libdw: check __OPTIMIZE__ in dwarf_whatattr.c and dwarf_whatform.c to match the header Date: Fri, 21 Oct 2022 02:25:53 +0800 Message-Id: <20221020182603.815-15-luoyonggang@gmail.com> X-Mailer: git-send-email 2.36.1.windows.1 In-Reply-To: <20221020182603.815-1-luoyonggang@gmail.com> References: <20221020182603.815-1-luoyonggang@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-11.1 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, 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 X-BeenThere: elfutils-devel@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Elfutils-devel mailing list <elfutils-devel.sourceware.org> List-Unsubscribe: <https://sourceware.org/mailman/options/elfutils-devel>, <mailto:elfutils-devel-request@sourceware.org?subject=unsubscribe> List-Archive: <https://sourceware.org/pipermail/elfutils-devel/> List-Help: <mailto:elfutils-devel-request@sourceware.org?subject=help> List-Subscribe: <https://sourceware.org/mailman/listinfo/elfutils-devel>, <mailto:elfutils-devel-request@sourceware.org?subject=subscribe> From: Yonggang Luo via Elfutils-devel <elfutils-devel@sourceware.org> Reply-To: Yonggang Luo <luoyonggang@gmail.com> Errors-To: elfutils-devel-bounces+patchwork=sourceware.org@sourceware.org Sender: "Elfutils-devel" <elfutils-devel-bounces+patchwork=sourceware.org@sourceware.org> |
Series |
Patches for building with mingw/gcc msvc/clang-cl
|
|
Commit Message
Yonggang Luo
Oct. 20, 2022, 6:25 p.m. UTC
Signed-off-by: Yonggang Luo <luoyonggang@gmail.com>
---
libdw/dwarf_whatattr.c | 3 ++-
libdw/dwarf_whatform.c | 3 ++-
2 files changed, 4 insertions(+), 2 deletions(-)
Comments
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
From bdf8a3b45f063d010e7c93b3d3bfc42b801ee9b2 Mon Sep 17 00:00:00 2001 From: Yonggang Luo <luoyonggang@gmail.com> Date: Thu, 20 Oct 2022 02:50:03 +0800 Subject: [PATCH] libdw: Fixes compile of dwarf_whatattr.c and dwarf_whatform.c If __OPTIMIZE__ is defined, then compile dwarf_whatattr.c and dwarf_whatform.c will cause symbol conflict between dwarf_whatattr.c and libdw.h, dwarf_whatform.c and libdw.h, So always undefined __OPTIMIZE__ when compiling these two files Signed-off-by: Yonggang Luo <luoyonggang@gmail.com> --- libdw/dwarf_whatattr.c | 4 +++- libdw/dwarf_whatform.c | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/libdw/dwarf_whatattr.c b/libdw/dwarf_whatattr.c index d664b021..c016f293 100644 --- a/libdw/dwarf_whatattr.c +++ b/libdw/dwarf_whatattr.c @@ -30,7 +30,9 @@ #ifdef HAVE_CONFIG_H # include <config.h> #endif - +#ifdef __OPTIMIZE__ +#undef __OPTIMIZE__ +#endif #include <dwarf.h> #include "libdwP.h" diff --git a/libdw/dwarf_whatform.c b/libdw/dwarf_whatform.c index dee29a9f..f1d3574d 100644 --- a/libdw/dwarf_whatform.c +++ b/libdw/dwarf_whatform.c @@ -30,7 +30,9 @@ #ifdef HAVE_CONFIG_H # include <config.h> #endif - +#ifdef __OPTIMIZE__ +#undef __OPTIMIZE__ +#endif #include <dwarf.h> #include "libdwP.h"
On Sat, 2022-12-17 at 05:47 +0800, 罗勇刚(Yonggang Luo) wrote: > From bdf8a3b45f063d010e7c93b3d3bfc42b801ee9b2 Mon Sep 17 00:00:00 > 2001 > From: Yonggang Luo <luoyonggang@gmail.com> > Date: Thu, 20 Oct 2022 02:50:03 +0800 > Subject: [PATCH] libdw: Fixes compile of dwarf_whatattr.c and > dwarf_whatform.c > > If __OPTIMIZE__ is defined, then compile dwarf_whatattr.c and > dwarf_whatform.c > will cause symbol conflict between > dwarf_whatattr.c and libdw.h, > dwarf_whatform.c and libdw.h, > > So always undefined __OPTIMIZE__ when compiling these two files I don't think this is correct either. Some system headers might depend on __OPTIMIZE__ being defined. Are you using a compiler that doesn't define __OPTIMIZE__ ? Cheers, Mark
On Tue, Dec 20, 2022 at 11:08 PM Mark Wielaard <mark@klomp.org> wrote: > > On Sat, 2022-12-17 at 05:47 +0800, 罗勇刚(Yonggang Luo) wrote: > > From bdf8a3b45f063d010e7c93b3d3bfc42b801ee9b2 Mon Sep 17 00:00:00 > > 2001 > > From: Yonggang Luo <luoyonggang@gmail.com> > > Date: Thu, 20 Oct 2022 02:50:03 +0800 > > Subject: [PATCH] libdw: Fixes compile of dwarf_whatattr.c and > > dwarf_whatform.c > > > > If __OPTIMIZE__ is defined, then compile dwarf_whatattr.c and > > dwarf_whatform.c > > will cause symbol conflict between > > dwarf_whatattr.c and libdw.h, > > dwarf_whatform.c and libdw.h, > > > > So always undefined __OPTIMIZE__ when compiling these two files > > I don't think this is correct either. Some system headers might depend > on __OPTIMIZE__ being defined. Are you using a compiler that doesn't > define __OPTIMIZE__ ? In debug mode, __OPTIMIZE__ won't be defined. > > Cheers, > > Mark -- 此致 礼 罗勇刚 Yours sincerely, Yonggang Luo
diff --git a/libdw/dwarf_whatattr.c b/libdw/dwarf_whatattr.c index d664b021..59769865 100644 --- a/libdw/dwarf_whatattr.c +++ b/libdw/dwarf_whatattr.c @@ -34,9 +34,10 @@ #include <dwarf.h> #include "libdwP.h" - +#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