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

www-client/ungoogled-chromium: Allow specifying linker thread count #332

Open
mrnoname1000 opened this issue Apr 10, 2024 · 3 comments
Open
Labels
enhancement New feature or request

Comments

@mrnoname1000
Copy link

My desktop has 8 cores/16 threads so my MAKEOPTS is set to -j16, but when linking chromium with thinlto enabled, the 32GB of RAM eventually fills up. Could you add an environment variable or other way to specify how many linker threads should be used?

Also, QtWebengine's pre-emerge check multiplies makeopts_jobs by an estimate of the compiler's RAM usage, which if implemented here would prevent the OOM I encountered.

@mrnoname1000 mrnoname1000 added the enhancement New feature or request label Apr 10, 2024
@mrnoname1000 mrnoname1000 changed the title www-client/ungoogled-chromium: Allow specifying thinlto thread count www-client/ungoogled-chromium: Allow specifying linker thread count Apr 10, 2024
@PF4Public
Copy link
Owner

Right now it is kind of hardcoded here:

append-ldflags "-Wl,--thinlto-jobs=$(makeopts_jobs)"

How would you imagine this could be changed?

@mrnoname1000
Copy link
Author

Upon further examination I think the simplest solution would be to scan LDFLAGS for the relevant flag. The value of the flag would probably need to be parsed out if the aforementioned pre-emerge check is implemented, but it would be an easy change to skip the append-ldflags call. I'm not very familiar with the ebuild infrastructure, but [[ " $LDFLAGS " =~ [[:space:]]-Wl,--thinlto-jobs=([[:digit:]]+|all)[[:space:]] ]] should do the trick. $BASH_REMATCH[1] can be used to grab the value too.

As the user, I would modify LDFLAGS like so:

# /etc/portage/package.env
www-client/ungoogled-chromium thinlto-jobs.conf
# /etc/portage/env/thinlto.jobs.conf
LDFLAGS="$LDFLAGS --Wl,--thinlto-jobs=8"

Alternatively, a dedicated environment variable could be used (like LTOTHREADS or something) but I'm not aware of any existing convention for this.

@mrnoname1000
Copy link
Author

mrnoname1000 commented Apr 10, 2024

Just realized -flto=n could also be grepped to avoid the Clang-specific flag. Everything else I mentioned should still apply.

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

No branches or pull requests

2 participants