From nobody Fri Jul 19 18:51:26 2024 X-Original-To: freebsd-hackers@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4WQf0f0nDhz5S6mZ for ; Fri, 19 Jul 2024 18:51:46 +0000 (UTC) (envelope-from kim@westryn.net) Received: from mail.westryn.net (mail.westryn.net [199.48.135.251]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4WQf0c4hJ2z47n2 for ; Fri, 19 Jul 2024 18:51:44 +0000 (UTC) (envelope-from kim@westryn.net) Authentication-Results: mx1.freebsd.org; dkim=pass header.d=westryn.net header.s=westrynnet header.b=m4AcWf0o; dmarc=pass (policy=none) header.from=westryn.net; spf=pass (mx1.freebsd.org: domain of kim@westryn.net designates 199.48.135.251 as permitted sender) smtp.mailfrom=kim@westryn.net Received: from smtpclient.apple (225x169.ouraynet.com [204.16.225.169]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.westryn.net (Postfix) with ESMTPSA id F0F7A10009F2 for ; Fri, 19 Jul 2024 12:51:37 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=westryn.net; s=westrynnet; t=1721415098; bh=g6GFWIM+EWsAUykNAvl8t1DsfOYaz4APv/9VlC+ug0g=; h=From:Subject:Date:To; b=m4AcWf0oC20cnjR+kysJ5mY7lYo3/eMu9/3Ad4t5RKlHeqwjaNW1fhXn1IJm6O/JG x2sI3nAnKKEjOxgWRzC2SvwODb28oxKL2V5PRBvCnKfPzd3wFg4XaKJRIMIu0LxD2j rwJgaUwm56FnmCxQgiYg/fB1nT4JIflwwCC33AQpIJ4N8oXrJIrIDvXCK0YX5060E6 c0eX9WMjfu1lN1L6+H44ZwgJcr4wxnDeGxNUTzQK/PngNsVMwf5CO+4e64RfEYRdNm QZDEo8YHuleZJ7PNaCbX1I0sEz97H+IP9FggCH6GgsI0LwVvl0eRKM59ySc/Idy/9H I6skU7Yc9VdYg== From: Kim Shrier Content-Type: multipart/mixed; boundary="Apple-Mail=_4EA1EF40-4F62-4613-8385-DC0CACC9B62D" List-Id: Technical discussions relating to FreeBSD List-Archive: https://lists.freebsd.org/archives/freebsd-hackers List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-hackers@FreeBSD.org Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3774.600.62\)) Subject: MFC D45651 to stable/14 Message-Id: Date: Fri, 19 Jul 2024 12:51:26 -0600 To: FreeBSD Hackers X-Mailer: Apple Mail (2.3774.600.62) X-Spamd-Bar: --- X-Spamd-Result: default: False [-3.97 / 15.00]; NEURAL_HAM_MEDIUM(-1.00)[-1.000]; NEURAL_HAM_LONG(-1.00)[-1.000]; NEURAL_HAM_SHORT(-0.97)[-0.969]; DMARC_POLICY_ALLOW(-0.50)[westryn.net,none]; R_SPF_ALLOW(-0.20)[+ip4:199.48.135.251]; R_DKIM_ALLOW(-0.20)[westryn.net:s=westrynnet]; MIME_GOOD(-0.10)[multipart/mixed,text/plain]; RCVD_TLS_ALL(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; DKIM_TRACE(0.00)[westryn.net:+]; HAS_ATTACHMENT(0.00)[]; RCPT_COUNT_ONE(0.00)[1]; TO_DN_ALL(0.00)[]; FROM_HAS_DN(0.00)[]; ASN(0.00)[asn:36236, ipnet:199.48.132.0/22, country:US]; ARC_NA(0.00)[]; PREVIOUSLY_DELIVERED(0.00)[freebsd-hackers@freebsd.org]; FROM_EQ_ENVFROM(0.00)[]; RCVD_COUNT_ONE(0.00)[1]; MLMMJ_DEST(0.00)[freebsd-hackers@freebsd.org]; APPLE_MAILER_COMMON(0.00)[]; MID_RHS_MATCH_FROM(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; MIME_TRACE(0.00)[0:+,1:+,2:~,3:+,4:~,5:+] X-Rspamd-Queue-Id: 4WQf0c4hJ2z47n2 --Apple-Mail=_4EA1EF40-4F62-4613-8385-DC0CACC9B62D Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 I=E2=80=99m unsure of the proper channels for this request. I would like https://reviews.freebsd.org/D45651 to be MFC=E2=80=99ed to = stable/14 and if possible releng/14.1. I have attached patch files to accomplish these updates. --Apple-Mail=_4EA1EF40-4F62-4613-8385-DC0CACC9B62D Content-Disposition: attachment; filename=stable_14_tcc_symver.patch Content-Type: application/octet-stream; x-unix-mode=0644; name="stable_14_tcc_symver.patch" Content-Transfer-Encoding: 7bit diff --git a/include/stdlib.h b/include/stdlib.h index 67a1cb82761d..ef0e196744cd 100644 --- a/include/stdlib.h +++ b/include/stdlib.h @@ -339,23 +339,26 @@ __uint64_t * parameter, and both are different from the ones expected by the historical * FreeBSD qsort_r() interface. * - * Apply a workaround where we explicitly link against the historical - * interface, qsort_r@FBSD_1.0, in case when qsort_r() is called with - * the last parameter with a function pointer that exactly matches the - * historical FreeBSD qsort_r() comparator signature, so applications - * written for the historical interface can continue to work without - * modification. + * Apply a workaround where we explicitly link against the historical interface, + * qsort_r@FBSD_1.0, in case when qsort_r() is called with the last parameter + * with a function pointer that exactly matches the historical FreeBSD qsort_r() + * comparator signature, so applications written for the historical interface + * can continue to work without modification. Toolchains that don't support + * symbol versioning don't define __sym_compat, so only provide this symbol in + * supported environments. */ +#ifdef __sym_compat #if defined(__generic) || defined(__cplusplus) void __qsort_r_compat(void *, size_t, size_t, void *, int (*)(void *, const void *, const void *)); __sym_compat(qsort_r, __qsort_r_compat, FBSD_1.0); #endif +#endif #if defined(__generic) && !defined(__cplusplus) #define qsort_r(base, nel, width, arg4, arg5) \ __generic(arg5, int (*)(void *, const void *, const void *), \ __qsort_r_compat, qsort_r)(base, nel, width, arg4, arg5) -#elif defined(__cplusplus) +#elif defined(__cplusplus) && defined(__sym_compat) __END_DECLS extern "C++" { static inline void qsort_r(void *base, size_t nmemb, size_t size, diff --git a/sys/sys/cdefs.h b/sys/sys/cdefs.h index 19b7d8fe427d..38be15666231 100644 --- a/sys/sys/cdefs.h +++ b/sys/sys/cdefs.h @@ -112,6 +112,8 @@ #define __CC_SUPPORTS___INLINE 1 #define __CC_SUPPORTS___INLINE__ 1 +#define __CC_SUPPORTS_SYMVER 1 + #define __CC_SUPPORTS___FUNC__ 1 #define __CC_SUPPORTS_WARNING 1 @@ -121,6 +123,14 @@ #endif /* __GNUC__ */ +/* + * TinyC pretends to be gcc 9.3. This is generally good enough to support + * everything FreeBSD... except for the .symver assembler directive. + */ +#ifdef __TINYC__ +#undef __CC_SUPPORTS_SYMVER +#endif + /* * Macro to test if we're using a specific version of gcc or later. */ @@ -540,10 +550,12 @@ __asm__(".section .gnu.warning." #sym); \ __asm__(".asciz \"" msg "\""); \ __asm__(".previous") +#ifdef __CC_SUPPORTS_SYMVER #define __sym_compat(sym,impl,verid) \ __asm__(".symver " #impl ", " #sym "@" #verid) #define __sym_default(sym,impl,verid) \ __asm__(".symver " #impl ", " #sym "@@@" #verid) +#endif /* __CC_SUPPORTS_SYMVER */ #else #define __weak_reference(sym,alias) \ __asm__(".weak alias"); \ @@ -552,10 +564,12 @@ __asm__(".section .gnu.warning.sym"); \ __asm__(".asciz \"msg\""); \ __asm__(".previous") +#ifdef __CC_SUPPORTS_SYMVER #define __sym_compat(sym,impl,verid) \ __asm__(".symver impl, sym@verid") #define __sym_default(impl,sym,verid) \ __asm__(".symver impl, sym@@@verid") +#endif /* __CC_SUPPORTS_SYMVER */ #endif /* __STDC__ */ #endif /* __GNUC__ */ --Apple-Mail=_4EA1EF40-4F62-4613-8385-DC0CACC9B62D Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=us-ascii --Apple-Mail=_4EA1EF40-4F62-4613-8385-DC0CACC9B62D Content-Disposition: attachment; filename=releng_14.1_tcc_symver.patch Content-Type: application/octet-stream; x-unix-mode=0644; name="releng_14.1_tcc_symver.patch" Content-Transfer-Encoding: 7bit diff --git a/include/stdlib.h b/include/stdlib.h index 67a1cb82761d..ef0e196744cd 100644 --- a/include/stdlib.h +++ b/include/stdlib.h @@ -339,23 +339,26 @@ __uint64_t * parameter, and both are different from the ones expected by the historical * FreeBSD qsort_r() interface. * - * Apply a workaround where we explicitly link against the historical - * interface, qsort_r@FBSD_1.0, in case when qsort_r() is called with - * the last parameter with a function pointer that exactly matches the - * historical FreeBSD qsort_r() comparator signature, so applications - * written for the historical interface can continue to work without - * modification. + * Apply a workaround where we explicitly link against the historical interface, + * qsort_r@FBSD_1.0, in case when qsort_r() is called with the last parameter + * with a function pointer that exactly matches the historical FreeBSD qsort_r() + * comparator signature, so applications written for the historical interface + * can continue to work without modification. Toolchains that don't support + * symbol versioning don't define __sym_compat, so only provide this symbol in + * supported environments. */ +#ifdef __sym_compat #if defined(__generic) || defined(__cplusplus) void __qsort_r_compat(void *, size_t, size_t, void *, int (*)(void *, const void *, const void *)); __sym_compat(qsort_r, __qsort_r_compat, FBSD_1.0); #endif +#endif #if defined(__generic) && !defined(__cplusplus) #define qsort_r(base, nel, width, arg4, arg5) \ __generic(arg5, int (*)(void *, const void *, const void *), \ __qsort_r_compat, qsort_r)(base, nel, width, arg4, arg5) -#elif defined(__cplusplus) +#elif defined(__cplusplus) && defined(__sym_compat) __END_DECLS extern "C++" { static inline void qsort_r(void *base, size_t nmemb, size_t size, diff --git a/sys/sys/cdefs.h b/sys/sys/cdefs.h index 4893ae1662b8..2872f1d5d554 100644 --- a/sys/sys/cdefs.h +++ b/sys/sys/cdefs.h @@ -112,6 +112,8 @@ #define __CC_SUPPORTS___INLINE 1 #define __CC_SUPPORTS___INLINE__ 1 +#define __CC_SUPPORTS_SYMVER 1 + #define __CC_SUPPORTS___FUNC__ 1 #define __CC_SUPPORTS_WARNING 1 @@ -121,6 +123,14 @@ #endif /* __GNUC__ */ +/* + * TinyC pretends to be gcc 9.3. This is generally good enough to support + * everything FreeBSD... except for the .symver assembler directive. + */ +#ifdef __TINYC__ +#undef __CC_SUPPORTS_SYMVER +#endif + /* * Macro to test if we're using a specific version of gcc or later. */ @@ -539,10 +549,12 @@ __asm__(".section .gnu.warning." #sym); \ __asm__(".asciz \"" msg "\""); \ __asm__(".previous") +#ifdef __CC_SUPPORTS_SYMVER #define __sym_compat(sym,impl,verid) \ __asm__(".symver " #impl ", " #sym "@" #verid) #define __sym_default(sym,impl,verid) \ __asm__(".symver " #impl ", " #sym "@@@" #verid) +#endif /* __CC_SUPPORTS_SYMVER */ #else #define __weak_reference(sym,alias) \ __asm__(".weak alias"); \ @@ -551,10 +563,12 @@ __asm__(".section .gnu.warning.sym"); \ __asm__(".asciz \"msg\""); \ __asm__(".previous") +#ifdef __CC_SUPPORTS_SYMVER #define __sym_compat(sym,impl,verid) \ __asm__(".symver impl, sym@verid") #define __sym_default(impl,sym,verid) \ __asm__(".symver impl, sym@@@verid") +#endif /* __CC_SUPPORTS_SYMVER */ #endif /* __STDC__ */ #endif /* __GNUC__ */ --Apple-Mail=_4EA1EF40-4F62-4613-8385-DC0CACC9B62D Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=us-ascii Kim _ C++ is an off-by-one error --Apple-Mail=_4EA1EF40-4F62-4613-8385-DC0CACC9B62D--