Index: lib/libkvm/kvm.c =================================================================== --- lib/libkvm/kvm.c +++ lib/libkvm/kvm.c @@ -64,7 +64,7 @@ #include "kvm_private.h" -SET_DECLARE(kvm_arch, struct kvm_arch); +SET_DECLARE_WEAK(kvm_arch, struct kvm_arch); static char _kd_is_null[] = ""; Index: stand/ficl/ficl.h =================================================================== --- stand/ficl/ficl.h +++ stand/ficl/ficl.h @@ -1155,7 +1155,7 @@ typedef void ficlCompileFcn(FICL_SYSTEM *); #define FICL_COMPILE_SET(func) \ DATA_SET(Xficl_compile_set, func) -SET_DECLARE(Xficl_compile_set, ficlCompileFcn); +SET_DECLARE_WEAK(Xficl_compile_set, ficlCompileFcn); #ifdef LOADER_VERIEXEC #include Index: sys/arm/arm/platform.c =================================================================== --- sys/arm/arm/platform.c +++ sys/arm/arm/platform.c @@ -73,7 +73,7 @@ * Platform install routines. Highest priority wins, using the same * algorithm as bus attachment. */ -SET_DECLARE(platform_set, platform_def_t); +SET_DECLARE_WEAK(platform_set, platform_def_t); static delay_func platform_delay; Index: sys/dev/uart/uart_cpu_acpi.h =================================================================== --- sys/dev/uart/uart_cpu_acpi.h +++ sys/dev/uart/uart_cpu_acpi.h @@ -62,7 +62,7 @@ * If your UART driver implements uart_class and custom device layer, * then use UART_ACPI_CLASS for its declaration */ -SET_DECLARE(uart_acpi_class_set, struct acpi_uart_compat_data); +SET_DECLARE_WEAK(uart_acpi_class_set, struct acpi_uart_compat_data); #define UART_ACPI_CLASS(data) \ DATA_SET(uart_acpi_class_set, data) Index: sys/dev/uart/uart_cpu_fdt.h =================================================================== --- sys/dev/uart/uart_cpu_fdt.h +++ sys/dev/uart/uart_cpu_fdt.h @@ -38,7 +38,7 @@ * for device instantiation, then use UART_FDT_CLASS_AND_DEVICE for its * declaration */ -SET_DECLARE(uart_fdt_class_and_device_set, struct ofw_compat_data ); +SET_DECLARE_WEAK(uart_fdt_class_and_device_set, struct ofw_compat_data ); #define UART_FDT_CLASS_AND_DEVICE(data) \ DATA_SET(uart_fdt_class_and_device_set, data) @@ -46,7 +46,7 @@ * If your UART driver implements uart_class and custom device layer, * then use UART_FDT_CLASS for its declaration */ -SET_DECLARE(uart_fdt_class_set, struct ofw_compat_data ); +SET_DECLARE_WEAK(uart_fdt_class_set, struct ofw_compat_data ); #define UART_FDT_CLASS(data) \ DATA_SET(uart_fdt_class_set, data) Index: sys/kern/subr_compressor.c =================================================================== --- sys/kern/subr_compressor.c +++ sys/kern/subr_compressor.c @@ -62,7 +62,7 @@ void *arg; }; -SET_DECLARE(compressors, struct compressor_methods); +SET_DECLARE_WEAK(compressors, struct compressor_methods); #ifdef GZIO Index: sys/sys/linker_set.h =================================================================== --- sys/sys/linker_set.h +++ sys/sys/linker_set.h @@ -60,8 +60,6 @@ */ #ifdef __GNUCLIKE___SECTION #define __MAKE_SET_QV(set, sym, qv) \ - __GLOBL(__CONCAT(__start_set_,set)); \ - __GLOBL(__CONCAT(__stop_set_,set)); \ static void const * qv \ __set_##set##_sym_##sym __section("set_" #set) \ __nosanitizeaddress \ @@ -84,7 +82,12 @@ /* * Initialize before referring to a given linker set. */ -#define SET_DECLARE(set, ptype) \ +#define SET_DECLARE(set, ptype) \ + extern ptype *__CONCAT(__start_set_,set); \ + extern ptype *__CONCAT(__stop_set_,set) + +/* Like SET_DECLARE() but also marks the symbols weak to support empty sets. */ +#define SET_DECLARE_WEAK(set, ptype) \ extern ptype __weak_symbol *__CONCAT(__start_set_,set); \ extern ptype __weak_symbol *__CONCAT(__stop_set_,set)