Hi,
On Wed, Aug 31, 2022 at 07:04:53PM +0200, Aurelien Jarno wrote:
...
reason for limiting the link with -latomic to pthread, but that has been
discussed internally before the patch submission to GCC, and has been
lost.

Anyway this is probably something to try, but the way is done in Arch,
i.e. patching the binaries, is ugly. It's probably better to patch the
sources that way (completely untested):

diff --git a/gcc/config/riscv/linux.h b/gcc/config/riscv/linux.h
--- a/gcc/config/riscv/linux.h
+++ b/gcc/config/riscv/linux.h
@@ -40,7 +40,7 @@ along with GCC; see the file COPYING3.  If not see
#undef LIB_SPEC
#ifdef LD_AS_NEEDED_OPTION
#define LIB_SPEC GNU_USER_TARGET_LIB_SPEC \
-  " %{pthread:" LD_AS_NEEDED_OPTION " -latomic " LD_NO_AS_NEEDED_OPTION "}"
+  LD_AS_NEEDED_OPTION " -latomic " LD_NO_AS_NEEDED_OPTION
#else
#define LIB_SPEC GNU_USER_TARGET_LIB_SPEC " -latomic "
#endif

I have built gcc-12 debian packages with your help and patch:
https://drive.google.com/drive/folders/1jdqA9mrBea0BHhePVSHkPPOYo6pc7-dq?usp=sharing

I tried it once but it doesn't seem to solve the problem. But there is a
high probability that there is something wrong with my testing method:

I installed gcc-12/g++-12 by manual on a clean riscv64 chroot and then
try build thinkfan[0] with dpkg-buildpackage. I was wondering if it would be simpler to directly manipulate atomic statements in a c program also. Or could you help to verify it work or not again? The patch attached is full change at this time.

So can we try it? I am not gcc expert and unable to evaluate
the workround how trouble if enabled in Debian. Or there are
other better solutions?

The better solution would be for someone to continue the work from this
patch, but that is a lot more work:
https://www.mail-archive.com/gcc-patches@gcc.gnu.org/msg283119.html

Oh, gcc is master for me now. But I want to see what I can do about
this.


[0]: https://buildd.debian.org/status/package.php?p=thinkfan
--
Regards,
--
  Bo YU

Attachment: signature.asc
Description: PGP signature

Reply via email to