Bug 26585 - gold: call to deprecated mallinfo raises -Werror=deprecated-declarations with latest glibc
Summary: gold: call to deprecated mallinfo raises -Werror=deprecated-declarations with...
Status: RESOLVED FIXED
Alias: None
Product: binutils
Classification: Unclassified
Component: gold (show other bugs)
Version: 2.36
: P2 normal
Target Milestone: ---
Assignee: Cary Coutant
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-09-08 13:43 UTC by Matheus Castanho
Modified: 2021-08-19 06:14 UTC (History)
2 users (show)

See Also:
Host:
Target:
Build:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Matheus Castanho 2020-09-08 13:43:22 UTC
glibc recently deprecated mallinfo and introduced mallinfo2 instead:

https://sourceware.org/git/?p=glibc.git;a=commit;h=e3960d1c57e57f33e0e846d615788f4ede73b945

https://sourceware.org/git/?p=glibc.git;a=commit;h=30e5069c7d4b51288d3e6f75f53a6ad2f5e71b0f

Building binutils with latest glibc causes issues while compiling gold:

/home/tcbot/bot-slave/at/src/at14.0-0.redhat-8_ppc64le_ppc64le/sources/binutils/gold/main.cc: In function ‘int main(int, char**)’:
/home/tcbot/bot-slave/at/src/at14.0-0.redhat-8_ppc64le_ppc64le/sources/binutils/gold/main.cc:294:36: error: ‘mallinfo mallinfo()’ is deprecated [-Werror=deprecated-declarations]
  294 |       struct mallinfo m = mallinfo();
      |                                    ^
In file included from /home/tcbot/bot-slave/at/src/at14.0-0.redhat-8_ppc64le_ppc64le/sources/binutils/gold/main.cc:29:
/home/tcbot/bot-slave/at_opt/at14.0/include/malloc.h:118:24: note: declared here
  118 | extern struct mallinfo mallinfo (void) __THROW __MALLOC_DEPRECATED;
      |                        ^~~~~~~~
Comment 1 Sourceware Commits 2021-03-19 21:23:25 UTC
The master branch has been updated by Cary Coutant <ccoutant@sourceware.org>:

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=4ee60495054b362530a7471d363e00143ecb5cbe

commit 4ee60495054b362530a7471d363e00143ecb5cbe
Author: Duncan Simpson <dr.duncan.p.simpson@gmail.com>
Date:   Fri Mar 19 14:22:08 2021 -0700

    Fix gold to use mallinfo2 if available instead of deprecated mallinfo.
    
    gold/
            PR gold/26585
            * configure.ac: Add check for mallinfo2.
            * configure: Regenerate.
            * main.cc (main): Use mallinfo2 if available.
Comment 2 Cary Coutant 2021-03-19 21:34:00 UTC
Fixed on trunk.
Comment 3 Khem Raj 2021-03-19 21:52:28 UTC
you forgot to regenerate gold/config.in
Comment 4 Sourceware Commits 2021-03-19 22:24:37 UTC
The master branch has been updated by Cary Coutant <ccoutant@sourceware.org>:

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=9331846e44b34c985017264ee58a31b8bf2d5742

commit 9331846e44b34c985017264ee58a31b8bf2d5742
Author: Cary Coutant <ccoutant@gmail.com>
Date:   Fri Mar 19 15:23:49 2021 -0700

    Regenerate config.in, missing from previous commit.
    
            PR gold/26585
            * config.in: Regenerate from previous commit.
Comment 5 Sourceware Commits 2021-03-19 22:30:30 UTC
The master branch has been updated by Cary Coutant <ccoutant@sourceware.org>:

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=cc1849716f5c217a38ee416b48da1914a8ab66cb

commit cc1849716f5c217a38ee416b48da1914a8ab66cb
Author: Cary Coutant <ccoutant@gmail.com>
Date:   Fri Mar 19 15:29:49 2021 -0700

    Fix typo in previous patch: should use struct mallinfo2.
    
            PR gold/26585
            * main.cc (main): Fix typo in previous patch.
Comment 6 Sourceware Commits 2021-08-19 06:14:27 UTC
The binutils-2_36-branch branch has been updated by Alan Modra <amodra@sourceware.org>:

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=212b5b74a073db00569c635cb3d78a4a966a3c84

commit 212b5b74a073db00569c635cb3d78a4a966a3c84
Author: Duncan Simpson <dr.duncan.p.simpson@gmail.com>
Date:   Fri Mar 19 14:22:08 2021 -0700

    Fix gold to use mallinfo2 if available instead of deprecated mallinfo.
    
    gold/
            PR gold/26585
            * configure.ac: Add check for mallinfo2.
            * configure: Regenerate.
            * main.cc (main): Use mallinfo2 if available.
    
            PR gold/26585
            * main.cc (main): Fix typo in previous patch.
    
            PR gold/26585
            * config.in: Regenerate from previous commit.
    
    (cherry picked from commit 4ee60495054b362530a7471d363e00143ecb5cbe)
    (cherry picked from commit cc1849716f5c217a38ee416b48da1914a8ab66cb)
    (cherry picked from commit 9331846e44b34c985017264ee58a31b8bf2d5742)