Index: contrib/jemalloc/src/jemalloc.c =================================================================== --- contrib/jemalloc/src/jemalloc.c +++ contrib/jemalloc/src/jemalloc.c @@ -4,9 +4,11 @@ /******************************************************************************/ /* Data. */ +#if LIB_MIN_COMPAT < 10 /* Work around : */ const char *__malloc_options_1_0 = NULL; __sym_compat(_malloc_options, __malloc_options_1_0, FBSD_1.0); +#endif /* Runtime configuration options. */ const char *je_malloc_conf JEMALLOC_ATTR(weak); Index: contrib/jemalloc/src/util.c =================================================================== --- contrib/jemalloc/src/util.c +++ contrib/jemalloc/src/util.c @@ -78,9 +78,11 @@ wrtmessage(NULL, s4); } +#if LIB_MIN_COMPAT < 10 void (*__malloc_message_1_0)(const char *s1, const char *s2, const char *s3, const char *s4) = wrtmessage_1_0; __sym_compat(_malloc_message, __malloc_message_1_0, FBSD_1.0); +#endif /* * Wrapper around malloc_message() that avoids the need for Index: lib/libc/Makefile =================================================================== --- lib/libc/Makefile +++ lib/libc/Makefile @@ -130,7 +130,24 @@ VERSION_DEF=${LIBC_SRCTOP}/Versions.def SYMBOL_MAPS=${SYM_MAPS} -CFLAGS+= -DSYMBOL_VERSIONING +.if ${MK_SYMVER} != "no" +# LIB_MIN_COMPAT is set to the major version of the first FreeBSD release that +# supported the target architecture. When a major FreeBSD version "n" +# introduces a new version of a symbol, the backwards compatibility (previous) +# symbol version is required where LIB_MIN_COMPAT < n. +LIB_MIN_COMPAT=${ARCH_LIB_MIN_COMPAT} +.else +# Set minimum compatability higher than any FreeBSD release +LIB_MIN_COMPAT=999999 +.endif +CFLAGS+=-DLIB_MIN_COMPAT=${LIB_MIN_COMPAT} +# Remove syscall wrappers for FreeBSD versions older than the first one +# supported by this target. +.for i in 4 5 6 7 8 9 10 +.if ${LIB_MIN_COMPAT} > ${i} +MIASM:= ${MIASM:Nfreebsd${i}_*} +.endif +.endfor # If there are no machine dependent sources, append all the # machine-independent sources: Index: lib/libc/aarch64/Makefile.inc =================================================================== --- lib/libc/aarch64/Makefile.inc +++ lib/libc/aarch64/Makefile.inc @@ -7,3 +7,4 @@ GDTOASRCS+=strtorQ.c MDSRCS+=machdep_ldisQ.c SYM_MAPS+=${LIBC_SRCTOP}/aarch64/Symbol.map +ARCH_LIB_MIN_COMPAT=11 Index: lib/libc/aarch64/gen/Makefile.inc =================================================================== --- lib/libc/aarch64/gen/Makefile.inc +++ lib/libc/aarch64/gen/Makefile.inc @@ -1,7 +1,5 @@ # $FreeBSD$ -CFLAGS+= -DNO_COMPAT7 - SRCS+= _ctx_start.S \ fabs.S \ flt_rounds.c \ Index: lib/libc/aarch64/sys/Makefile.inc =================================================================== --- lib/libc/aarch64/sys/Makefile.inc +++ lib/libc/aarch64/sys/Makefile.inc @@ -1,7 +1,5 @@ # $FreeBSD$ -MIASM:= ${MIASM:Nfreebsd[467]_*} - SRCS+= __vdso_gettc.c #MDASM= ptrace.S Index: lib/libc/amd64/Makefile.inc =================================================================== --- lib/libc/amd64/Makefile.inc +++ lib/libc/amd64/Makefile.inc @@ -7,3 +7,4 @@ GDTOASRCS+=strtorx.c MDSRCS+=machdep_ldisx.c SYM_MAPS+=${LIBC_SRCTOP}/amd64/Symbol.map +ARCH_LIB_MIN_COMPAT=4 Index: lib/libc/arm/Makefile.inc =================================================================== --- lib/libc/arm/Makefile.inc +++ lib/libc/arm/Makefile.inc @@ -14,4 +14,5 @@ .if ${MACHINE_ARCH:Marm*hf*} != "" SYM_MAPS+=${LIBC_SRCTOP}/arm/Symbol_vfp.map .endif +ARCH_LIB_MIN_COMPAT=10 Index: lib/libc/gen/sem.c =================================================================== --- lib/libc/gen/sem.c +++ lib/libc/gen/sem.c @@ -109,6 +109,7 @@ static LIST_HEAD(, sem) named_sems = LIST_HEAD_INITIALIZER(named_sems); static pthread_mutex_t named_sems_mtx = PTHREAD_MUTEX_INITIALIZER; +#if LIB_MIN_COMPAT < 9 FB10_COMPAT(_libc_sem_init_compat, sem_init); FB10_COMPAT(_libc_sem_destroy_compat, sem_destroy); FB10_COMPAT(_libc_sem_open_compat, sem_open); @@ -119,6 +120,7 @@ FB10_COMPAT(_libc_sem_timedwait_compat, sem_timedwait); FB10_COMPAT(_libc_sem_post_compat, sem_post); FB10_COMPAT(_libc_sem_getvalue_compat, sem_getvalue); +#endif static inline int sem_check_validity(sem_t *sem) Index: lib/libc/gen/semctl.c =================================================================== --- lib/libc/gen/semctl.c +++ lib/libc/gen/semctl.c @@ -29,7 +29,7 @@ #include __FBSDID("$FreeBSD$"); -#ifndef NO_COMPAT7 +#if LIB_MIN_COMPAT < 8 #define _WANT_SEMUN_OLD #endif @@ -40,7 +40,7 @@ #include int __semctl(int semid, int semnum, int cmd, union semun *arg); -#ifndef NO_COMPAT7 +#if LIB_MIN_COMPAT < 8 int freebsd7___semctl(int semid, int semnum, int cmd, union semun_old *arg); int freebsd7_semctl(int semid, int semnum, int cmd, ...); #endif @@ -65,7 +65,7 @@ return (__semctl(semid, semnum, cmd, semun_ptr)); } -#ifndef NO_COMPAT7 +#if LIB_MIN_COMPAT < 8 int freebsd7_semctl(int semid, int semnum, int cmd, ...) { Index: lib/libc/gen/ttyslot.c =================================================================== --- lib/libc/gen/ttyslot.c +++ lib/libc/gen/ttyslot.c @@ -42,4 +42,6 @@ return (0); } +#if LIB_MIN_COMPAT < 9 __sym_compat(ttyslot, __ttyslot, FBSD_1.0); +#endif Index: lib/libc/i386/Makefile.inc =================================================================== --- lib/libc/i386/Makefile.inc +++ lib/libc/i386/Makefile.inc @@ -4,3 +4,4 @@ GDTOASRCS+=strtorx.c MDSRCS+=machdep_ldisx.c SYM_MAPS+=${LIBC_SRCTOP}/i386/Symbol.map +ARCH_LIB_MIN_COMPAT=4 Index: lib/libc/include/compat.h =================================================================== --- lib/libc/include/compat.h +++ lib/libc/include/compat.h @@ -35,16 +35,16 @@ #ifndef __LIBC_COMPAT_H__ #define __LIBC_COMPAT_H__ +#if LIB_MIN_COMPAT < 8 #define __sym_compat(sym,impl,verid) \ .symver impl, sym@verid -#ifndef NO_COMPAT7 __sym_compat(__semctl, freebsd7___semctl, FBSD_1.0); __sym_compat(msgctl, freebsd7_msgctl, FBSD_1.0); __sym_compat(shmctl, freebsd7_shmctl, FBSD_1.0); -#endif #undef __sym_compat +#endif #define __weak_reference(sym,alias) \ .weak alias;.equ alias,sym Index: lib/libc/mips/Makefile.inc =================================================================== --- lib/libc/mips/Makefile.inc +++ lib/libc/mips/Makefile.inc @@ -5,3 +5,4 @@ MDSRCS+= machdep_ldisd.c SYM_MAPS+= ${LIBC_SRCTOP}/mips/Symbol.map +ARCH_LIB_MIN_COMPAT=7 Index: lib/libc/powerpc/Makefile.inc =================================================================== --- lib/libc/powerpc/Makefile.inc +++ lib/libc/powerpc/Makefile.inc @@ -5,3 +5,4 @@ # Long double is 64-bits MDSRCS+=machdep_ldisd.c SYM_MAPS+=${LIBC_SRCTOP}/powerpc/Symbol.map +ARCH_LIB_MIN_COMPAT=6 Index: lib/libc/powerpc64/Makefile.inc =================================================================== --- lib/libc/powerpc64/Makefile.inc +++ lib/libc/powerpc64/Makefile.inc @@ -5,3 +5,4 @@ # Long double is 64-bits MDSRCS+=machdep_ldisd.c SYM_MAPS+=${LIBC_SRCTOP}/powerpc64/Symbol.map +ARCH_LIB_MIN_COMPAT=6 Index: lib/libc/riscv/Makefile.inc =================================================================== --- lib/libc/riscv/Makefile.inc +++ lib/libc/riscv/Makefile.inc @@ -7,3 +7,4 @@ GDTOASRCS+=strtorQ.c MDSRCS+=machdep_ldisQ.c SYM_MAPS+=${LIBC_SRCTOP}/riscv/Symbol.map +ARCH_LIB_MIN_COMPAT=11 Index: lib/libc/sparc64/Makefile.inc =================================================================== --- lib/libc/sparc64/Makefile.inc +++ lib/libc/sparc64/Makefile.inc @@ -11,3 +11,4 @@ GDTOASRCS+=strtorQ.c MDSRCS+=machdep_ldisQ.c SYM_MAPS+=${LIBC_SRCTOP}/sparc64/Symbol.map +ARCH_LIB_MIN_COMPAT=4 Index: lib/libc/sys/Symbol.map =================================================================== --- lib/libc/sys/Symbol.map +++ lib/libc/sys/Symbol.map @@ -355,6 +355,7 @@ cap_enter; cap_getmode; getloginclass; + openat; pdfork; pdgetpid; pdkill; @@ -364,7 +365,9 @@ rctl_get_limits; rctl_add_rule; rctl_remove_rule; + setcontext; setloginclass; + swapcontext; }; FBSD_1.3 { Index: lib/libc/sys/openat.c =================================================================== --- lib/libc/sys/openat.c +++ lib/libc/sys/openat.c @@ -39,9 +39,11 @@ #include "libc_private.h" __weak_reference(__sys_openat, __openat); +#if LIB_MIN_COMPAT < 11 __sym_compat(openat, __impl_openat, FBSD_1.1); __weak_reference(openat, __impl_openat); __sym_default(openat, openat, FBSD_1.2); +#endif #pragma weak openat int Index: lib/libc/sys/setcontext.c =================================================================== --- lib/libc/sys/setcontext.c +++ lib/libc/sys/setcontext.c @@ -38,9 +38,11 @@ #include "libc_private.h" __weak_reference(__sys_setcontext, __setcontext); +#if LIB_MIN_COMPAT < 11 __sym_compat(setcontext, __impl_setcontext, FBSD_1.0); __weak_reference(setcontext, __impl_setcontext); __sym_default(setcontext, setcontext, FBSD_1.2); +#endif #pragma weak setcontext int Index: lib/libc/sys/swapcontext.c =================================================================== --- lib/libc/sys/swapcontext.c +++ lib/libc/sys/swapcontext.c @@ -39,9 +39,11 @@ #include "libc_private.h" __weak_reference(__sys_swapcontext, __swapcontext); +#if LIB_MIN_COMPAT < 11 __sym_compat(swapcontext, __impl_swapcontext, FBSD_1.0); __weak_reference(swapcontext, __impl_swapcontext); __sym_default(swapcontext, swapcontext, FBSD_1.2); +#endif #pragma weak swapcontext int