Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

*FLAGS-=-flto* in /etc/portage/package.cflags causes emerge --info not to output LDFLAGS #36

Open
blackteahamburger opened this issue Jan 20, 2024 · 3 comments
Labels

Comments

@blackteahamburger
Copy link
Contributor

/etc/portage/make.conf:

source /etc/portage/make.conf.lto.defines

CFLAGS="-march=native -Ofast ${GRAPHITE} ${DEVIRTLTO} ${IPAPTA} ${SEMINTERPOS} ${FLTO} -fuse-linker-plugin -pipe"
CXXFLAGS="${CFLAGS}"
LDFLAGS="${LDFLAGS} -fuse-ld=mold"
...

/etc/portage/make.conf.lto.defines:

FLTO="-flto=${NTHREADS}"
GRAPHITE="-fgraphite-identity -floop-nest-optimize"
IPAPTA="-fipa-pta"
SEMINTERPOS="-fno-semantic-interposition"
DEVIRTLTO="-fdevirtualize-at-ltrans"

/etc/portage/package.cflags/plasma-systemmonitor.conf:

kde-plasma/plasma-systemmonitor *FLAGS-=-flto*

After emerging kde-plasma/plasma-systemmonitor with above:

emerge --info kde-plasma/plasma-systemmonitor:

kde-plasma/plasma-systemmonitor-5.27.10::gentoo was built with the following:
USE="-debug"
CFLAGS="-march=native -Ofast -fgraphite-identity -floop-nest-optimize -fdevirtualize-at-ltrans -fipa-pta -fno-semantic-interposition -fuse-linker-plugin -pipe -Wl,-O1 -Wl,--as-needed -fuse-ld=mold"
CXXFLAGS="-march=native -Ofast -fgraphite-identity -floop-nest-optimize -fdevirtualize-at-ltrans -fipa-pta -fno-semantic-interposition -fuse-linker-plugin -pipe -Wl,-O1 -Wl,--as-needed -fuse-ld=mold"

LDFLAGS is not output. However, without /etc/portage/package.cflags/plasma-systemmonitor.conf, emerge --info kde-plasma/plasma-systemmonitor:

kde-plasma/plasma-systemmonitor-5.27.10::gentoo was built with the following:
USE="-debug"
CFLAGS="-march=native -Ofast -fgraphite-identity -floop-nest-optimize -fdevirtualize-at-ltrans -fipa-pta -fno-semantic-interposition -flto=auto -fuse-linker-plugin -pipe -Wl,-O1 -Wl,--as-needed -fuse-ld=mold"
CXXFLAGS="-march=native -Ofast -fgraphite-identity -floop-nest-optimize -fdevirtualize-at-ltrans -fipa-pta -fno-semantic-interposition -flto=auto -fuse-linker-plugin -pipe -Wl,-O1 -Wl,--as-needed -fuse-ld=mold"
LDFLAGS="-Wl,-O1 -Wl,--as-needed -fuse-ld=mold -march=native -Ofast -fgraphite-identity -floop-nest-optimize -fdevirtualize-at-ltrans -fipa-pta -fno-semantic-interposition -flto=auto -fuse-linker-plugin -pipe"

Is this irrelevant or a bug?

@blackteahamburger blackteahamburger changed the title *FLAGS-=-flto* causes emerge --info not to output LDFLAGS *FLAGS-=-flto* in /etc/portage/package.cflags causes emerge --info not to output LDFLAGS Jan 20, 2024
@vaeth
Copy link
Owner

vaeth commented Jan 20, 2024

If LDFLAGS is not output it means that it is empty.

However, IIUC it should contain -fuse-ld=mold, and when I retry your above setting this is the case (and LDFLAGS is output). So I cannot reproduce the problem: I guess you must have some setting which remove the -fuse-ld=mold from LDFLAGS.

Note that without flto related flags, the C{,XX}FLAGS are by default not copied to LDFLAGS so that it is not surprising that LDFLAGS contains much more data without *FLAGS-=-flto*. But what is surprising is that the -fuse-ld=mold vanishes from LDFLAGS when you have explicitly set it and do not filter it anywhere.

@vaeth vaeth added the wontfix label Jan 20, 2024
@blackteahamburger
Copy link
Contributor Author

However, IIUC it should contain -fuse-ld=mold, and when I retry your above setting this is the case (and LDFLAGS is output). So I cannot reproduce the problem: I guess you must have some setting which remove the -fuse-ld=mold from LDFLAGS.

I'm sure I don't have any settings to remove -fuse-ld=mold.

@vaeth
Copy link
Owner

vaeth commented Jan 21, 2024

Since I cannot reproduce it, I can only give some hints which might help to debug it:

You can try to add some debugging code to the code where the setting is removed, e.g. by putting

BashrcdEcho "some identifier $LDFLAGS"

in various places in the file 10-flag.sh. For instance at the beginning of FlagSetFlags - at this place the variable should have been taken unchanged - and at the beginning and end of FlagParseLine to understand which command perhaps removes it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants