Forums

Skip to content

Advanced search
  • Quick links
    • Unanswered topics
    • Active topics
    • Search
  • FAQ
  • Login
  • Register
  • Board index Assistance Portage & Programming
  • Search

Confusion about COMMON_FLAGS in LDFLAGS

Problems with emerge or ebuilds? Have a basic programming question about C, PHP, Perl, BASH or something else?
Post Reply
Advanced search
2 posts • Page 1 of 1
Author
Message
beastrabban
n00b
n00b
Posts: 6
Joined: Wed Feb 18, 2026 4:34 pm

Confusion about COMMON_FLAGS in LDFLAGS

  • Quote

Post by beastrabban » Sun Mar 15, 2026 12:59 am

Hi all,

In the Gentoo Wiki page for LTO, I'm confused why it recommends to add COMMON_FLAGS to LDFLAGS:

Code: Select all

LDFLAGS="${COMMON_FLAGS} ${LDFLAGS}"
In the Wiki page for GCC Optimization, it says
The Gentoo developers have already set basic, safe LDFLAGS in the base profiles, so they do not need to be changed.
Is there a reason why "-march=native -O2 -pipe -flto" should be appended to LDFLAGS when LTO is enabled? Or is the advice on the LTO page outdated?

Thanks in advance.
Top
sam_
Developer
Developer
User avatar
Posts: 2814
Joined: Fri Aug 14, 2020 12:33 am

  • Quote

Post by sam_ » Sun Mar 15, 2026 5:55 am

The advice on the LTO page is correct, see https://gcc.gnu.org/onlinedocs/gcc/Opti ... index-flto
GCC docs wrote: To use the link-time optimizer, -flto and optimization options should be specified at compile time and during the final link. It is recommended that you compile all the files participating in the same link with the same options and also specify those options at link time.
(and some other text in that section to the same effect).

The "GCC Optimization" wiki page is saying what it does because it means you don't need to go digging through the ld(1) man page to find options to add.
Top
Post Reply

2 posts • Page 1 of 1

Return to “Portage & Programming”

Jump to
  • Assistance
  • ↳   News & Announcements
  • ↳   Frequently Asked Questions
  • ↳   Installing Gentoo
  • ↳   Multimedia
  • ↳   Desktop Environments
  • ↳   Networking & Security
  • ↳   Kernel & Hardware
  • ↳   Portage & Programming
  • ↳   Gamers & Players
  • ↳   Other Things Gentoo
  • ↳   Unsupported Software
  • Discussion & Documentation
  • ↳   Documentation, Tips & Tricks
  • ↳   Gentoo Chat
  • ↳   Gentoo Forums Feedback
  • ↳   Duplicate Threads
  • International Gentoo Users
  • ↳   中文 (Chinese)
  • ↳   Dutch
  • ↳   Finnish
  • ↳   French
  • ↳   Deutsches Forum (German)
  • ↳   Diskussionsforum
  • ↳   Deutsche Dokumentation
  • ↳   Greek
  • ↳   Forum italiano (Italian)
  • ↳   Forum di discussione italiano
  • ↳   Risorse italiane (documentazione e tools)
  • ↳   Polskie forum (Polish)
  • ↳   Instalacja i sprzęt
  • ↳   Polish OTW
  • ↳   Portuguese
  • ↳   Documentação, Ferramentas e Dicas
  • ↳   Russian
  • ↳   Scandinavian
  • ↳   Spanish
  • ↳   Other Languages
  • Architectures & Platforms
  • ↳   Gentoo on ARM
  • ↳   Gentoo on PPC
  • ↳   Gentoo on Sparc
  • ↳   Gentoo on Alternative Architectures
  • ↳   Gentoo on AMD64
  • ↳   Gentoo for Mac OS X (Portage for Mac OS X)
  • Board index
  • All times are UTC
  • Delete cookies

© 2001–2026 Gentoo Foundation, Inc.

Powered by phpBB® Forum Software © phpBB Limited

Privacy Policy

 

 

magic