Github messages for voidlinux
 help / color / mirror / Atom feed
* [ISSUE] [RFC] How to progress with gcc and libatomic
@ 2022-03-05 12:54 leahneukirchen
  2022-03-06  1:19 ` the-maldridge
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: leahneukirchen @ 2022-03-05 12:54 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 2508 bytes --]

New issue by leahneukirchen on void-packages repository

https://github.com/void-linux/void-packages/issues/35992

Description:
I'm suggesting this change because I want to bring the RISC-V port forward, but the problem also affects us already on armv6 in some way.

In short: for certain operations, gcc generates calls to its own library of atomic functions, `libatomic`.  Where exactly depends on the architecture and how powerful the instruction-set atomics are, but for example:

- On aarch64 and x86_64, for atomic 128-bit ints or double complex numbers.
- On armv6, for any C11 _Atomic integer type.
- On RISC-V 64-bit, for *any* code that uses `-pthread`.

The problem is: gcc doesn't link against libatomic automatically in these cases.

Code that uses more than 64-bit atomics usually uses libatomic upstream (because all platforms are affected), so this is not our problem.

For armv6 and other platforms, we currently use `$XBPS_TARGET_NO_ATOMIC8` in roughly 150 templates.  This is annoying, but bearable, and we did the work already.

For RISC-V, this is unacceptable, as we need to touch way too many templates to adjust every package using pthreads.

I therefore suggest a two-step solution:
1. Add `libatomic-devel` as a `depends=` of gcc.  This will ensure code that knows it needs `-latomic` will just work without further changes.   As `libatomic-devel` is a small subpackage of gcc, this doesn't   change else much.  It requires just a rebuild of gcc.
2. Import the `--enable-autolink-libatomic` [patch](https://git.alpinelinux.org/aports/tree/main/gcc/0039-configure-Add-enable-autolink-libatomic-use-in-LINK_.patch).   This patch links to libatomic automatically, as needed.   I'd suggest to enable it for the $XBPS_TARGET_NO_ATOMIC8 platforms   by default, and RISC-V in the future.   This patch is not merged upstream, but some distros use it,   for example Alpine.  It is also quite small so should not be much   additional maintenance.

   There is one caveat with the patch, in that it breaks building libatomic itself :clown_face:, so we also need [this Alpine patch](https://git.alpinelinux.org/aports/tree/main/gcc/0040-configure-fix-detection-of-atomic-builtins-in-libato.patch).   This requires a full rebuild of all affected cross toolchains.

As a result, after step one, we can gradually remove all
```
if [ "$XBPS_TARGET_NO_ATOMIC8" ]; then
        makedepends+=" libatomic-devel"
fi
```
and after step two, also all `LDFLAGS+=" -latomic"`.


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [RFC] How to progress with gcc and libatomic
  2022-03-05 12:54 [ISSUE] [RFC] How to progress with gcc and libatomic leahneukirchen
@ 2022-03-06  1:19 ` the-maldridge
  2022-03-06 12:13 ` leahneukirchen
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: the-maldridge @ 2022-03-06  1:19 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 245 bytes --]

New comment by the-maldridge on void-packages repository

https://github.com/void-linux/void-packages/issues/35992#issuecomment-1059868182

Comment:
Sounds reasonable to me, has upstream provided a reason for the two patches to not be accepted?

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [RFC] How to progress with gcc and libatomic
  2022-03-05 12:54 [ISSUE] [RFC] How to progress with gcc and libatomic leahneukirchen
  2022-03-06  1:19 ` the-maldridge
@ 2022-03-06 12:13 ` leahneukirchen
  2022-06-27  2:16 ` github-actions
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: leahneukirchen @ 2022-03-06 12:13 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 217 bytes --]

New comment by leahneukirchen on void-packages repository

https://github.com/void-linux/void-packages/issues/35992#issuecomment-1059951728

Comment:
They were submitted in 2020 and ignored after a few suggestions...

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [RFC] How to progress with gcc and libatomic
  2022-03-05 12:54 [ISSUE] [RFC] How to progress with gcc and libatomic leahneukirchen
  2022-03-06  1:19 ` the-maldridge
  2022-03-06 12:13 ` leahneukirchen
@ 2022-06-27  2:16 ` github-actions
  2022-09-26  2:15 ` github-actions
  2023-01-12 21:55 ` Johnnynator
  4 siblings, 0 replies; 6+ messages in thread
From: github-actions @ 2022-06-27  2:16 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 293 bytes --]

New comment by github-actions[bot] on void-packages repository

https://github.com/void-linux/void-packages/issues/35992#issuecomment-1166754572

Comment:
Issues become stale 90 days after last activity and are closed 14 days after that.  If this issue is still relevant bump it or assign it.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [RFC] How to progress with gcc and libatomic
  2022-03-05 12:54 [ISSUE] [RFC] How to progress with gcc and libatomic leahneukirchen
                   ` (2 preceding siblings ...)
  2022-06-27  2:16 ` github-actions
@ 2022-09-26  2:15 ` github-actions
  2023-01-12 21:55 ` Johnnynator
  4 siblings, 0 replies; 6+ messages in thread
From: github-actions @ 2022-09-26  2:15 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 293 bytes --]

New comment by github-actions[bot] on void-packages repository

https://github.com/void-linux/void-packages/issues/35992#issuecomment-1257385965

Comment:
Issues become stale 90 days after last activity and are closed 14 days after that.  If this issue is still relevant bump it or assign it.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [RFC] How to progress with gcc and libatomic
  2022-03-05 12:54 [ISSUE] [RFC] How to progress with gcc and libatomic leahneukirchen
                   ` (3 preceding siblings ...)
  2022-09-26  2:15 ` github-actions
@ 2023-01-12 21:55 ` Johnnynator
  4 siblings, 0 replies; 6+ messages in thread
From: Johnnynator @ 2023-01-12 21:55 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 437 bytes --]

New comment by Johnnynator on void-packages repository

https://github.com/void-linux/void-packages/issues/35992#issuecomment-1381037043

Comment:
Gcc 12 intorduced a new dep cycle On riscv between  zstd <-> libatomic

There are two ways I can see this be solvable:
- We can either disable multithreading in zstd when bootstraping (and providing libatomic in `cross-*` packages)
- Or split libatomic into it's own bootstrap package.

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2023-01-12 21:55 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-03-05 12:54 [ISSUE] [RFC] How to progress with gcc and libatomic leahneukirchen
2022-03-06  1:19 ` the-maldridge
2022-03-06 12:13 ` leahneukirchen
2022-06-27  2:16 ` github-actions
2022-09-26  2:15 ` github-actions
2023-01-12 21:55 ` Johnnynator

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).