Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 707830 - dev-util/perf-? with >=sys-libs/binutils-libs-2.34 - util/srcline.c:200:7: error: implicit declaration of function 'bfd_get_section_flags'; did you mean 'bfd_set_section_flags'? [-Werror=implicit-function-declaration]
Summary: dev-util/perf-? with >=sys-libs/binutils-libs-2.34 - util/srcline.c:200:7: er...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Naohiro Aota
URL:
Whiteboard: ~arch only
Keywords: PATCH
: 707910 (view as bug list)
Depends on:
Blocks: binutils-2.34
  Show dependency tree
 
Reported: 2020-02-02 00:17 UTC by Holger Hoffstätte
Modified: 2020-07-29 18:31 UTC (History)
13 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
Temporary compile fix (perf-5.4.15-binutils-2.34.patch,519 bytes, patch)
2020-02-02 00:27 UTC, Holger Hoffstätte
Details | Diff
perf-5.4.7-binutils-2.34-fixedpaths.patch (perf-5.4.7-binutils-2.34-fixedpaths.patch,812 bytes, patch)
2020-02-08 08:00 UTC, Märt Bakhoff
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Holger Hoffstätte 2020-02-02 00:17:46 UTC
After upgrading to binutils-libs-2.34 perf fails to build since several accessor macros were removed.


Reproducible: Always

Steps to Reproduce:
1. upgrade to binutils-libs-2.34
2. try to rebuild perf
3. failure
Actual Results:  
util/srcline.c: In function 'find_address_in_section':
util/srcline.c:200:7: error: implicit declaration of function 'bfd_get_section_flags'; did you mean 'bfd_set_section_flags'? [-Werror=implicit-function-declaration]
  200 |  if ((bfd_get_section_flags(abfd, section) & SEC_ALLOC) == 0)
      |       ^~~~~~~~~~~~~~~~~~~~~
      |       bfd_set_section_flags
util/srcline.c:200:7: error: nested extern declaration of 'bfd_get_section_flags' [-Werror=nested-externs]
util/srcline.c:204:8: error: implicit declaration of function 'bfd_get_section_vma'; did you mean 'bfd_set_section_vma'? [-Werror=implicit-function-declaration]
  204 |  vma = bfd_get_section_vma(abfd, section);
      |        ^~~~~~~~~~~~~~~~~~~
      |        bfd_set_section_vma
util/srcline.c:204:8: error: nested extern declaration of 'bfd_get_section_vma' [-Werror=nested-externs]
util/srcline.c:205:9: error: implicit declaration of function 'bfd_get_section_size'; did you mean 'bfd_set_section_size'? [-Werror=implicit-function-declaration]
  205 |  size = bfd_get_section_size(section);
      |         ^~~~~~~~~~~~~~~~~~~~
      |         bfd_set_section_size
util/srcline.c:205:9: error: nested extern declaration of 'bfd_get_section_size' [-Werror=nested-externs]

The macros were removed in commit https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;a=commit;h=fd3619828e94a24a92cddec42cbc0ab33352eeb4 without backwards-compatiblee replacement. perf builds fine & seems to work when changing the source to use the intended functions like bfd_section_{flags,size,vma} and removing the first (now redundant) argument, but obviously this requires manual source changes.


Expected Results:  
Sucessful build.

Mostly providing this for reference since it should be fixed upstream.
Comment 1 Holger Hoffstätte 2020-02-02 00:27:03 UTC
Created attachment 610708 [details, diff]
Temporary compile fix

This patch restores the macros in a backwards-compatible manner until upstream
has been properly fixed. Result seems to work for me (quick test only).
Comment 2 Sergei Trofimovich (RETIRED) gentoo-dev 2020-02-02 11:54:39 UTC
yeah, binutils-2.34 will need some porting for downstream users: https://bugs.gentoo.org/707898
Comment 3 Holger Hoffstätte 2020-02-02 12:23:52 UTC
I notified Arnaldo Carvalho de Melo last night and a fix is on its way to
mainline:

https://git.kernel.org/pub/scm/linux/kernel/git/acme/linux.git/commit/?id=0ada120c883d
Comment 4 Märt Bakhoff 2020-02-08 08:00:54 UTC
Created attachment 612634 [details, diff]
perf-5.4.7-binutils-2.34-fixedpaths.patch

The patches by Holger failed to apply for me: "can't find file to patch". Replacing a/tools/perf/util/srcline.c with a/util/srcline.c fixed the issue. Attaching a new patch based on the upstream fix that can simply be dropped into /etc/portage/patches/dev-util/perf. 

Thanks for linking the upstream fix!
Comment 5 Holger Hoffstätte 2020-02-08 10:12:06 UTC
(In reply to Märt Bakhoff from comment #4)
> The patches by Holger failed to apply for me: "can't find file to patch".

Probably because I added the patch to my local ebuild, not into /etc/portage/patches. It's a common problem when user-patches and bundled patches are applied in different working directories.
Comment 6 Dennis Schridde 2020-02-08 16:54:09 UTC
(In reply to Holger Hoffstätte from comment #3)
> I notified Arnaldo Carvalho de Melo last night and a fix is on its way to
> mainline:
> 
> https://git.kernel.org/pub/scm/linux/kernel/git/acme/linux.git/commit/
> ?id=0ada120c883d

Patch works, after removing "tools/perf/" from the paths.
Comment 7 Jeroen Roovers (RETIRED) gentoo-dev 2020-02-10 10:47:38 UTC
*** Bug 707910 has been marked as a duplicate of this bug. ***
Comment 8 Larry the Git Cow gentoo-dev 2020-02-15 16:05:00 UTC
The bug has been closed via the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=95244db839bb931271d1b430c0b39ef482e6b0f5

commit 95244db839bb931271d1b430c0b39ef482e6b0f5
Author:     Yixun Lan <dlan@gentoo.org>
AuthorDate: 2020-02-15 16:01:22 +0000
Commit:     Yixun Lan <dlan@gentoo.org>
CommitDate: 2020-02-15 16:04:23 +0000

    dev-util/perf: make perf build with both old and new libbfd
    
    patch from upstream, this would make it build with binutils-2.34 again
    
    Closes: https://bugs.gentoo.org/707830
    Package-Manager: Portage-2.3.89, Repoman-2.3.20
    Signed-off-by: Yixun Lan <dlan@gentoo.org>

 dev-util/perf/Manifest                             |   1 +
 .../perf/files/perf-5.4.20-binutil-libs-2.34.patch |  60 +++++
 dev-util/perf/perf-5.4.20.ebuild                   | 246 +++++++++++++++++++++
 3 files changed, 307 insertions(+)