linux-perf-users.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Arnaldo Carvalho de Melo <acme@kernel.org>
To: Adrian Hunter <adrian.hunter@intel.com>
Cc: Vinson Lee <vlee@twopensource.com>,
	Peter Zijlstra <a.p.zijlstra@chello.nl>,
	Ingo Molnar <mingo@redhat.com>,
	Namhyung Kim <namhyung@kernel.org>, Jiri Olsa <jolsa@kernel.org>,
	"Naveen N. Rao" <naveen.n.rao@linux.vnet.ibm.com>,
	Srikar Dronamraju <srikar@linux.vnet.ibm.com>,
	Wang Nan <wangnan0@huawei.com>,
	Victor Kamensky <victor.kamensky@linaro.org>,
	LKML <linux-kernel@vger.kernel.org>,
	linux-perf-users@vger.kernel.org
Subject: Re: Linux 4.3-rc1 build error with older elfutils "util/symbol-elf.c:41:5: error: no previous prototype for ‘elf_getphdrnum’"
Date: Thu, 17 Sep 2015 11:06:19 -0300	[thread overview]
Message-ID: <20150917140619.GK11551@kernel.org> (raw)
In-Reply-To: <55FA5D8F.6000502@intel.com>

Em Thu, Sep 17, 2015 at 09:28:31AM +0300, Adrian Hunter escreveu:
> On 17/09/15 01:10, Vinson Lee wrote:
> > With Linux 4.3-rc1 I get a perf build error using toolchains with
> > older elfutils.
> > 
> > The following build error occurs on both CentOS 5.11 (elfutils 0.137)
> > and Ubuntu 10.04.4 (elfutils 0.143).
> > 
> >   CC       util/symbol-elf.o
> > cc1: warnings being treated as errors
> > util/symbol-elf.c:41: error: no previous prototype for ‘elf_getphdrnum’
> 
> commit f785f2357673d520a0b7b468973cdd197f336494
> removed the 'static' qualifier, presumably because there
> are cases where the prototype is in the header but the function is
> not in the library.
> 
> AFAICT gcc accepts multiple prototypes so long as they are the same
> so just adding the prototype should be ok i.e.

But that looks like a bandaid :-\

The comment I made in f785f2357673d520a0b7b468973cdd197f336494 was not
clear enough, now I'm the one trying to figure out why I did that... Duh
:-\

I.e. if:

"HAVE_ELF_GETPHDRNUM_SUPPORT is false" we shouldn't have any prototype
for that elf_getphdrnum function, i.e. the fact that it is in libelf.h
should mean that it is present, how come the feature test for it failed,
i.e. HAVE_ELF_GETPHDRNUM_SUPPORT wasn't defined?

- Arnaldo
 
> diff --git a/tools/perf/util/symbol-elf.c b/tools/perf/util/symbol-elf.c
> index 53bb5f59ec58..d9abb0307cc5 100644
> --- a/tools/perf/util/symbol-elf.c
> +++ b/tools/perf/util/symbol-elf.c
> @@ -38,6 +38,7 @@ static inline char *bfd_demangle(void __maybe_unused *v,
>  #endif
>  
>  #ifndef HAVE_ELF_GETPHDRNUM_SUPPORT
> +int elf_getphdrnum(Elf *elf, size_t *dst);
>  int elf_getphdrnum(Elf *elf, size_t *dst)
>  {
>  	GElf_Ehdr gehdr;
> 
> 

  reply	other threads:[~2015-09-17 14:06 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-09-16 22:10 Linux 4.3-rc1 build error with older elfutils "util/symbol-elf.c:41:5: error: no previous prototype for ‘elf_getphdrnum’" Vinson Lee
2015-09-17  6:28 ` Adrian Hunter
2015-09-17 14:06   ` Arnaldo Carvalho de Melo [this message]
2015-09-17 14:37     ` Arnaldo Carvalho de Melo
2015-09-17 16:09       ` build tests for older systems [was] " Arnaldo Carvalho de Melo
2015-09-17 16:23       ` Arnaldo Carvalho de Melo

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20150917140619.GK11551@kernel.org \
    --to=acme@kernel.org \
    --cc=a.p.zijlstra@chello.nl \
    --cc=adrian.hunter@intel.com \
    --cc=jolsa@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-perf-users@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=namhyung@kernel.org \
    --cc=naveen.n.rao@linux.vnet.ibm.com \
    --cc=srikar@linux.vnet.ibm.com \
    --cc=victor.kamensky@linaro.org \
    --cc=vlee@twopensource.com \
    --cc=wangnan0@huawei.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).