https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=225302

../src/util/build_id.c:42:4: error: unknown type name 'Elf_Nhdr'
   ElfW(Nhdr) nhdr;
   ^
../src/util/build_id.c:38:20: note: expanded from macro 'ElfW'
#define ElfW(type) Elf_##type
                   ^
<scratch space>:101:1: note: expanded from here
Elf_Nhdr
^
../src/util/build_id.c:91:33: error: use of undeclared identifier 'Elf_Nhdr'
         size_t offset = sizeof(ElfW(Nhdr)) +
                                ^
../src/util/build_id.c:38:20: note: expanded from macro 'ElfW'
#define ElfW(type) Elf_##type
                   ^
<scratch space>:102:1: note: expanded from here
Elf_Nhdr
^

--- src/util/build_id.c.orig	2020-05-30 21:28:01 UTC
+++ src/util/build_id.c
@@ -38,6 +38,10 @@
 #define ElfW(type) Elf_##type
 #endif
 
+#if defined(__FreeBSD__) && __FreeBSD__ < 12
+typedef Elf_Note Elf_Nhdr;
+#endif
+
 struct build_id_note {
    ElfW(Nhdr) nhdr;
 
