summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* toolchain-funcs.eclass: add global-scope ewarn for deprecated < EAPI 7Sam James14 days1-4/+8
| | | | Signed-off-by: Sam James <sam@gentoo.org>
* toolchain-funcs.eclass: fix detecting ld.bfdViorel Munteanu2024-08-191-1/+1
| | | | | | | | There is some more output from the compiler here. We must use a regular expression to avoid a false positive from mold. Acked-by: Sam James <sam@gentoo.org> Signed-off-by: Viorel Munteanu <ceamac@gentoo.org>
* toolchain-funcs.eclass: tc-ld-force-bfd: mangle CFLAGS, CXXFLAGS tooSam James2024-08-161-0/+2
| | | | | | | | | | | | | | | | | | This is kind of related to what Ionen mentioned at https://github.com/gentoo/gentoo/pull/28355#discussion_r1033001927 but a bit different. Makefile rules are inconsistent, as are users, and -fuse-ld= might appear in C{,XX}FLAGS, not just LDFLAGS. Append -fuse-ld=bfd there too if asked to force bfd. This might cause problems with Clang because the argument is unused. See the mess in ddba1d149e82dba88b72f992729ad4158f640e32. Not having flag-o-matic here makes things a bit awkward. Let's try the naive approach first because it seemed OK for me with Clang with a quick test. Signed-off-by: Sam James <sam@gentoo.org>
* toolchain-funcs.eclass: _tc-has-openmp: tweak style a bitSam James2024-08-161-2/+3
| | | | Signed-off-by: Sam James <sam@gentoo.org>
* toolchain-funcs.eclass: use generic filename for linker testSam James2024-08-161-4/+4
| | | | | | | | At https://github.com/gentoo/gentoo/pull/28355#discussion_r1089883885, juippis points out that for mold, the test might be confused. Let's consistently use 'linker' instead. Signed-off-by: Sam James <sam@gentoo.org>
* toolchain-funcs.eclass: mark tc-ld-disable-gold as deprecatedSam James2024-08-161-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | I don't think this function makes sense in a world with lld and mold. If there's a bug causing someone to reach for tc-ld-disable-gold, it falls into one of the following: 1. there's bfdisms (like wine where there's no hope) => tc-ld-force-bfd is the correct solution 2. it's a generic problem like underlinking => patch the package please, but in extremis or as a temporary workaround, tc-ld-force-bfd could be used (but discouraged in this situation) 3. it's a gold bug (i.e. the package is definitely only broken with gold) => report the issue upstream or force bfd if the package is truly doing something a bit unusual ("the wine case"), but really, given gold seems to be rotting away, it doesn't appear likely any bugs would get fixed & users shouldn't be enabling it. I also think tc-ld-disable-gold has been used hastily in the past for cases like 2, so let's discourage that in deprecating this as well. Signed-off-by: Sam James <sam@gentoo.org>
* toolchain-funcs.eclass: refine tc-ld-force-bfd descriptionSam James2024-08-161-1/+3
| | | | Signed-off-by: Sam James <sam@gentoo.org>
* toolchain-funcs.eclass: fix tc-ld-force-bfd returning early for unknown linkersSam James2024-08-161-3/+2
| | | | | | | | For say, mold, until now tc-ld-force-bfd actually didn't work, because it bailed early if not lld and not gold (assuming the linker was therefore bfd). Closes: https://bugs.gentoo.org/877539 Signed-off-by: Sam James <sam@gentoo.org>
* toolchain-funcs.eclass: add tc-ld-is-moldSam James2024-08-161-0/+34
| | | | | | | For completeness. Bug: https://bugs.gentoo.org/877539 Signed-off-by: Sam James <sam@gentoo.org>
* toolchain-funcs.eclass: add tc-ld-is-bfdSam James2024-08-161-0/+35
| | | | | | This matches tc-ld-is-gold and tc-ld-is-lld. Signed-off-by: Sam James <sam@gentoo.org>
* eclass/toolchain-funcs: add support for Prefix targetsFabian Groffen2024-08-101-2/+13
| | | | | | | | - support Darwin - support arm64 (Apple Silicon) Darwin - skip gen_usr_ldscript on Prefix targets Signed-off-by: Fabian Groffen <grobian@gentoo.org>
* toolchain-funcs.eclass: Add tc-has-64bit-time_tMichał Górny2024-08-061-1/+11
| | | | | | | | | | Add a helper function to check whether time_t is 64-bit. This could be used e.g. to deselect tests that rely on timestamps exceeding Y2k38. It is meant to be more future-proof than hardcoding a list of 32-bit architectures, given the necessity of switching to 64-bit time_t in the future. Signed-off-by: Michał Górny <mgorny@gentoo.org>
* toolchain-funcs.eclass: Fix tc-is-lto not to leave stray files in TMichał Górny2024-08-061-3/+5
| | | | | | | | | | | | Fix tc-is-lto function to remove the temporary file after testing. Besides being cleaner, this fixes a permission problem when using Paludis and tc-is-lto is used both in pkg_setup() (which creates the temporary file owned by root) and src_*() phase (which attempts to rewrite it as a regular user). Thanks to negril for the report! Signed-off-by: Michał Górny <mgorny@gentoo.org>
* toolchain-funcs.eclass: Add tc-is-lto functionMichał Górny2023-12-261-0/+21
| | | | | | | | | | | | | | | Add a function to check whether the C compiler is using LTO. To determine this, we compile a dummy source unit. In the GCC case, we check whether the resulting object file contains ".gnu.lto*" sections. In the clang case, we check whether a valid LLVM bytecode file was output rather than a regular object. The goal of this change is to reduce the amount of USE=lto abuse, and have a consistent cross-package way of enabling LTO via setting appropriate CFLAGS and CXXFLAGS. Closes: https://github.com/gentoo/gentoo/pull/34470 Signed-off-by: Michał Górny <mgorny@gentoo.org>
* toolchain-funcs.eclass: Add functions to get pointer size in bytesJames Le Cuirot2023-11-131-0/+14
| | | | | | | tc-get-ptr-size for CHOST and tc-get-build-ptr-size for CBUILD. Closes: https://bugs.gentoo.org/328401 Signed-off-by: James Le Cuirot <chewi@gentoo.org>
* toolchain-funcs.eclass: tc-ld-force-bfd: unset LD before calling tc-getLDMike Gilbert2023-11-041-4/+3
| | | | | | | | | | | | | | | | The previous logic would fail with common values of LD set by the user: LD="ld.lld" -> LD="ld.lld.bfd" LD="ld.gold" -> LD="ld.gold.bfd" LD="mold" -> LD="mold.bfd" It makes more sense to ignore the user's LD setting and use the default value given by tc-getLD. If the user doesn't have binutils installed, the "type -P" check will still fail and LD will be unaltered. Signed-off-by: Mike Gilbert <floppym@gentoo.org>
* toolchain-funcs.eclass: add detection for arcMatoro Mahri2023-10-291-0/+3
| | | | | | | | | ARC is bi-endian. Assumes ARCH=arc. No plans to add profiles or keywords to official tree. Signed-off-by: Matoro Mahri <matoro_gentoo@matoro.tk> Closes: https://github.com/gentoo/gentoo/pull/33554 Signed-off-by: Sam James <sam@gentoo.org>
* toolchain-funcs.eclass: Remove outdated reference to tc-has-openmpPetr Vaněk2023-10-011-3/+1
| | | | | | | | | | | | tc-has-openmp function was deprecated in commit 9bc832c6d39b ("toolchain-funcs.eclass: deprecate tc-has-openmp") and later removed in commit eb970274d283 ("toolchain-funcs.eclass: remove tc-has-openmp"). Due to this, the reference to it in the tc-check-openmp function has become redundant and is therefore removed. Signed-off-by: Petr Vaněk <arkamar@atlas.cz> Closes: https://github.com/gentoo/gentoo/pull/32903 Signed-off-by: Sam James <sam@gentoo.org>
* toolchain-funcs.eclass: tc-enables-fortify-source: update for newer libcxxSam James2023-08-181-2/+2
| | | | | | | | Newer libcxx uses _LIBCPP_ENABLE_HARDENED_MODE instead of _LIBCPP_ENABLE_ASSERTIONS which is now deprecated. Bug: https://bugs.gentoo.org/912223 Signed-off-by: Sam James <sam@gentoo.org>
* toolchain-funcs.eclass: cleanup obsolete bits in tc-ld-force-bfdSam James2023-07-301-19/+0
| | | | | | | | | | | | I didn't want to drop this entirely in c26413ae8029f1557aae95b6f8744fc16671fa3b as I wanted to keep it to just fixing the error I'd made, but I don't see the point in keeping this now anyway - non-gcc/clang isn't a thing and if it is I'd hope they'd support -fuse-ld=bfd anyway. Plus it's an obvious approach if we need it for something else like forcing an alt linker that isn't bfd anyway, no need for having cruft remaining. Signed-off-by: Sam James <sam@gentoo.org>
* toolchain-funcs.eclass: shift commentSam James2023-07-301-1/+1
| | | | | | | | | | | | It makes a bit more sense (although still a bit suspicious, wonder if should strip . as well, see c26413ae8029f1557aae95b6f8744fc16671fa3b and bug #911503 where we had 'ld.lld.bd') now with the comment in the right place. It was added originally for bug #545218 (b959fb6c158d4727e85472b3a50af5af3f719972). Bug: https://bugs.gentoo.org/545218 Bug: https://bugs.gentoo.org/911503 Signed-off-by: Sam James <sam@gentoo.org>
* toolchain-funcs.eclass: fix tc-force-bfdSam James2023-07-301-2/+1
| | | | | | | | | | | Before c4e911da66c918bd0944d1457776b82260657cd6, fallback would be false for newer GCC and Clang, not true. Thanks to parona for giving the nudge. Closes: https://bugs.gentoo.org/911503 Fixes: c4e911da66c918bd0944d1457776b82260657cd6 Signed-off-by: Sam James <sam@gentoo.org>
* toolchain-funcs.eclass: cleanup old gcc/clang logic in tc-ld-force-bfdSam James2023-07-221-16/+8
| | | | Signed-off-by: Sam James <sam@gentoo.org>
* toolchain-funcs.eclass: formatting tweaksSam James2023-07-221-11/+13
| | | | Signed-off-by: Sam James <sam@gentoo.org>
* toolchain-funcs.eclass: fix incomplete ninj renameSam James2023-07-211-1/+1
| | | | | | | | | Lost in rebase as kept changing between splitting/unsplitting sparc64*. Thanks to dilfridge & ionen for spotting. Fixes: d1c60c8515d1487149bda90575609a757b8246ef Signed-off-by: Sam James <sam@gentoo.org>
* toolchain-funcs.eclass: tc-ninja_magic_to_arch: rename helper functionSam James2023-07-211-7/+7
| | | | Signed-off-by: Sam James <sam@gentoo.org>
* toolchain-funcs.eclass: drop dead prefix targetsSam James2023-06-101-12/+2
| | | | Signed-off-by: Sam James <sam@gentoo.org>
* toolchain-funcs.eclass: Quote argument of ":" commandUlrich Müller2023-03-261-9/+9
| | | | | | This avoids globbing, see: https://www.shellcheck.net/wiki/SC2223 Signed-off-by: Ulrich Müller <ulm@gentoo.org>
* toolchain-funcs.eclass: document tc-endianSam James2023-02-191-0/+7
| | | | Signed-off-by: Sam James <sam@gentoo.org>
* toolchain-funcs.eclass: remove tc-has-openmpDavid Seifert2023-02-191-10/+0
| | | | Signed-off-by: David Seifert <soap@gentoo.org>
* toolchain-funcs.eclass: consistently pass CPPFLAGS before C{,XX}FLAGSSam James2023-01-301-2/+2
| | | | | | This is generally what we do in patches and such. Signed-off-by: Sam James <sam@gentoo.org>
* toolchain-funcs.eclass: style tweaksSam James2023-01-301-13/+13
| | | | Signed-off-by: Sam James <sam@gentoo.org>
* toolchain-funcs.eclass: include CXXFLAGS in various tc-enables-* checksSam James2023-01-301-4/+4
| | | | | | SSP and PIE are relevant to C++ too. Signed-off-by: Sam James <sam@gentoo.org>
* toolchain-funcs.eclass: add tc-enables-cxx-assertionsSam James2023-01-301-0/+9
| | | | | | Bug: https://bugs.gentoo.org/884417 Bug: https://bugs.gentoo.org/876895 Signed-off-by: Sam James <sam@gentoo.org>
* toolchain-funcs.eclass: add tc-enables-fortify-source for FORTIFY_SOURCESam James2023-01-301-1/+10
| | | | | | | | | | | | As Zero_Chaos reported on IRC, the check we had wasn't good enough in systemd* (before we were able to remove it), as it wouldn't fire for e.g. -Os. While we could've changed it to fail safe (always unset, then set a lower F_S if possible), let's add a proper helper instead to the eclass. Bug: https://bugs.gentoo.org/841770 Bug: https://bugs.gentoo.org/847148 Bug: https://bugs.gentoo.org/876893 Signed-off-by: Sam James <sam@gentoo.org>
* toolchain-funcs.eclass: Promote tc-env_build to a non-internal functionJames Le Cuirot2023-01-031-1/+0
| | | | | | | It's generally useful and already directly used by three packages. I need to use it to fix cross-compiling of LLVM. Signed-off-by: James Le Cuirot <chewi@gentoo.org>
* toolchain-funcs.eclass: Set CHOST within econf_build to fix config.siteJames Le Cuirot2022-12-061-1/+2
| | | | | | | | | | | | We were setting CBUILD within econf_build but not CHOST. crossdev's /usr/share/config.site relies on both of these to decide whether to load configure overrides needed when cross-compiling. Using the wrong overrides leads to packages such as Python failing. Doing this also avoids the need to duplicate the --build and --host configure arguments. Signed-off-by: James Le Cuirot <chewi@gentoo.org>
* toolchain-funcs.eclass: stop using which(1)Sam James2022-12-061-2/+2
| | | | | | | | It's non-portable and we're looking to remove it from @system. Bug: https://bugs.gentoo.org/487696 Bug: https://bugs.gentoo.org/646588 Signed-off-by: Sam James <sam@gentoo.org>
* toolchain-funcs.eclass: fix -Wstrict-prototypes in linker, openmp testsSam James2022-12-061-3/+3
| | | | Signed-off-by: Sam James <sam@gentoo.org>
* toolchain-funcs.eclass: Add tc-get-c-rtlib() to get CC runtimeMichał Górny2022-10-101-0/+28
| | | | | | | | Add a new tc-get-c-rtlib() that attempts to get the runtime used by the current C compiler. Currently it supports compiler-rt and libgcc. Signed-off-by: Michał Górny <mgorny@gentoo.org>
* toolchain-funcs.eclass: Add tc-get-cxx-stdlib() to get C++ stdlibMichał Górny2022-10-101-0/+36
| | | | | | | | Add a new tc-get-cxx-stdlib() that attempts to get the C++ stdlib variant used by the current C++ compiler. Currently it supports libc++ and libstdc++ (GCC's stdlib). Signed-off-by: Michał Górny <mgorny@gentoo.org>
* toolchain-funcs.eclass: Drop support for EAPIs 0 and 5Ulrich Müller2022-07-181-4/+3
| | | | Signed-off-by: Ulrich Müller <ulm@gentoo.org>
* toolchain-funcs.eclass: placate cheesy eclass-to-manpage awkSam James2022-07-161-1/+1
| | | | | | Failed to generate otherwise. But it's nearly gone! Signed-off-by: Sam James <sam@gentoo.org>
* toolchain-funcs.eclass: set LC_ALL=C where appropriateMike Gilbert2022-06-271-0/+6
| | | | | | | | | tc-ld-is-gold and tc-ld-is-lld check the output of ld --version. This output may vary depending on the language selected by the user. Set LC_ALL=C to force English output. Bug: https://bugs.gentoo.org/854147 Signed-off-by: Mike Gilbert <floppym@gentoo.org>
* toolchain-funcs.eclass: document proper tc-check-openmp useDavid Seifert2022-05-161-0/+13
| | | | | | Signed-off-by: David Seifert <soap@gentoo.org> Closes: https://github.com/gentoo/gentoo/pull/25498 Signed-off-by: Sam James <sam@gentoo.org>
* toolchain-funcs.eclass: deprecate tc-has-openmpDavid Seifert2022-05-161-4/+15
| | | | | Signed-off-by: David Seifert <soap@gentoo.org> Signed-off-by: Sam James <sam@gentoo.org>
* toolchain-funcs.eclass: add detection for loongarchWANG Xuerui2021-12-141-0/+2
| | | | | | | | | | | | | | | The Linux port currently under review has arch/loongarch, and should almost certainly remain that way till merge; meanwhile it's ARCH=loong on the Gentoo side, per mailing list discussion[1] and eselect adaptation[2]. This architecture is little-endian-only according to the manual[3]. [1]: https://archives.gentoo.org/gentoo-dev/message/388a4b7428461660e89c8eae8c292f32 [2]: https://gitweb.gentoo.org/proj/eselect.git/commit/?id=a49477f39d3f000cc2ca57f18aafbd66656aba05 [3]: https://github.com/loongson/LoongArch-Documentation/blob/2021.08.17/docs/LoongArch-Vol1-EN/basic-integer-instructions/programming-model-of-basic-integer-instructions/endian.adoc Signed-off-by: WANG Xuerui <git@xen0n.name> Signed-off-by: Sam James <sam@gentoo.org>
* toolchain-funcs.eclass: Support EAPI 8Ulrich Müller2021-06-231-2/+2
| | | | Signed-off-by: Ulrich Müller <ulm@gentoo.org>
* toolchain-funcs.eclass: restore EAPI=0 support used by crossdevSergei Trofimovich2021-06-211-1/+2
| | | | | | Reported-by: Marco Scardovi (scardracs) Bug: https://bugs.gentoo.org/797367 Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
* toolchain-funcs.eclass: fix @SUPPORTED_EAPIS eclassdocSam James2021-06-211-1/+1
| | | | Signed-off-by: Sam James <sam@gentoo.org>