summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* flag-o-matic.eclass: add global-scope ewarn for deprecated < EAPI 7Sam James2024-09-081-4/+8
| | | | Signed-off-by: Sam James <sam@gentoo.org>
* flag-o-matic.eclass: allow -mstrict-align and -mvector-strict-alignLuca Barbato2024-07-051-0/+4
| | | | | | | | | It is needed to make sure vector unaligned load/store aren't inserted when the riscv cpu does not allow them. See https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115789 Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
* flag-o-matic.eclass: allow -mevex512 and -mno-evex512Sam James2024-05-121-0/+2
| | | | | | | | The whole -m/-mno-* situation needs to be improved in the eclass but let's do this for now for the benefit of Chromium (see 754d6f5226a532ed086afa276b48e89ffafe0484). Bug: https://bugs.gentoo.org/931623 Signed-off-by: Sam James <sam@gentoo.org>
* flag-o-matic.eclass: simplify implementation and work in all casesEli Schwartz2024-03-291-61/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | It curently uses some magic test to decide whether handcrafted code works with or without -latomic. But it can claim that -latomic is not needed for that case, while it is still needed for other cases. > okay so append-atomic-flags does not work for me in this case > noise-suppression-for-voice is doing `struct RnNoiseStats { uint32_t a, b, c, d; }; std::atomic<RnNoiseStats> m_stats;` > not just a single large integer It is simplest to always add -latomic when an ebuild gets that deep feeling that yeah, it would like some atomics please. The downsides to listing a linker library are exactly: - it might be unavailable - it might be unneeded And the former case is trivial to solve -- this function already does so -- while the latter case has a sanctioned approach that is already used for other intrinsic compiler libraries, but not for atomic "because the build system would have a hard time if we had to build atomic early on" which isn't a very good reason to break ebuilds which aren't building sys-devel/gcc. As a side benefit, we now handle -latomic such that a package which requires it, but only for parts of the installed package, does not overlink to libatomic in *all* binaries/libraries, even if the default LDFLAGS are overridden and the global -Wl,--as-needed disappears. Bug: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81358 Bug: https://bugs.gentoo.org/820101 Bug: https://bugs.gentoo.org/925672 Signed-off-by: Eli Schwartz <eschwartz93@gmail.com> Signed-off-by: Sam James <sam@gentoo.org>
* flag-o-matic.eclass: fix botched MIPS revertSam James2024-02-121-4/+3
| | | | | | | | | | This fixes commit cf366abd1bd50a33755734bbfb8c0e8a49a5480e and is a proper revert of cf366abd1bd50a33755734bbfb8c0e8a49a5480e and fad75a344cbaada57ae490c3e8f88cdd5b35dadc. Bug: https://gcc.gnu.org/PR112782 Bug: https://sourceware.org/PR13509 Closes: https://bugs.gentoo.org/921104 Signed-off-by: Sam James <sam@gentoo.org>
* Revert "flag-o-matic.eclass: allow further MIPS errata flags"Sam James2024-01-271-5/+2
| | | | | | | | | | | | | This reverts commit cf366abd1bd50a33755734bbfb8c0e8a49a5480e. This reverts commit fad75a344cbaada57ae490c3e8f88cdd5b35dadc. There's a bug in gas where it messes up labels in the presence of some of these errata flags. Bug: https://gcc.gnu.org/PR112782 Bug: https://sourceware.org/PR13509 Closes: https://bugs.gentoo.org/921104 Signed-off-by: Sam James <sam@gentoo.org>
* flag-o-matic.eclass: allow -fdebug-default-version=*Sam James2023-12-231-0/+1
| | | | | | | Reported by leio. We need this for e.g. Clang to produce output that debugedit is happy with. Signed-off-by: Sam James <sam@gentoo.org>
* flag-o-matic.eclass: allow -mtls-dialect=* through filterSam James2023-12-141-0/+4
| | | | | | | | | | Most arches have this set anyway but amd64 is likely to switch to gnu2 finally as well [0] so let's allow testing with it (and reverting to the old default once it changes) by allowing -mtls-dialect=* through the filter. [0] https://inbox.sourceware.org/gcc/871qbqp4of.fsf@oldenburg.str.redhat.com/ Signed-off-by: Sam James <sam@gentoo.org>
* flag-o-matic.eclass: Replace eutils inherit by eqawarn in EAPI 6Ulrich Müller2023-12-081-1/+1
| | | | | Reviewed-by: David Seifert <soap@gentoo.org> Signed-off-by: Ulrich Müller <ulm@gentoo.org>
* flag-o-matic.eclass: allow further MIPS errata flagsSam James2023-11-211-3/+9
| | | | | | | | | | | | | | | | * We were missing 24k, r5900, vr4120, vr4130, sb1 [0]. * Chuck in -Wa,-mfix-loongson2f-nop while at it. The topic of -Wa,* is an interesting one, as we currently allow -Wl,*, so we should probably do the same for the assembler, but punt that to another time. Note that we use r5900 and -Wa,-mfix-loongson2f-nop for building stages... Prompted by discussion with immolo (see also fad75a344cbaada57ae490c3e8f88cdd5b35dadc). [0] https://gcc.gnu.org/onlinedocs/gcc/MIPS-Options.html#index-mfix-24k (and below) Signed-off-by: Sam James <sam@gentoo.org>
* flag-o-matic.eclass: allow -mfix-r5900 errata flag for MIPSSam James2023-11-211-1/+2
| | | | | | Reported by immolo. Signed-off-by: Sam James <sam@gentoo.org>
* flag-o-matic.eclass: allow -fno-harden-control-flow-redundancy tooSam James2023-10-261-2/+2
| | | | Signed-off-by: Sam James <sam@gentoo.org>
* flag-o-matic.eclass: add '-mfpmath=*'Sam James2023-10-211-1/+1
| | | | | | We set this for x86 multilib profiles. Signed-off-by: Sam James <sam@gentoo.org>
* flag-o-matic.eclass: add '-mharden-sls=*'Sam James2023-10-211-0/+1
| | | | | | Spectre-style mitigation. Signed-off-by: Sam James <sam@gentoo.org>
* flag-o-matic.eclass: add -mpreferred-stack-boundary=*, ↵Sam James2023-10-211-0/+2
| | | | | | | | | -mincoming-stack-boundary=* Wine may use this and it's in the same league as -mstackrealign in that it affects ABI. Signed-off-by: Sam James <sam@gentoo.org>
* flag-o-matic.eclass: allow hardened compare/control flow flagsSam James2023-10-211-0/+4
| | | | Signed-off-by: Sam James <sam@gentoo.org>
* flag-o-matic.eclass: allow --unwindlib/--rtlib/--stdlib tooSam James2023-10-051-0/+6
| | | | | | | We may want to gate these just for Clang but they (at least --stdlib) affect ABI so we shouldn't be filtering these. Signed-off-by: Sam James <sam@gentoo.org>
* flag-o-matic.eclass: allow -mbranch-protection=*Sam James2023-10-051-0/+1
| | | | | | Newer arm64 HW has this. Signed-off-by: Sam James <sam@gentoo.org>
* flag-o-matic.eclass: allow -mno-omit-leaf-frame-pointerSam James2023-10-051-0/+1
| | | | | | Just like -fno-omit-frame-pointer. Signed-off-by: Sam James <sam@gentoo.org>
* flag-o-matic.eclass: handle C++ assertions and FORTIFY_SOURCE in ↵Sam James2023-08-181-0/+10
| | | | | | _filter-hardened Signed-off-by: Sam James <sam@gentoo.org>
* flag-o-matic.eclass: recognize -fstack-protector-strong in _filter-hardenedSam James2023-08-181-2/+2
| | | | Signed-off-by: Sam James <sam@gentoo.org>
* flag-o-matic.eclass: update _filter-hardenedSam James2023-08-181-6/+20
| | | | | | | | | | | _filter-hardened is used by filter-flags to negate defaults, e.g. it makes filter-flags -fstack-protector correctly then disable -fstack-protector as well if the toolchain enables SSP by default. Modernise the tests it uses with the tc-enables-* functions rather than just gcc-specs-*. We haven't done hardening via specs for ages. Signed-off-by: Sam James <sam@gentoo.org>
* flag-o-matic.eclass: Don't inherit eutils in EAPI 7Ulrich Müller2023-06-161-1/+1
| | | | | | | None of the ebuilds inheriting flag-o-matic in EAPI 7 needs any of the remaining eutils features. Signed-off-by: Ulrich Müller <ulm@gentoo.org>
* flag-o-matic.eclass: allow -fno-lto too in strip-flagsSam James2023-05-071-1/+1
| | | | | | | Ionen rightly points out that people might have -flto by default and -fno-lto in package.env. Signed-off-by: Sam James <sam@gentoo.org>
* flag-o-matic.eclass: add -Oz to ALLOWED_FLAGS (strip-flags whitelist)Sam James2023-05-071-1/+1
| | | | | | We already allow -Os and -Oz is just a more aggressive version of that. Signed-off-by: Sam James <sam@gentoo.org>
* flag-o-matic.eclass: add -flto, -flto=* to ALLOWED_FLAGS (strip-flags whitelist)Sam James2023-05-071-0/+1
| | | | | | | LTO is pretty safe nowadays and packages broken with it should really use filter-lto specifically instead. Signed-off-by: Sam James <sam@gentoo.org>
* flag-o-matic.eclass: drop -fstack-check from ALLOWED_FLAGS (strip-flags ↵Sam James2023-05-071-1/+0
| | | | | | | | | | | | | | | | whitelist) -fstack-check is _not_ a safe flag: * https://developers.redhat.com/blog/2017/09/25/stack-clash-mitigation-gcc-background * https://developers.redhat.com/blog/2019/04/30/stack-clash-mitigation-in-gcc-why-fstack-check-is-not-the-answer Nobody is really interested in maintaining this functionality upstream in GCC anymore for this reason, it's not IIRC supported in Clang, and we're not testing it either. Please use the far superior -fstack-clash-protection instead. Signed-off-by: Sam James <sam@gentoo.org>
* flag-o-matic.eclass: add -O3 to ALLOWED_FLAGS (strip-flags whitelist)Sam James2023-05-071-1/+1
| | | | | | | | | | -O3 is perfectly safe in the absence of UB. And with UB, -O2 and friends can easily break with new compiler versions and such anyway. In addition, I'd say that -O/-O1 is probably as risky as -O3 nowadays, if not more, because if nothing else, you don't get a bunch of hardening. Signed-off-by: Sam James <sam@gentoo.org>
* flag-o-matic.eclass: rename _test-compile-PROG, expose externallyMatoro Mahri2023-03-221-8/+7
| | | | | | | | | Rename _test-compile-PROG to test-compile and expose externally for ebuilds to consume if desired. Bug: https://bugs.gentoo.org/897976 Signed-off-by: Matoro Mahri <matoro@users.noreply.github.com> Signed-off-by: Sam James <sam@gentoo.org>
* flag-o-matic.eclass: fix -Wstrict-prototypes in append-atomic-flagsSam James2022-12-061-2/+2
| | | | Signed-off-by: Sam James <sam@gentoo.org>
* flag-o-matic.eclass: test-flag-PROG, strip unused args that generate warningsAlexander Miller2022-08-241-11/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | A number of configure checks used by CMake and autoconf (and probably other build systems) relies on warning-free compiler runs. A combination of compiler and flags that always generates warnings can cause misconfiguration and/or build failures. Since commit ae9870d9f6b1394ede86176443770b36d7e60ac1, flags that generate warnings that could be suppressed with -Qunused-arguments are accepted anyway to avoid stripping all linker flags (#627474). But commit 28d6437fc7009002f98f28e8900e994109927726 added linker invocation for linker flags tests, so the workaround shouldn't be necessary any more. Drop the extra -Qunused-arguments check and reject all flags that generate warnings to avoid configuration issues. If it turns out that stripping these unused flags is still problematic, we could accept them and actually add -Qunused-arguments to the relevant *FLAGS to silence the warnings, but that would require bigger changes, so let's try the simpler and cleaner solution first. Bug: https://bugs.gentoo.org/627474 Bug: https://bugs.gentoo.org/714742 Bug: https://bugs.gentoo.org/862798 Signed-off-by: Alexander Miller <alex.miller@gmx.de> Closes: https://github.com/gentoo/gentoo/pull/26773 Signed-off-by: Sam James <sam@gentoo.org>
* flag-o-matic.eclass: respect -fuse-ld in test-flags-CCLDSam James2022-07-261-0/+9
| | | | | Closes: https://bugs.gentoo.org/832377 Signed-off-by: Sam James <sam@gentoo.org>
* flag-o-matic.eclass: add bug references re -Qunused-argumentsSam James2022-07-261-1/+3
| | | | | | | | | To ensure we pay attention to these if changing in future (like I've been wondering about) Bug: https://bugs.gentoo.org/712488 Bug: https://bugs.gentoo.org/714742 Signed-off-by: Sam James <sam@gentoo.org>
* flag-o-matic.eclass: minor style tweaksSam James2022-07-261-9/+11
| | | | Signed-off-by: Sam James <sam@gentoo.org>
* flag-o-matic.eclass: fix typo in commentSam James2022-07-261-1/+1
| | | | Signed-off-by: Sam James <sam@gentoo.org>
* flag-o-matic.eclass: fix @DESCRIPTION tagSam James2022-07-201-1/+2
| | | | Signed-off-by: Sam James <sam@gentoo.org>
* flag-o-matic.eclass: implement append-atomic-flagsmatoro2022-07-201-0/+145
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | My take on implementing bug 820101 as conservatively as possible. This will append -latomic only when absolutely necessary (even though it's probably not required to be that conservative due to our use of --as-needed). This will take flags into account when testing as well. For example, if you compile with -march=i386, this would require linking libatomic even if the same toolchain with a higher -march level would not require it. So rebuilding the same package with the same flags may change whether -latomic is linked at build time if the CFLAGS change. Another instance might be switching from GCC to clang - the former requires explicitly linking -latomic, while the latter does not even HAVE libatomic (see bug 820095) as all atomic intrinsics are built-in internally. This function would safely detect this and not append -latomic. There is an optional parameter [bytes]. You can use this if you want to be specific about what size atomic support is required. For example, there are several platforms like MIPS where the 32-bit version has 1-, 2-, and 4-byte atomics builtin but requires libatomic linkage for 8-byte atomics. If your program only requires, say, 4-byte atomics, you can use append-atomic-flags 4 and this will then not attempt to link libatomic on 32-bit MIPS. I tested using this to solve bug 688574 on 32-bit SPARC. Bug: https://bugs.gentoo.org/688574 Bug: https://bugs.gentoo.org/820095 Closes: https://bugs.gentoo.org/820101 Closes: https://github.com/gentoo/gentoo/pull/26334 Signed-off-by: Sam James <sam@gentoo.org>
* flag-o-matic.eclass: Drop support for EAPI 5Ulrich Müller2022-07-181-9/+8
| | | | Signed-off-by: Ulrich Müller <ulm@gentoo.org>
* flag-o-matic.eclass: add filter-lto functionJannik Glückert2022-06-281-0/+8
| | | | | | | Bug: https://bugs.gentoo.org/618550 Closes: https://github.com/gentoo/gentoo/pull/26036 Signed-off-by: Jannik Glückert <jannik.glueckert@gmail.com> Signed-off-by: Sam James <sam@gentoo.org>
* flag-o-matic.eclass: allow -frecord-command-lineSam James2022-01-221-0/+1
| | | | | | In Clang, -frecord-gcc-switches does the same as this anyway. Signed-off-by: Sam James <sam@gentoo.org>
* flag-o-matic.eclass: allow -fstack-clash-protection, -fcf-protection=*Sam James2022-01-221-0/+2
| | | | | | | -fstack-clash-protection suggested by Arfrever. Reported-by: Arfrever Frehtes Taifersar Arahesis <Arfrever@Apache.Org> Signed-off-by: Sam James <sam@gentoo.org>
* flag-o-matic.eclass: allow -ffixed-x18 for arm64Sam James2022-01-221-0/+3
| | | | | | | | Needed for shadow stack bits on ARM64. Closes: https://bugs.gentoo.org/800533 Thanks-to: Jannik Glückert <jannik.glueckert@gmail.com> Signed-off-by: Sam James <sam@gentoo.org>
* flag-o-matic.eclass: allow -glldbSam James2022-01-221-0/+1
| | | | | | | | We already allow -ggdb for GDB and this is the analogue for LLDB. Bug: https://bugs.gentoo.org/800533 Reported-by: Jannik Glückert <jannik.glueckert@gmail.com> Signed-off-by: Sam James <sam@gentoo.org>
* flag-o-matic.eclass: allow Spectre mitigation flagsSam James2022-01-221-0/+5
| | | | | Closes: https://bugs.gentoo.org/646076 Signed-off-by: Sam James <sam@gentoo.org>
* flag-o-matic.eclass: restructure comments a bitSam James2022-01-221-4/+11
| | | | | | No functional change. Signed-off-by: Sam James <sam@gentoo.org>
* flag-o-matic.eclass: allow -fno-diagnostics-color -fmessage-length=0Sam James2022-01-221-0/+2
| | | | | | | | | Both of these options are useful for automated reports and should be harmless. Closes: https://bugs.gentoo.org/830534 Reported-by: Agostino Sarubbo <ago@gentoo.org> Signed-off-by: Sam James <sam@gentoo.org>
* flag-o-matic.eclass: strip-flags: Fix logic to properly support "=" in patterns.Arfrever Frehtes Taifersar Arahesis2022-01-221-12/+11
| | | | | Signed-off-by: Arfrever Frehtes Taifersar Arahesis <Arfrever@Apache.Org> Signed-off-by: Sam James <sam@gentoo.org>
* flag-o-matic.eclass: filter-lfs-flags: remove -D_TIME_BITS=64Mike Gilbert2021-12-181-1/+2
| | | | | | glibc only allows _TIME_BITS=64 when _FILE_OFFSET_BITS=64. Signed-off-by: Mike Gilbert <floppym@gentoo.org>
* flag-o-matic.eclass: Support EAPI 8Ulrich Müller2021-06-231-2/+2
| | | | Signed-off-by: Ulrich Müller <ulm@gentoo.org>
* flag-o-matic.eclass: allow -fno-sanitize* optionsSergei Trofimovich2021-05-081-1/+3
| | | | | | | | | | We already allow -fsanitize* options. Sometimes it's useful to enable -fsanitize= globally and disable ir in a few ebuilds. The change allows passing -fno-sanitize=all an similar to achieve that effect. Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>