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: 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 @@ -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)