Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 831423 - sys-devel/gcc-12.2.1_p20221210 does not respect LDFLAGS
Summary: sys-devel/gcc-12.2.1_p20221210 does not respect LDFLAGS
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Gentoo Toolchain Maintainers
Keywords: PullRequest
Depends on:
Blocks: ldflags
  Show dependency tree
Reported: 2022-01-18 19:50 UTC by Agostino Sarubbo
Modified: 2023-09-30 09:38 UTC (History)
1 user (show)

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

build.log.xz (build.log.xz,198.26 KB, application/x-xz)
2022-01-18 19:50 UTC, Agostino Sarubbo

Note You need to log in before you can comment on or make changes to this bug.
Description Agostino Sarubbo gentoo-dev 2022-01-18 19:50:14 UTC

Issue: sys-devel/gcc-11.2.1_p20220115 does not respect LDFLAGS.
Discovered on: amd64 (internal ref: ci)

To reproduce this issue you may want to set LDFLAGS="${LDFLAGS} -Wl,--defsym=__gentoo_check_ldflags__=0". If this is not something about c/c++ context you may want to see this bug as an hint to hide the QA warning (with QA_FLAGS_IGNORED) where is not possible to respect LDFLAGS.
Comment 1 Agostino Sarubbo gentoo-dev 2022-01-18 19:50:20 UTC
Created attachment 762520 [details]

build log and emerge --info (compressed because it exceeds attachment limit, use 'xzless' to read it)
Comment 2 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2022-01-18 20:31:39 UTC
I was pretty sure we had a bug for this but I can't find it right now.
Comment 3 Alex Xu (Hello71) 2022-01-19 21:10:26 UTC
(In reply to Sam James from comment #2)
> I was pretty sure we had a bug for this but I can't find it right now.

at least five: ldflags&short_desc_type=allwordssubstr
Comment 4 Agostino Sarubbo gentoo-dev 2022-06-26 08:43:27 UTC
lto_tinderbox has reproduced this issue with version 12.1.1_p20220625 - Updating summary.
Comment 5 Agostino Sarubbo gentoo-dev 2022-08-21 14:46:07 UTC
tinderbox_musl has reproduced this issue with version 12.2.0 - Updating summary.
Comment 6 Agostino Sarubbo gentoo-dev 2022-10-14 06:53:58 UTC
tinderbox_musl has reproduced this issue with version 12.2.1_p20221008 - Updating summary.
Comment 7 Agostino Sarubbo gentoo-dev 2022-12-05 07:47:30 UTC
ci has reproduced this issue with version 12.2.1_p20221203 - Updating summary.
Comment 8 Agostino Sarubbo gentoo-dev 2022-12-11 08:14:53 UTC
ci has reproduced this issue with version 12.2.1_p20221210 - Updating summary.
Comment 9 Larry the Git Cow gentoo-dev 2023-09-30 09:38:53 UTC
The bug has been closed via the following commit(s):

commit bb2d045c02a6ca647ef3280f4987cbc0d14e5a7e
Author:     Sam James <>
AuthorDate: 2023-09-28 23:27:06 +0000
Commit:     Sam James <>
CommitDate: 2023-09-30 09:38:40 +0000

    toolchain.eclass: rework bootstrapping logic
    * Build stage1 compiler with user's CFLAGS. This consistently ends up
      saving at least 15 minutes for me on a fast amd64 machine and should save
      more on slower machines and architectures.
      There's only any risk here if the host compiler is ancient/very buggy and
      even then, you get a failed bootstrap later on. The GCC developers, per the
      linked bug, end up using STAGE1_CFLAGS="-O2" anyway to speed up the process
      so it's not like this is untested at all.
      mattst88 actually brought this up.. 10 years ago (bug #477548). Let's try
      make that right now.
    * Respect LDFLAGS for target libraries for native builds. Not touching this
      for cross builds, at least for now, as it's a bit more delicate.
      (Unfortunately, we have to put a hack in here for now until we can fix
      multilib.eclass - see bug #914881).
    Apologies-to: Matt Turner <>
    Signed-off-by: Sam James <>

 eclass/toolchain.eclass | 52 +++++++++++++++++++++++++++++++++----------------
 1 file changed, 35 insertions(+), 17 deletions(-)