matoro 29cf769f4d flag-o-matic.eclass: implement append-atomic-flags
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>
2022-07-20 23:35:14 +00:00
2022-07-20 07:55:41 +02:00
2022-07-21 00:10:34 +02:00
2022-07-19 17:11:47 +00:00
2022-07-21 00:10:44 +02:00
2022-07-10 13:50:53 -07:00
2022-07-20 13:53:17 +02:00
2022-07-07 12:27:25 +02:00
2022-07-20 16:13:09 -04:00
2022-07-18 17:49:04 +02:00
2022-07-16 12:27:53 +01:00
2022-07-18 12:50:23 -05:00
2022-07-20 02:53:22 +00:00
2022-07-06 14:56:29 +02:00
2022-07-12 07:56:10 +01:00
2022-07-20 15:59:28 +02:00
2022-07-04 22:33:21 -05:00
2022-07-14 12:06:03 +01:00
S
Description
No description provided
9.8 GiB
Languages
Shell 97.9%
Roff 1.4%
Emacs Lisp 0.2%
C 0.1%