Index: contrib/elftoolchain/readelf/readelf.c =================================================================== --- contrib/elftoolchain/readelf/readelf.c +++ contrib/elftoolchain/readelf/readelf.c @@ -1123,6 +1123,7 @@ case 1: return "NT_FREEBSD_ABI_TAG"; case 2: return "NT_FREEBSD_NOINIT_TAG"; case 3: return "NT_FREEBSD_ARCH_TAG"; + case 4: return "NT_FREEBSD_FEATURE_CTL"; default: return (note_type_unknown(nt)); } } Index: lib/csu/aarch64/crt1.c =================================================================== --- lib/csu/aarch64/crt1.c +++ lib/csu/aarch64/crt1.c @@ -37,6 +37,7 @@ #include "libc_private.h" #include "crtbrand.c" #include "ignore_init.c" +#include "feature.c" #ifdef GCRT extern void _mcleanup(void); Index: lib/csu/amd64/crt1.c =================================================================== --- lib/csu/amd64/crt1.c +++ lib/csu/amd64/crt1.c @@ -34,6 +34,7 @@ #include "libc_private.h" #include "crtbrand.c" #include "ignore_init.c" +#include "feature.c" typedef void (*fptr)(void); Index: lib/csu/arm/crt1.c =================================================================== --- lib/csu/arm/crt1.c +++ lib/csu/arm/crt1.c @@ -51,6 +51,7 @@ #include "libc_private.h" #include "crtbrand.c" #include "ignore_init.c" +#include "feature.c" struct Struct_Obj_Entry; struct ps_strings; Index: lib/csu/common/feature.c =================================================================== --- /dev/null +++ lib/csu/common/feature.c @@ -0,0 +1,50 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * + * Copyright 2018 The FreeBSD Foundation. + * + * This software was developed by Ed Maste under the sponsorship of + * The FreeBSD Foundation. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include "notes.h" + +static const struct { + int32_t namesz; + int32_t descsz; + int32_t type; + char name[sizeof(NOTE_FREEBSD_VENDOR)]; + uint32_t desc[1]; +} crt_feature_ctl __attribute__ ((section (NOTE_SECTION), + aligned(4))) __used = { + .namesz = sizeof(NOTE_FREEBSD_VENDOR), + .descsz = sizeof(uint32_t), + .type = NT_FREEBSD_FEATURE_CTL, + .name = NOTE_FREEBSD_VENDOR, + .desc = { 0 } +}; Index: lib/csu/mips/crt1.c =================================================================== --- lib/csu/mips/crt1.c +++ lib/csu/mips/crt1.c @@ -42,6 +42,7 @@ #include "libc_private.h" #include "crtbrand.c" #include "ignore_init.c" +#include "feature.c" struct Struct_Obj_Entry; struct ps_strings; Index: lib/csu/powerpc/crt1.c =================================================================== --- lib/csu/powerpc/crt1.c +++ lib/csu/powerpc/crt1.c @@ -49,6 +49,7 @@ #include "libc_private.h" #include "crtbrand.c" #include "ignore_init.c" +#include "feature.c" struct Struct_Obj_Entry; struct ps_strings; Index: lib/csu/powerpc64/crt1.c =================================================================== --- lib/csu/powerpc64/crt1.c +++ lib/csu/powerpc64/crt1.c @@ -49,6 +49,7 @@ #include "libc_private.h" #include "crtbrand.c" #include "ignore_init.c" +#include "feature.c" struct Struct_Obj_Entry; struct ps_strings; Index: lib/csu/riscv/crt1.c =================================================================== --- lib/csu/riscv/crt1.c +++ lib/csu/riscv/crt1.c @@ -41,6 +41,7 @@ #include "libc_private.h" #include "crtbrand.c" #include "ignore_init.c" +#include "feature.c" typedef void (*fptr)(void); Index: lib/csu/sparc64/crt1.c =================================================================== --- lib/csu/sparc64/crt1.c +++ lib/csu/sparc64/crt1.c @@ -40,6 +40,7 @@ #include "libc_private.h" #include "crtbrand.c" #include "ignore_init.c" +#include "feature.c" struct Struct_Obj_Entry; struct ps_strings; Index: sys/sys/elf_common.h =================================================================== --- sys/sys/elf_common.h +++ sys/sys/elf_common.h @@ -759,6 +759,7 @@ #define NT_FREEBSD_ABI_TAG 1 #define NT_FREEBSD_NOINIT_TAG 2 #define NT_FREEBSD_ARCH_TAG 3 +#define NT_FREEBSD_FEATURE_CTL 4 /* Values for n_type. Used in core files. */ #define NT_PRSTATUS 1 /* Process status. */