Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F108689382
D45651.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
3 KB
Referenced Files
None
Subscribers
None
D45651.diff
View Options
diff --git a/include/stdlib.h b/include/stdlib.h
--- a/include/stdlib.h
+++ b/include/stdlib.h
@@ -330,23 +330,26 @@
* 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
--- a/sys/sys/cdefs.h
+++ b/sys/sys/cdefs.h
@@ -90,9 +90,18 @@
#define __compiler_membar() __asm __volatile(" " : : : "memory")
#define __CC_SUPPORTS___INLINE 1
+#define __CC_SUPPORTS_SYMVER 1
#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
+
/*
* The __CONCAT macro is used to concatenate parts of symbol names, e.g.
* with "#define OLD(foo) __CONCAT(old,foo)", OLD(foo) produces oldfoo.
@@ -369,10 +378,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
#else
#define __weak_reference(sym,alias) \
__asm__(".weak alias"); \
@@ -381,10 +392,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
#endif /* __STDC__ */
#define __GLOBL(sym) __asm__(".globl " __XSTRING(sym))
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Tue, Jan 28, 8:12 AM (4 h, 28 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
16202501
Default Alt Text
D45651.diff (3 KB)
Attached To
Mode
D45651: stdlib: Support compiling with tinyc by omitting compat qsort code
Attached
Detach File
Event Timeline
Log In to Comment