NetBSD-Bugs archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: port-sparc/58352: ld: /usr/lib/libubsan.so: undefined reference to `__sync_val_compare_and_swap_8'
The following reply was made to PR port-sparc/58352; it has been noted by GNATS.
From: Rin Okuyama <rokuyama.rk%gmail.com@localhost>
To: gnats-bugs%netbsd.org@localhost, Taylor R Campbell <riastradh%NetBSD.org@localhost>,
matthew green <mrg%NetBSD.org@localhost>
Cc: port-sparc-maintainer%netbsd.org@localhost, gnats-admin%netbsd.org@localhost,
netbsd-bugs%netbsd.org@localhost
Subject: Re: port-sparc/58352: ld: /usr/lib/libubsan.so: undefined reference
to `__sync_val_compare_and_swap_8'
Date: Wed, 19 Jun 2024 23:44:09 +0900
On 2024/06/19 1:52, matthew green wrote:
> campbell+netbsd%mumble.net@localhost writes:
>>> Number: 58352
>>> Category: port-sparc
>>> Synopsis: ld: /usr/lib/libubsan.so: undefined reference to `__sync_val_compare_and_swap_8'
>
> hmm, i thought i'd avoided this already.
>
> it's one of the notes in README.gcc12.
It seems that `-mcpu=v8` is not sufficient for sparc:
(1) 64-bit atomic ops requires V8PLUS:
https://github.com/NetBSD/src/blob/trunk/external/gpl3/gcc/dist/gcc/config/sparc/sync.md#L23
(2) V8PLUS requires both VIS and V9:
https://github.com/NetBSD/src/blob/trunk/external/gpl3/gcc/dist/gcc/config/sparc/sparc.cc#L1938-L1948
(3) Earliest CPU model satisfy (2) seems `ultrasparc3`, IIUC:
(I'm not familiar to sparc although...)
https://github.com/NetBSD/src/blob/trunk/external/gpl3/gcc/dist/gcc/config/sparc/sparc.cc#L1766-L1767
Actually, lib*san.so built with -mcpu=v8 contain undefined reference to
__sync_val_compare_and_swap8, but they do not with -mcpu=ultrasparc3.
Thanks,
rin
----
diff --git a/external/gpl3/gcc/lib/Makefile.sanitizer
b/external/gpl3/gcc/lib/Makefile.sanitizer
index e574f902c22..e20693c3241 100644
--- a/external/gpl3/gcc/lib/Makefile.sanitizer
+++ b/external/gpl3/gcc/lib/Makefile.sanitizer
@@ -128,7 +128,7 @@ COPTS.ubsan_init.cc += -O1
# - 32-bit SPARC needs v8 to supply eg __sync_add_and_fetch_4
# - i386 needs i586 for __sync_val_compare_and_swap_8.
.if ${MACHINE_ARCH} == "sparc"
-COPTS+= -mcpu=v8
+COPTS+= -mcpu=ultrasparc3
.endif
.if ${MACHINE_ARCH} == "i386"
COPTS+= -march=i586
Home |
Main Index |
Thread Index |
Old Index