commit: e5b9ffd458933b9f68a6609b96d308192b2dbd86
parent 7a3b81ed5f3d4707f0cdacdc01d0c90816e4be30
Author: Michael Forney <mforney@mforney.org>
Date: Thu, 29 Apr 2021 12:46:26 -0700
elftoolchain: Update to latest git
Diffstat:
17 files changed, 960 insertions(+), 784 deletions(-)
diff --git a/.gitmodules b/.gitmodules
@@ -67,6 +67,10 @@
path = pkg/efivar/src
url = https://github.com/rhinstaller/efivar
ignore = all
+[submodule "pkg/elftoolchain/elftoolchain"]
+ path = pkg/elftoolchain/src
+ url = https://github.com/elftoolchain/elftoolchain.git
+ ignore = all
[submodule "pkg/expat/src"]
path = pkg/expat/src
url = https://github.com/libexpat/libexpat
diff --git a/pkg/elftoolchain/.gitignore b/pkg/elftoolchain/.gitignore
@@ -1,2 +0,0 @@
-/elftoolchain-0.7.1.tgz
-/src
diff --git a/pkg/elftoolchain/gen.lua b/pkg/elftoolchain/gen.lua
@@ -1,6 +1,6 @@
cflags{
'-Wall', '-Wpedantic',
- '-I $dir',
+ '-I $outdir/include',
'-I $srcdir/common',
'-I $srcdir/libelf',
'-isystem $builddir/pkg/openbsd/include',
@@ -9,14 +9,18 @@ cflags{
pkg.hdrs = {
copy('$outdir/include', '$srcdir/libelf', {'libelf.h', 'gelf.h'}),
copy('$outdir/include', '$srcdir/common', {'elfdefinitions.h'}),
+ '$outdir/include/sys/elfdefinitions.h',
install=true,
}
-pkg.deps = {'pkg/openbsd/headers'}
+pkg.deps = {'$gendir/headers', 'pkg/openbsd/headers'}
-rule('m4', 'm4 -D SRCDIR=$srcdir/libelf $in >$out')
+rule('m4', 'm4 $m4flags -D SRCDIR=$srcdir/libelf $in >$out')
build('m4', '$outdir/libelf_convert.c', {'$srcdir/libelf/libelf_convert.m4', '|', '$srcdir/libelf/elf_types.m4'})
build('m4', '$outdir/libelf_fsize.c', {'$srcdir/libelf/libelf_fsize.m4', '|', '$srcdir/libelf/elf_types.m4'})
build('m4', '$outdir/libelf_msize.c', {'$srcdir/libelf/libelf_msize.m4', '|', '$srcdir/libelf/elf_types.m4'})
+build('m4', '$outdir/include/sys/elfdefinitions.h', {'$srcdir/common/sys/elfdefinitions.m4', '|', '$srcdir/common/sys/elfconstants.m4'}, {
+ m4flags='-I $srcdir/common/sys'
+})
lib('libelf.a', [[
libelf/(
@@ -31,6 +35,7 @@ lib('libelf.a', [[
elf_getarsym.c
elf_getbase.c
elf_getident.c
+ elf_getversion.c
elf_hash.c
elf_kind.c
elf_memory.c
@@ -67,6 +72,7 @@ lib('libelf.a', [[
libelf_checksum.c
libelf_data.c
libelf_ehdr.c
+ libelf_elfmachine.c
libelf_extended.c
libelf_memory.c
libelf_open.c
@@ -78,4 +84,4 @@ lib('libelf.a', [[
]])
file('lib/libelf.a', '644', '$outdir/libelf.a')
-fetch 'curl'
+fetch 'git'
diff --git a/pkg/elftoolchain/native-elf-format.h b/pkg/elftoolchain/native-elf-format.h
@@ -1,3 +0,0 @@
-#define ELFTC_CLASS ELFCLASS64
-#define ELFTC_ARCH EM_X86_64
-#define ELFTC_BYTEORDER ELFDATA2LSB
diff --git a/pkg/elftoolchain/patch/0001-Ensure-that-the-value-of-a-32-bit-parameter-passed.patch b/pkg/elftoolchain/patch/0001-Ensure-that-the-value-of-a-32-bit-parameter-passed.patch
@@ -1,30 +0,0 @@
-From 6d5954e185dac4e24dd1936e53f09b6b3c1122c8 Mon Sep 17 00:00:00 2001
-From: jkoshy <jkoshy@95820547-d848-0410-985e-9ae8fe0fa350>
-Date: Sun, 9 Jun 2019 17:01:37 +0000
-Subject: [PATCH] Ensure that the value of a 32-bit parameter passed to the
- ELF64_R_INFO() macro does not get lost.
-
-Submitted by: Michael Forney on -developers
-
-git-svn-id: https://svn.code.sf.net/p/elftoolchain/code/trunk@3742 95820547-d848-0410-985e-9ae8fe0fa350
----
- common/elfdefinitions.h | 3 ++-
- 1 file changed, 2 insertions(+), 1 deletion(-)
-
-diff --git a/common/elfdefinitions.h b/common/elfdefinitions.h
-index 7f8d9043..dae45583 100644
---- a/common/elfdefinitions.h
-+++ b/common/elfdefinitions.h
-@@ -2606,7 +2606,8 @@ typedef struct {
-
- #define ELF64_R_SYM(I) ((I) >> 32)
- #define ELF64_R_TYPE(I) ((I) & 0xFFFFFFFFUL)
--#define ELF64_R_INFO(S,T) (((S) << 32) + ((T) & 0xFFFFFFFFUL))
-+#define ELF64_R_INFO(S,T) \
-+ (((Elf64_Xword) (S) << 32) + ((T) & 0xFFFFFFFFUL))
-
- /*
- * Symbol versioning structures.
---
-2.20.1
-
diff --git a/pkg/elftoolchain/patch/0001-Prevent-empty-top-level-declarations.patch b/pkg/elftoolchain/patch/0001-Prevent-empty-top-level-declarations.patch
@@ -0,0 +1,25 @@
+From 1f3cf2b7c4232f82ae37a62bcccccaa1398d834b Mon Sep 17 00:00:00 2001
+From: Michael Forney <mforney@mforney.org>
+Date: Tue, 2 Jul 2019 23:49:18 -0700
+Subject: [PATCH] Prevent empty top-level declarations
+
+---
+ common/_elftc.h | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/common/_elftc.h b/common/_elftc.h
+index 5c4cf610..8c391fb5 100644
+--- a/common/_elftc.h
++++ b/common/_elftc.h
+@@ -305,7 +305,7 @@ struct name { \
+ #if defined(__GNUC__)
+ #define ELFTC_VCSID(ID) __asm__(".ident\t\"" ID "\"")
+ #else
+-#define ELFTC_VCSID(ID) /**/
++#define ELFTC_VCSID(ID) _Static_assert(1, "")
+ #endif
+
+ #endif
+--
+2.31.1
+
diff --git a/pkg/elftoolchain/patch/0002-Use-_Alignof-when-built-as-C11.patch b/pkg/elftoolchain/patch/0002-Use-_Alignof-when-built-as-C11.patch
@@ -0,0 +1,59 @@
+From 7233abcc2902766760f9dd26217df159d4e6340a Mon Sep 17 00:00:00 2001
+From: Michael Forney <mforney@mforney.org>
+Date: Tue, 2 Jul 2019 23:54:25 -0700
+Subject: [PATCH] Use _Alignof when built as C11
+
+---
+ libelf/libelf_align.c | 21 +++++++++++++++++----
+ 1 file changed, 17 insertions(+), 4 deletions(-)
+
+diff --git a/libelf/libelf_align.c b/libelf/libelf_align.c
+index c0cdce97..2150fea7 100644
+--- a/libelf/libelf_align.c
++++ b/libelf/libelf_align.c
+@@ -39,25 +39,38 @@ struct align {
+ unsigned int a64;
+ };
+
+-#ifdef __GNUC__
++#if __STDC_VERSION__ >= 201112L
++#define MALIGN(N) { \
++ .a32 = _Alignof(Elf32_##N), \
++ .a64 = _Alignof(Elf64_##N) \
++ }
++#define MALIGN64(V) { \
++ .a32 = 0, \
++ .a64 = _Alignof(Elf64_##V) \
++ }
++#define MALIGN_WORD() { \
++ .a32 = _Alignof(int32_t), \
++ .a64 = _Alignof(int64_t) \
++ }
++#elif defined(__GNUC__)
+ #define MALIGN(N) { \
+ .a32 = __alignof__(Elf32_##N), \
+ .a64 = __alignof__(Elf64_##N) \
+ }
+-#define MALIGN64(V) { \
++#define MALIGN64(V) { \
+ .a32 = 0, \
+ .a64 = __alignof__(Elf64_##V) \
+ }
+ #define MALIGN_WORD() { \
+ .a32 = __alignof__(int32_t), \
+ .a64 = __alignof__(int64_t) \
+- }
++ }
+ #elif defined(__lint__)
+ #define MALIGN(N) { .a32 = 0, .a64 = 0 }
+ #define MALIGN64(N) { .a32 = 0, .a64 = 0 }
+ #define MALIGN_WORD(N) { .a32 = 0, .a64 = 0 }
+ #else
+-#error Need the __alignof__ builtin.
++#error Need C11 _Alignof, or the __alignof__ builtin.
+ #endif
+ #define UNSUPPORTED() { \
+ .a32 = 0, \
+--
+2.31.1
+
diff --git a/pkg/elftoolchain/patch/0002-Use-preprocessor-defines-for-constants-out-of-range-.patch b/pkg/elftoolchain/patch/0002-Use-preprocessor-defines-for-constants-out-of-range-.patch
@@ -1,530 +0,0 @@
-From 61265f1723d00c3af174291f01ab58fe55e34a31 Mon Sep 17 00:00:00 2001
-From: Michael Forney <mforney@mforney.org>
-Date: Tue, 2 Jul 2019 23:24:30 -0700
-Subject: [PATCH] Use preprocessor defines for constants out of range of int
-
----
- common/elfdefinitions.h | 486 +++++++++++++---------------------------
- 1 file changed, 156 insertions(+), 330 deletions(-)
-
-diff --git a/common/elfdefinitions.h b/common/elfdefinitions.h
-index 2669d5c7..5d6a897e 100644
---- a/common/elfdefinitions.h
-+++ b/common/elfdefinitions.h
-@@ -345,105 +345,52 @@ enum {
- /*
- * Flags used in the executable header (field: e_flags).
- */
--#define _ELF_DEFINE_EHDR_FLAGS() \
--_ELF_DEFINE_EF(EF_ARM_RELEXEC, 0x00000001UL, \
-- "dynamic segment describes only how to relocate segments") \
--_ELF_DEFINE_EF(EF_ARM_HASENTRY, 0x00000002UL, \
-- "e_entry contains a program entry point") \
--_ELF_DEFINE_EF(EF_ARM_SYMSARESORTED, 0x00000004UL, \
-- "subsection of symbol table is sorted by symbol value") \
--_ELF_DEFINE_EF(EF_ARM_DYNSYMSUSESEGIDX, 0x00000008UL, \
-- "dynamic symbol st_shndx = containing segment index + 1") \
--_ELF_DEFINE_EF(EF_ARM_MAPSYMSFIRST, 0x00000010UL, \
-- "mapping symbols precede other local symbols in symtab") \
--_ELF_DEFINE_EF(EF_ARM_BE8, 0x00800000UL, \
-- "file contains BE-8 code") \
--_ELF_DEFINE_EF(EF_ARM_LE8, 0x00400000UL, \
-- "file contains LE-8 code") \
--_ELF_DEFINE_EF(EF_ARM_EABIMASK, 0xFF000000UL, \
-- "mask for ARM EABI version number (0 denotes GNU or unknown)") \
--_ELF_DEFINE_EF(EF_ARM_EABI_UNKNOWN, 0x00000000UL, \
-- "Unknown or GNU ARM EABI version number") \
--_ELF_DEFINE_EF(EF_ARM_EABI_VER1, 0x01000000UL, \
-- "ARM EABI version 1") \
--_ELF_DEFINE_EF(EF_ARM_EABI_VER2, 0x02000000UL, \
-- "ARM EABI version 2") \
--_ELF_DEFINE_EF(EF_ARM_EABI_VER3, 0x03000000UL, \
-- "ARM EABI version 3") \
--_ELF_DEFINE_EF(EF_ARM_EABI_VER4, 0x04000000UL, \
-- "ARM EABI version 4") \
--_ELF_DEFINE_EF(EF_ARM_EABI_VER5, 0x05000000UL, \
-- "ARM EABI version 5") \
--_ELF_DEFINE_EF(EF_ARM_INTERWORK, 0x00000004UL, \
-- "GNU EABI extension") \
--_ELF_DEFINE_EF(EF_ARM_APCS_26, 0x00000008UL, \
-- "GNU EABI extension") \
--_ELF_DEFINE_EF(EF_ARM_APCS_FLOAT, 0x00000010UL, \
-- "GNU EABI extension") \
--_ELF_DEFINE_EF(EF_ARM_PIC, 0x00000020UL, \
-- "GNU EABI extension") \
--_ELF_DEFINE_EF(EF_ARM_ALIGN8, 0x00000040UL, \
-- "GNU EABI extension") \
--_ELF_DEFINE_EF(EF_ARM_NEW_ABI, 0x00000080UL, \
-- "GNU EABI extension") \
--_ELF_DEFINE_EF(EF_ARM_OLD_ABI, 0x00000100UL, \
-- "GNU EABI extension") \
--_ELF_DEFINE_EF(EF_ARM_SOFT_FLOAT, 0x00000200UL, \
-- "GNU EABI extension") \
--_ELF_DEFINE_EF(EF_ARM_VFP_FLOAT, 0x00000400UL, \
-- "GNU EABI extension") \
--_ELF_DEFINE_EF(EF_ARM_MAVERICK_FLOAT, 0x00000800UL, \
-- "GNU EABI extension") \
--_ELF_DEFINE_EF(EF_MIPS_NOREORDER, 0x00000001UL, \
-- "at least one .noreorder directive appeared in the source") \
--_ELF_DEFINE_EF(EF_MIPS_PIC, 0x00000002UL, \
-- "file contains position independent code") \
--_ELF_DEFINE_EF(EF_MIPS_CPIC, 0x00000004UL, \
-- "file's code uses standard conventions for calling PIC") \
--_ELF_DEFINE_EF(EF_MIPS_UCODE, 0x00000010UL, \
-- "file contains UCODE (obsolete)") \
--_ELF_DEFINE_EF(EF_MIPS_ABI2, 0x00000020UL, \
-- "file follows MIPS III 32-bit ABI") \
--_ELF_DEFINE_EF(EF_MIPS_OPTIONS_FIRST, 0x00000080UL, \
-- "ld(1) should process .MIPS.options section first") \
--_ELF_DEFINE_EF(EF_MIPS_ARCH_ASE, 0x0F000000UL, \
-- "file uses application-specific architectural extensions") \
--_ELF_DEFINE_EF(EF_MIPS_ARCH_ASE_MDMX, 0x08000000UL, \
-- "file uses MDMX multimedia extensions") \
--_ELF_DEFINE_EF(EF_MIPS_ARCH_ASE_M16, 0x04000000UL, \
-- "file uses MIPS-16 ISA extensions") \
--_ELF_DEFINE_EF(EF_MIPS_ARCH, 0xF0000000UL, \
-- "4-bit MIPS architecture field") \
--_ELF_DEFINE_EF(EF_PPC_EMB, 0x80000000UL, \
-- "Embedded PowerPC flag") \
--_ELF_DEFINE_EF(EF_PPC_RELOCATABLE, 0x00010000UL, \
-- "-mrelocatable flag") \
--_ELF_DEFINE_EF(EF_PPC_RELOCATABLE_LIB, 0x00008000UL, \
-- "-mrelocatable-lib flag") \
--_ELF_DEFINE_EF(EF_SPARC_EXT_MASK, 0x00ffff00UL, \
-- "Vendor Extension mask") \
--_ELF_DEFINE_EF(EF_SPARC_32PLUS, 0x00000100UL, \
-- "Generic V8+ features") \
--_ELF_DEFINE_EF(EF_SPARC_SUN_US1, 0x00000200UL, \
-- "Sun UltraSPARCTM 1 Extensions") \
--_ELF_DEFINE_EF(EF_SPARC_HAL_R1, 0x00000400UL, "HAL R1 Extensions") \
--_ELF_DEFINE_EF(EF_SPARC_SUN_US3, 0x00000800UL, \
-- "Sun UltraSPARC 3 Extensions") \
--_ELF_DEFINE_EF(EF_SPARCV9_MM, 0x00000003UL, \
-- "Mask for Memory Model") \
--_ELF_DEFINE_EF(EF_SPARCV9_TSO, 0x00000000UL, \
-- "Total Store Ordering") \
--_ELF_DEFINE_EF(EF_SPARCV9_PSO, 0x00000001UL, \
-- "Partial Store Ordering") \
--_ELF_DEFINE_EF(EF_SPARCV9_RMO, 0x00000002UL, \
-- "Relaxed Memory Ordering")
--
--#undef _ELF_DEFINE_EF
--#define _ELF_DEFINE_EF(N, V, DESCR) N = V ,
--enum {
-- _ELF_DEFINE_EHDR_FLAGS()
-- EF__LAST__
--};
-+#define EF_ARM_RELEXEC 0x00000001UL /* dynamic segment describes only how to relocate segments */
-+#define EF_ARM_HASENTRY 0x00000002UL /* e_entry contains a program entry point */
-+#define EF_ARM_SYMSARESORTED 0x00000004UL /* subsection of symbol table is sorted by symbol value */
-+#define EF_ARM_DYNSYMSUSESEGIDX 0x00000008UL /* dynamic symbol st_shndx = containing segment index + 1 */
-+#define EF_ARM_MAPSYMSFIRST 0x00000010UL /* mapping symbols precede other local symbols in symtab */
-+#define EF_ARM_BE8 0x00800000UL /* file contains BE-8 code */
-+#define EF_ARM_LE8 0x00400000UL /* file contains LE-8 code */
-+#define EF_ARM_EABIMASK 0xFF000000UL /* mask for ARM EABI version number (0 denotes GNU or unknown) */
-+#define EF_ARM_EABI_UNKNOWN 0x00000000UL /* Unknown or GNU ARM EABI version number */
-+#define EF_ARM_EABI_VER1 0x01000000UL /* ARM EABI version 1 */
-+#define EF_ARM_EABI_VER2 0x02000000UL /* ARM EABI version 2 */
-+#define EF_ARM_EABI_VER3 0x03000000UL /* ARM EABI version 3 */
-+#define EF_ARM_EABI_VER4 0x04000000UL /* ARM EABI version 4 */
-+#define EF_ARM_EABI_VER5 0x05000000UL /* ARM EABI version 5 */
-+#define EF_ARM_INTERWORK 0x00000004UL /* GNU EABI extension */
-+#define EF_ARM_APCS_26 0x00000008UL /* GNU EABI extension */
-+#define EF_ARM_APCS_FLOAT 0x00000010UL /* GNU EABI extension */
-+#define EF_ARM_PIC 0x00000020UL /* GNU EABI extension */
-+#define EF_ARM_ALIGN8 0x00000040UL /* GNU EABI extension */
-+#define EF_ARM_NEW_ABI 0x00000080UL /* GNU EABI extension */
-+#define EF_ARM_OLD_ABI 0x00000100UL /* GNU EABI extension */
-+#define EF_ARM_SOFT_FLOAT 0x00000200UL /* GNU EABI extension */
-+#define EF_ARM_VFP_FLOAT 0x00000400UL /* GNU EABI extension */
-+#define EF_ARM_MAVERICK_FLOAT 0x00000800UL /* GNU EABI extension */
-+#define EF_MIPS_NOREORDER 0x00000001UL /* at least one .noreorder directive appeared in the source */
-+#define EF_MIPS_PIC 0x00000002UL /* file contains position independent code */
-+#define EF_MIPS_CPIC 0x00000004UL /* file's code uses standard conventions for calling PIC */
-+#define EF_MIPS_UCODE 0x00000010UL /* file contains UCODE (obsolete) */
-+#define EF_MIPS_ABI2 0x00000020UL /* file follows MIPS III 32-bit ABI */
-+#define EF_MIPS_OPTIONS_FIRST 0x00000080UL /* ld(1) should process .MIPS.options section first */
-+#define EF_MIPS_ARCH_ASE 0x0F000000UL /* file uses application-specific architectural extensions */
-+#define EF_MIPS_ARCH_ASE_MDMX 0x08000000UL /* file uses MDMX multimedia extensions */
-+#define EF_MIPS_ARCH_ASE_M16 0x04000000UL /* file uses MIPS-16 ISA extensions */
-+#define EF_MIPS_ARCH 0xF0000000UL /* 4-bit MIPS architecture field */
-+#define EF_PPC_EMB 0x80000000UL /* Embedded PowerPC flag */
-+#define EF_PPC_RELOCATABLE 0x00010000UL /* -mrelocatable flag */
-+#define EF_PPC_RELOCATABLE_LIB 0x00008000UL /* -mrelocatable-lib flag */
-+#define EF_SPARC_EXT_MASK 0x00ffff00UL /* Vendor Extension mask */
-+#define EF_SPARC_32PLUS 0x00000100UL /* Generic V8+ features */
-+#define EF_SPARC_SUN_US1 0x00000200UL /* Sun UltraSPARCTM 1 Extensions */
-+#define EF_SPARC_HAL_R1 0x00000400UL
-+#define EF_SPARC_SUN_US3 0x00000800UL /* Sun UltraSPARC 3 Extensions */
-+#define EF_SPARCV9_MM 0x00000003UL /* Mask for Memory Model */
-+#define EF_SPARCV9_TSO 0x00000000UL /* Total Store Ordering */
-+#define EF_SPARCV9_PSO 0x00000001UL /* Partial Store Ordering */
-+#define EF_SPARCV9_RMO 0x00000002UL /* Relaxed Memory Ordering */
-
- /*
- * Offsets in the `ei_ident[]` field of an ELF executable header.
-@@ -868,26 +815,14 @@ enum {
- /*
- * Flags used by program header table entries.
- */
--
--#define _ELF_DEFINE_PHDR_FLAGS() \
--_ELF_DEFINE_PF(PF_X, 0x1, "Execute") \
--_ELF_DEFINE_PF(PF_W, 0x2, "Write") \
--_ELF_DEFINE_PF(PF_R, 0x4, "Read") \
--_ELF_DEFINE_PF(PF_MASKOS, 0x0ff00000, "OS-specific flags") \
--_ELF_DEFINE_PF(PF_MASKPROC, 0xf0000000, "Processor-specific flags") \
--_ELF_DEFINE_PF(PF_ARM_SB, 0x10000000, \
-- "segment contains the location addressed by the static base") \
--_ELF_DEFINE_PF(PF_ARM_PI, 0x20000000, \
-- "segment is position-independent") \
--_ELF_DEFINE_PF(PF_ARM_ABS, 0x40000000, \
-- "segment must be loaded at its base address")
--
--#undef _ELF_DEFINE_PF
--#define _ELF_DEFINE_PF(N, V, DESCR) N = V ,
--enum {
-- _ELF_DEFINE_PHDR_FLAGS()
-- PF__LAST__
--};
-+#define PF_X 0x1 /* Execute */
-+#define PF_W 0x2 /* Write */
-+#define PF_R 0x4 /* Read */
-+#define PF_MASKOS 0x0ff00000 /* OS-specific flags */
-+#define PF_MASKPROC 0xf0000000 /* Processor-specific flags */
-+#define PF_ARM_SB 0x10000000 /* segment contains the location addressed by the static base */
-+#define PF_ARM_PI 0x20000000 /* segment is position-independent */
-+#define PF_ARM_ABS 0x40000000 /* segment must be loaded at its base address */
-
- /*
- * Types of program header table entries.
-@@ -954,66 +889,32 @@ enum {
- /*
- * Section flags.
- */
--
--#define _ELF_DEFINE_SECTION_FLAGS() \
--_ELF_DEFINE_SHF(SHF_WRITE, 0x1, \
-- "writable during program execution") \
--_ELF_DEFINE_SHF(SHF_ALLOC, 0x2, \
-- "occupies memory during program execution") \
--_ELF_DEFINE_SHF(SHF_EXECINSTR, 0x4, "executable instructions") \
--_ELF_DEFINE_SHF(SHF_MERGE, 0x10, \
-- "may be merged to prevent duplication") \
--_ELF_DEFINE_SHF(SHF_STRINGS, 0x20, \
-- "NUL-terminated character strings") \
--_ELF_DEFINE_SHF(SHF_INFO_LINK, 0x40, \
-- "the sh_info field holds a link") \
--_ELF_DEFINE_SHF(SHF_LINK_ORDER, 0x80, \
-- "special ordering requirements during linking") \
--_ELF_DEFINE_SHF(SHF_OS_NONCONFORMING, 0x100, \
-- "requires OS-specific processing during linking") \
--_ELF_DEFINE_SHF(SHF_GROUP, 0x200, \
-- "member of a section group") \
--_ELF_DEFINE_SHF(SHF_TLS, 0x400, \
-- "holds thread-local storage") \
--_ELF_DEFINE_SHF(SHF_COMPRESSED, 0x800, \
-- "holds compressed data") \
--_ELF_DEFINE_SHF(SHF_MASKOS, 0x0FF00000UL, \
-- "bits reserved for OS-specific semantics") \
--_ELF_DEFINE_SHF(SHF_AMD64_LARGE, 0x10000000UL, \
-- "section uses large code model") \
--_ELF_DEFINE_SHF(SHF_ENTRYSECT, 0x10000000UL, \
-- "section contains an entry point (ARM)") \
--_ELF_DEFINE_SHF(SHF_COMDEF, 0x80000000UL, \
-- "section may be multiply defined in input to link step (ARM)") \
--_ELF_DEFINE_SHF(SHF_MIPS_GPREL, 0x10000000UL, \
-- "section must be part of global data area") \
--_ELF_DEFINE_SHF(SHF_MIPS_MERGE, 0x20000000UL, \
-- "section data should be merged to eliminate duplication") \
--_ELF_DEFINE_SHF(SHF_MIPS_ADDR, 0x40000000UL, \
-- "section data is addressed by default") \
--_ELF_DEFINE_SHF(SHF_MIPS_STRING, 0x80000000UL, \
-- "section data is string data by default") \
--_ELF_DEFINE_SHF(SHF_MIPS_NOSTRIP, 0x08000000UL, \
-- "section data may not be stripped") \
--_ELF_DEFINE_SHF(SHF_MIPS_LOCAL, 0x04000000UL, \
-- "section data local to process") \
--_ELF_DEFINE_SHF(SHF_MIPS_NAMES, 0x02000000UL, \
-- "linker must generate implicit hidden weak names") \
--_ELF_DEFINE_SHF(SHF_MIPS_NODUPE, 0x01000000UL, \
-- "linker must retain only one copy") \
--_ELF_DEFINE_SHF(SHF_ORDERED, 0x40000000UL, \
-- "section is ordered with respect to other sections") \
--_ELF_DEFINE_SHF(SHF_EXCLUDE, 0x80000000UL, \
-- "section is excluded from executables and shared objects") \
--_ELF_DEFINE_SHF(SHF_MASKPROC, 0xF0000000UL, \
-- "bits reserved for processor-specific semantics")
--
--#undef _ELF_DEFINE_SHF
--#define _ELF_DEFINE_SHF(N, V, DESCR) N = V ,
--enum {
-- _ELF_DEFINE_SECTION_FLAGS()
-- SHF__LAST__
--};
-+#define SHF_WRITE 0x1 /* writable during program execution */
-+#define SHF_ALLOC 0x2 /* occupies memory during program execution */
-+#define SHF_EXECINSTR 0x4
-+#define SHF_MERGE 0x10 /* may be merged to prevent duplication */
-+#define SHF_STRINGS 0x20 /* NUL-terminated character strings */
-+#define SHF_INFO_LINK 0x40 /* the sh_info field holds a link */
-+#define SHF_LINK_ORDER 0x80 /* special ordering requirements during linking */
-+#define SHF_OS_NONCONFORMING 0x100 /* requires OS-specific processing during linking */
-+#define SHF_GROUP 0x200 /* member of a section group */
-+#define SHF_TLS 0x400 /* holds thread-local storage */
-+#define SHF_COMPRESSED 0x800 /* holds compressed data */
-+#define SHF_MASKOS 0x0FF00000UL /* bits reserved for OS-specific semantics */
-+#define SHF_AMD64_LARGE 0x10000000UL /* section uses large code model */
-+#define SHF_ENTRYSECT 0x10000000UL /* section contains an entry point (ARM) */
-+#define SHF_COMDEF 0x80000000UL /* section may be multiply defined in input to link step (ARM) */
-+#define SHF_MIPS_GPREL 0x10000000UL /* section must be part of global data area */
-+#define SHF_MIPS_MERGE 0x20000000UL /* section data should be merged to eliminate duplication */
-+#define SHF_MIPS_ADDR 0x40000000UL /* section data is addressed by default */
-+#define SHF_MIPS_STRING 0x80000000UL /* section data is string data by default */
-+#define SHF_MIPS_NOSTRIP 0x08000000UL /* section data may not be stripped */
-+#define SHF_MIPS_LOCAL 0x04000000UL /* section data local to process */
-+#define SHF_MIPS_NAMES 0x02000000UL /* linker must generate implicit hidden weak names */
-+#define SHF_MIPS_NODUPE 0x01000000UL /* linker must retain only one copy */
-+#define SHF_ORDERED 0x40000000UL /* section is ordered with respect to other sections */
-+#define SHF_EXCLUDE 0x80000000UL /* section is excluded from executables and shared objects */
-+#define SHF_MASKPROC 0xF0000000UL /* bits reserved for processor-specific semantics */
-
- /*
- * Special section indices.
-@@ -1059,157 +960,82 @@ enum {
- /*
- * Section types.
- */
--
--#define _ELF_DEFINE_SECTION_TYPES() \
--_ELF_DEFINE_SHT(SHT_NULL, 0, "inactive header") \
--_ELF_DEFINE_SHT(SHT_PROGBITS, 1, "program defined information") \
--_ELF_DEFINE_SHT(SHT_SYMTAB, 2, "symbol table") \
--_ELF_DEFINE_SHT(SHT_STRTAB, 3, "string table") \
--_ELF_DEFINE_SHT(SHT_RELA, 4, \
-- "relocation entries with addends") \
--_ELF_DEFINE_SHT(SHT_HASH, 5, "symbol hash table") \
--_ELF_DEFINE_SHT(SHT_DYNAMIC, 6, \
-- "information for dynamic linking") \
--_ELF_DEFINE_SHT(SHT_NOTE, 7, "additional notes") \
--_ELF_DEFINE_SHT(SHT_NOBITS, 8, "section occupying no space") \
--_ELF_DEFINE_SHT(SHT_REL, 9, \
-- "relocation entries without addends") \
--_ELF_DEFINE_SHT(SHT_SHLIB, 10, "reserved") \
--_ELF_DEFINE_SHT(SHT_DYNSYM, 11, "symbol table") \
--_ELF_DEFINE_SHT(SHT_INIT_ARRAY, 14, \
-- "pointers to initialization functions") \
--_ELF_DEFINE_SHT(SHT_FINI_ARRAY, 15, \
-- "pointers to termination functions") \
--_ELF_DEFINE_SHT(SHT_PREINIT_ARRAY, 16, \
-- "pointers to functions called before initialization") \
--_ELF_DEFINE_SHT(SHT_GROUP, 17, "defines a section group") \
--_ELF_DEFINE_SHT(SHT_SYMTAB_SHNDX, 18, \
-- "used for extended section numbering") \
--_ELF_DEFINE_SHT(SHT_LOOS, 0x60000000UL, \
-- "start of OS-specific range") \
--_ELF_DEFINE_SHT(SHT_SUNW_dof, 0x6FFFFFF4UL, \
-- "used by dtrace") \
--_ELF_DEFINE_SHT(SHT_SUNW_cap, 0x6FFFFFF5UL, \
-- "capability requirements") \
--_ELF_DEFINE_SHT(SHT_GNU_ATTRIBUTES, 0x6FFFFFF5UL, \
-- "object attributes") \
--_ELF_DEFINE_SHT(SHT_SUNW_SIGNATURE, 0x6FFFFFF6UL, \
-- "module verification signature") \
--_ELF_DEFINE_SHT(SHT_GNU_HASH, 0x6FFFFFF6UL, \
-- "GNU Hash sections") \
--_ELF_DEFINE_SHT(SHT_GNU_LIBLIST, 0x6FFFFFF7UL, \
-- "List of libraries to be prelinked") \
--_ELF_DEFINE_SHT(SHT_SUNW_ANNOTATE, 0x6FFFFFF7UL, \
-- "special section where unresolved references are allowed") \
--_ELF_DEFINE_SHT(SHT_SUNW_DEBUGSTR, 0x6FFFFFF8UL, \
-- "debugging information") \
--_ELF_DEFINE_SHT(SHT_CHECKSUM, 0x6FFFFFF8UL, \
-- "checksum for dynamic shared objects") \
--_ELF_DEFINE_SHT(SHT_SUNW_DEBUG, 0x6FFFFFF9UL, \
-- "debugging information") \
--_ELF_DEFINE_SHT(SHT_SUNW_move, 0x6FFFFFFAUL, \
-- "information to handle partially initialized symbols") \
--_ELF_DEFINE_SHT(SHT_SUNW_COMDAT, 0x6FFFFFFBUL, \
-- "section supporting merging of multiple copies of data") \
--_ELF_DEFINE_SHT(SHT_SUNW_syminfo, 0x6FFFFFFCUL, \
-- "additional symbol information") \
--_ELF_DEFINE_SHT(SHT_SUNW_verdef, 0x6FFFFFFDUL, \
-- "symbol versioning information") \
--_ELF_DEFINE_SHT(SHT_SUNW_verneed, 0x6FFFFFFEUL, \
-- "symbol versioning requirements") \
--_ELF_DEFINE_SHT(SHT_SUNW_versym, 0x6FFFFFFFUL, \
-- "symbol versioning table") \
--_ELF_DEFINE_SHT(SHT_HIOS, 0x6FFFFFFFUL, \
-- "end of OS-specific range") \
--_ELF_DEFINE_SHT(SHT_LOPROC, 0x70000000UL, \
-- "start of processor-specific range") \
--_ELF_DEFINE_SHT(SHT_ARM_EXIDX, 0x70000001UL, \
-- "exception index table") \
--_ELF_DEFINE_SHT(SHT_ARM_PREEMPTMAP, 0x70000002UL, \
-- "BPABI DLL dynamic linking preemption map") \
--_ELF_DEFINE_SHT(SHT_ARM_ATTRIBUTES, 0x70000003UL, \
-- "object file compatibility attributes") \
--_ELF_DEFINE_SHT(SHT_ARM_DEBUGOVERLAY, 0x70000004UL, \
-- "overlay debug information") \
--_ELF_DEFINE_SHT(SHT_ARM_OVERLAYSECTION, 0x70000005UL, \
-- "overlay debug information") \
--_ELF_DEFINE_SHT(SHT_MIPS_LIBLIST, 0x70000000UL, \
-- "DSO library information used in link") \
--_ELF_DEFINE_SHT(SHT_MIPS_MSYM, 0x70000001UL, \
-- "MIPS symbol table extension") \
--_ELF_DEFINE_SHT(SHT_MIPS_CONFLICT, 0x70000002UL, \
-- "symbol conflicting with DSO-defined symbols ") \
--_ELF_DEFINE_SHT(SHT_MIPS_GPTAB, 0x70000003UL, \
-- "global pointer table") \
--_ELF_DEFINE_SHT(SHT_MIPS_UCODE, 0x70000004UL, \
-- "reserved") \
--_ELF_DEFINE_SHT(SHT_MIPS_DEBUG, 0x70000005UL, \
-- "reserved (obsolete debug information)") \
--_ELF_DEFINE_SHT(SHT_MIPS_REGINFO, 0x70000006UL, \
-- "register usage information") \
--_ELF_DEFINE_SHT(SHT_MIPS_PACKAGE, 0x70000007UL, \
-- "OSF reserved") \
--_ELF_DEFINE_SHT(SHT_MIPS_PACKSYM, 0x70000008UL, \
-- "OSF reserved") \
--_ELF_DEFINE_SHT(SHT_MIPS_RELD, 0x70000009UL, \
-- "dynamic relocation") \
--_ELF_DEFINE_SHT(SHT_MIPS_IFACE, 0x7000000BUL, \
-- "subprogram interface information") \
--_ELF_DEFINE_SHT(SHT_MIPS_CONTENT, 0x7000000CUL, \
-- "section content classification") \
--_ELF_DEFINE_SHT(SHT_MIPS_OPTIONS, 0x7000000DUL, \
-- "general options") \
--_ELF_DEFINE_SHT(SHT_MIPS_DELTASYM, 0x7000001BUL, \
-- "Delta C++: symbol table") \
--_ELF_DEFINE_SHT(SHT_MIPS_DELTAINST, 0x7000001CUL, \
-- "Delta C++: instance table") \
--_ELF_DEFINE_SHT(SHT_MIPS_DELTACLASS, 0x7000001DUL, \
-- "Delta C++: class table") \
--_ELF_DEFINE_SHT(SHT_MIPS_DWARF, 0x7000001EUL, \
-- "DWARF debug information") \
--_ELF_DEFINE_SHT(SHT_MIPS_DELTADECL, 0x7000001FUL, \
-- "Delta C++: declarations") \
--_ELF_DEFINE_SHT(SHT_MIPS_SYMBOL_LIB, 0x70000020UL, \
-- "symbol-to-library mapping") \
--_ELF_DEFINE_SHT(SHT_MIPS_EVENTS, 0x70000021UL, \
-- "event locations") \
--_ELF_DEFINE_SHT(SHT_MIPS_TRANSLATE, 0x70000022UL, \
-- "???") \
--_ELF_DEFINE_SHT(SHT_MIPS_PIXIE, 0x70000023UL, \
-- "special pixie sections") \
--_ELF_DEFINE_SHT(SHT_MIPS_XLATE, 0x70000024UL, \
-- "address translation table") \
--_ELF_DEFINE_SHT(SHT_MIPS_XLATE_DEBUG, 0x70000025UL, \
-- "SGI internal address translation table") \
--_ELF_DEFINE_SHT(SHT_MIPS_WHIRL, 0x70000026UL, \
-- "intermediate code") \
--_ELF_DEFINE_SHT(SHT_MIPS_EH_REGION, 0x70000027UL, \
-- "C++ exception handling region info") \
--_ELF_DEFINE_SHT(SHT_MIPS_XLATE_OLD, 0x70000028UL, \
-- "obsolete") \
--_ELF_DEFINE_SHT(SHT_MIPS_PDR_EXCEPTION, 0x70000029UL, \
-- "runtime procedure descriptor table exception information") \
--_ELF_DEFINE_SHT(SHT_MIPS_ABIFLAGS, 0x7000002AUL, \
-- "ABI flags") \
--_ELF_DEFINE_SHT(SHT_SPARC_GOTDATA, 0x70000000UL, \
-- "SPARC-specific data") \
--_ELF_DEFINE_SHT(SHT_AMD64_UNWIND, 0x70000001UL, \
-- "unwind tables for the AMD64") \
--_ELF_DEFINE_SHT(SHT_ORDERED, 0x7FFFFFFFUL, \
-- "sort entries in the section") \
--_ELF_DEFINE_SHT(SHT_HIPROC, 0x7FFFFFFFUL, \
-- "end of processor-specific range") \
--_ELF_DEFINE_SHT(SHT_LOUSER, 0x80000000UL, \
-- "start of application-specific range") \
--_ELF_DEFINE_SHT(SHT_HIUSER, 0xFFFFFFFFUL, \
-- "end of application-specific range")
--
--#undef _ELF_DEFINE_SHT
--#define _ELF_DEFINE_SHT(N, V, DESCR) N = V ,
--enum {
-- _ELF_DEFINE_SECTION_TYPES()
-- SHT__LAST__ = SHT_HIUSER
--};
-+#define SHT_NULL 0 /* inactive header */
-+#define SHT_PROGBITS 1 /* program defined information */
-+#define SHT_SYMTAB 2 /* symbol table */
-+#define SHT_STRTAB 3 /* string table */
-+#define SHT_RELA 4 /* relocation entries with addends */
-+#define SHT_HASH 5 /* symbol hash table */
-+#define SHT_DYNAMIC 6 /* information for dynamic linking */
-+#define SHT_NOTE 7 /* additional notes */
-+#define SHT_NOBITS 8 /* section occupying no space */
-+#define SHT_REL 9 /* relocation entries without addends */
-+#define SHT_SHLIB 10 /* reserved */
-+#define SHT_DYNSYM 11 /* symbol table */
-+#define SHT_INIT_ARRAY 14 /* pointers to initialization functions */
-+#define SHT_FINI_ARRAY 15 /* pointers to termination functions */
-+#define SHT_PREINIT_ARRAY 16 /* pointers to functions called before initialization */
-+#define SHT_GROUP 17 /* defines a section group */
-+#define SHT_SYMTAB_SHNDX 18 /* used for extended section numbering */
-+#define SHT_LOOS 0x60000000UL /* start of OS-specific range */
-+#define SHT_SUNW_dof 0x6FFFFFF4UL /* used by dtrace */
-+#define SHT_SUNW_cap 0x6FFFFFF5UL /* capability requirements */
-+#define SHT_GNU_ATTRIBUTES 0x6FFFFFF5UL /* object attributes */
-+#define SHT_SUNW_SIGNATURE 0x6FFFFFF6UL /* module verification signature */
-+#define SHT_GNU_HASH 0x6FFFFFF6UL /* GNU Hash sections */
-+#define SHT_GNU_LIBLIST 0x6FFFFFF7UL /* List of libraries to be prelinked */
-+#define SHT_SUNW_ANNOTATE 0x6FFFFFF7UL /* special section where unresolved references are allowed */
-+#define SHT_SUNW_DEBUGSTR 0x6FFFFFF8UL /* debugging information */
-+#define SHT_CHECKSUM 0x6FFFFFF8UL /* checksum for dynamic shared objects */
-+#define SHT_SUNW_DEBUG 0x6FFFFFF9UL /* debugging information */
-+#define SHT_SUNW_move 0x6FFFFFFAUL /* information to handle partially initialized symbols */
-+#define SHT_SUNW_COMDAT 0x6FFFFFFBUL /* section supporting merging of multiple copies of data */
-+#define SHT_SUNW_syminfo 0x6FFFFFFCUL /* additional symbol information */
-+#define SHT_SUNW_verdef 0x6FFFFFFDUL /* symbol versioning information */
-+#define SHT_SUNW_verneed 0x6FFFFFFEUL /* symbol versioning requirements */
-+#define SHT_SUNW_versym 0x6FFFFFFFUL /* symbol versioning table */
-+#define SHT_HIOS 0x6FFFFFFFUL /* end of OS-specific range */
-+#define SHT_LOPROC 0x70000000UL /* start of processor-specific range */
-+#define SHT_ARM_EXIDX 0x70000001UL /* exception index table */
-+#define SHT_ARM_PREEMPTMAP 0x70000002UL /* BPABI DLL dynamic linking preemption map */
-+#define SHT_ARM_ATTRIBUTES 0x70000003UL /* object file compatibility attributes */
-+#define SHT_ARM_DEBUGOVERLAY 0x70000004UL /* overlay debug information */
-+#define SHT_ARM_OVERLAYSECTION 0x70000005UL /* overlay debug information */
-+#define SHT_MIPS_LIBLIST 0x70000000UL /* DSO library information used in link */
-+#define SHT_MIPS_MSYM 0x70000001UL /* MIPS symbol table extension */
-+#define SHT_MIPS_CONFLICT 0x70000002UL /* symbol conflicting with DSO-defined symbols */
-+#define SHT_MIPS_GPTAB 0x70000003UL /* global pointer table */
-+#define SHT_MIPS_UCODE 0x70000004UL /* reserved */
-+#define SHT_MIPS_DEBUG 0x70000005UL /* reserved (obsolete debug information) */
-+#define SHT_MIPS_REGINFO 0x70000006UL /* register usage information */
-+#define SHT_MIPS_PACKAGE 0x70000007UL /* OSF reserved */
-+#define SHT_MIPS_PACKSYM 0x70000008UL /* OSF reserved */
-+#define SHT_MIPS_RELD 0x70000009UL /* dynamic relocation */
-+#define SHT_MIPS_IFACE 0x7000000BUL /* subprogram interface information */
-+#define SHT_MIPS_CONTENT 0x7000000CUL /* section content classification */
-+#define SHT_MIPS_OPTIONS 0x7000000DUL /* general options */
-+#define SHT_MIPS_DELTASYM 0x7000001BUL /* Delta C++: symbol table */
-+#define SHT_MIPS_DELTAINST 0x7000001CUL /* Delta C++: instance table */
-+#define SHT_MIPS_DELTACLASS 0x7000001DUL /* Delta C++: class table */
-+#define SHT_MIPS_DWARF 0x7000001EUL /* DWARF debug information */
-+#define SHT_MIPS_DELTADECL 0x7000001FUL /* Delta C++: declarations */
-+#define SHT_MIPS_SYMBOL_LIB 0x70000020UL /* symbol-to-library mapping */
-+#define SHT_MIPS_EVENTS 0x70000021UL /* event locations */
-+#define SHT_MIPS_TRANSLATE 0x70000022UL /* ??? */
-+#define SHT_MIPS_PIXIE 0x70000023UL /* special pixie sections */
-+#define SHT_MIPS_XLATE 0x70000024UL /* address translation table */
-+#define SHT_MIPS_XLATE_DEBUG 0x70000025UL /* SGI internal address translation table */
-+#define SHT_MIPS_WHIRL 0x70000026UL /* intermediate code */
-+#define SHT_MIPS_EH_REGION 0x70000027UL /* C++ exception handling region info */
-+#define SHT_MIPS_XLATE_OLD 0x70000028UL /* obsolete */
-+#define SHT_MIPS_PDR_EXCEPTION 0x70000029UL /* runtime procedure descriptor table exception information */
-+#define SHT_MIPS_ABIFLAGS 0x7000002AUL /* ABI flags */
-+#define SHT_SPARC_GOTDATA 0x70000000UL /* SPARC-specific data */
-+#define SHT_AMD64_UNWIND 0x70000001UL /* unwind tables for the AMD64 */
-+#define SHT_ORDERED 0x7FFFFFFFUL /* sort entries in the section */
-+#define SHT_HIPROC 0x7FFFFFFFUL /* end of processor-specific range */
-+#define SHT_LOUSER 0x80000000UL /* start of application-specific range */
-+#define SHT_HIUSER 0xFFFFFFFFUL /* end of application-specific range */
-
- /* Aliases for section types. */
- #define SHT_GNU_verdef SHT_SUNW_verdef
---
-2.22.0
-
diff --git a/pkg/elftoolchain/patch/0003-Prevent-empty-top-level-declarations.patch b/pkg/elftoolchain/patch/0003-Prevent-empty-top-level-declarations.patch
@@ -1,48 +0,0 @@
-From 9f83cd2e4af19212d26cdacf07d4b86262106383 Mon Sep 17 00:00:00 2001
-From: Michael Forney <mforney@mforney.org>
-Date: Tue, 2 Jul 2019 23:49:18 -0700
-Subject: [PATCH] Prevent empty top-level declarations
-
----
- common/_elftc.h | 8 ++++----
- 1 file changed, 4 insertions(+), 4 deletions(-)
-
-diff --git a/common/_elftc.h b/common/_elftc.h
-index c3df36cb..f0da3d00 100644
---- a/common/_elftc.h
-+++ b/common/_elftc.h
-@@ -299,7 +299,7 @@ struct name { \
- #if defined(__GNUC__)
- #define ELFTC_VCSID(ID) __asm__(".ident\t\"" ID "\"")
- #else
--#define ELFTC_VCSID(ID) /**/
-+#define ELFTC_VCSID(ID) _Static_assert(1, "")
- #endif
- #endif
-
-@@ -307,19 +307,19 @@ struct name { \
- #if defined(__GNUC__)
- #define ELFTC_VCSID(ID) __asm__(".ident\t\"" ID "\"")
- #else
--#define ELFTC_VCSID(ID) /**/
-+#define ELFTC_VCSID(ID) _Static_assert(1, "")
- #endif /* __GNU__ */
- #endif
-
- #if defined(__NetBSD__)
--#define ELFTC_VCSID(ID) __RCSID(ID)
-+#define ELFTC_VCSID(ID) _Static_assert(1, "")
- #endif
-
- #if defined(__OpenBSD__)
- #if defined(__GNUC__)
- #define ELFTC_VCSID(ID) __asm__(".ident\t\"" ID "\"")
- #else
--#define ELFTC_VCSID(ID) /**/
-+#define ELFTC_VCSID(ID) _Static_assert(1, "")
- #endif /* __GNUC__ */
- #endif
-
---
-2.22.0
-
diff --git a/pkg/elftoolchain/patch/0003-Revert-Add-back-sys-cdefs.h.patch b/pkg/elftoolchain/patch/0003-Revert-Add-back-sys-cdefs.h.patch
@@ -0,0 +1,834 @@
+From a2b4fa9da830e1345df70c3372d6cfc14faf8f07 Mon Sep 17 00:00:00 2001
+From: Michael Forney <mforney@mforney.org>
+Date: Thu, 29 Apr 2021 12:09:05 -0700
+Subject: [PATCH] Revert "Add back <sys/cdefs.h>."
+
+This reverts commit 301fff723d18730ade4ef4034ed36fd6369f1886.
+---
+ libelf/elf.c | 2 --
+ libelf/elf_begin.c | 2 --
+ libelf/elf_cntl.c | 2 --
+ libelf/elf_data.c | 2 --
+ libelf/elf_end.c | 2 --
+ libelf/elf_errmsg.c | 2 --
+ libelf/elf_errno.c | 2 --
+ libelf/elf_fill.c | 2 --
+ libelf/elf_flag.c | 2 --
+ libelf/elf_getarhdr.c | 2 --
+ libelf/elf_getarsym.c | 2 --
+ libelf/elf_getbase.c | 2 --
+ libelf/elf_getident.c | 2 --
+ libelf/elf_getversion.c | 2 --
+ libelf/elf_hash.c | 2 --
+ libelf/elf_kind.c | 2 --
+ libelf/elf_memory.c | 2 --
+ libelf/elf_next.c | 2 --
+ libelf/elf_open.c | 2 --
+ libelf/elf_phnum.c | 2 --
+ libelf/elf_rand.c | 2 --
+ libelf/elf_rawfile.c | 2 --
+ libelf/elf_scn.c | 1 -
+ libelf/elf_shnum.c | 2 --
+ libelf/elf_shstrndx.c | 2 --
+ libelf/elf_strptr.c | 1 -
+ libelf/elf_update.c | 1 -
+ libelf/elf_version.c | 2 --
+ libelf/gelf_cap.c | 2 --
+ libelf/gelf_checksum.c | 2 --
+ libelf/gelf_dyn.c | 2 --
+ libelf/gelf_ehdr.c | 2 --
+ libelf/gelf_fsize.c | 2 --
+ libelf/gelf_getclass.c | 2 --
+ libelf/gelf_move.c | 2 --
+ libelf/gelf_phdr.c | 2 --
+ libelf/gelf_rel.c | 2 --
+ libelf/gelf_rela.c | 2 --
+ libelf/gelf_shdr.c | 2 --
+ libelf/gelf_sym.c | 2 --
+ libelf/gelf_syminfo.c | 2 --
+ libelf/gelf_symshndx.c | 2 --
+ libelf/gelf_xlate.c | 2 --
+ libelf/libelf_allocate.c | 2 --
+ libelf/libelf_ar.c | 2 --
+ libelf/libelf_ar_util.c | 2 --
+ libelf/libelf_checksum.c | 2 --
+ libelf/libelf_convert.m4 | 2 --
+ libelf/libelf_data.c | 2 --
+ libelf/libelf_ehdr.c | 2 --
+ libelf/libelf_elfmachine.c | 2 --
+ libelf/libelf_extended.c | 2 --
+ libelf/libelf_fsize.m4 | 2 --
+ libelf/libelf_memory.c | 2 --
+ libelf/libelf_msize.m4 | 2 --
+ libelf/libelf_open.c | 1 -
+ libelf/libelf_phdr.c | 2 --
+ libelf/libelf_shdr.c | 2 --
+ libelf/libelf_xlate.c | 2 --
+ 59 files changed, 114 deletions(-)
+
+diff --git a/libelf/elf.c b/libelf/elf.c
+index 3eac4f47..b391c43a 100644
+--- a/libelf/elf.c
++++ b/libelf/elf.c
+@@ -24,8 +24,6 @@
+ * SUCH DAMAGE.
+ */
+
+-#include <sys/cdefs.h>
+-
+ #include <libelf.h>
+
+ #include "_libelf.h"
+diff --git a/libelf/elf_begin.c b/libelf/elf_begin.c
+index f7b1b552..0eccc5f8 100644
+--- a/libelf/elf_begin.c
++++ b/libelf/elf_begin.c
+@@ -24,8 +24,6 @@
+ * SUCH DAMAGE.
+ */
+
+-#include <sys/cdefs.h>
+-
+ #include <libelf.h>
+
+ #include "_libelf.h"
+diff --git a/libelf/elf_cntl.c b/libelf/elf_cntl.c
+index 92efa3b4..0f892fd4 100644
+--- a/libelf/elf_cntl.c
++++ b/libelf/elf_cntl.c
+@@ -24,8 +24,6 @@
+ * SUCH DAMAGE.
+ */
+
+-#include <sys/cdefs.h>
+-
+ #include <libelf.h>
+
+ #include "_libelf.h"
+diff --git a/libelf/elf_data.c b/libelf/elf_data.c
+index 9101c1ac..0a380464 100644
+--- a/libelf/elf_data.c
++++ b/libelf/elf_data.c
+@@ -24,8 +24,6 @@
+ * SUCH DAMAGE.
+ */
+
+-#include <sys/cdefs.h>
+-
+ #include <assert.h>
+ #include <errno.h>
+ #include <libelf.h>
+diff --git a/libelf/elf_end.c b/libelf/elf_end.c
+index c5920c11..8e483236 100644
+--- a/libelf/elf_end.c
++++ b/libelf/elf_end.c
+@@ -24,8 +24,6 @@
+ * SUCH DAMAGE.
+ */
+
+-#include <sys/cdefs.h>
+-
+ #include <assert.h>
+ #include <libelf.h>
+ #include <stdlib.h>
+diff --git a/libelf/elf_errmsg.c b/libelf/elf_errmsg.c
+index de242828..e5f54762 100644
+--- a/libelf/elf_errmsg.c
++++ b/libelf/elf_errmsg.c
+@@ -24,8 +24,6 @@
+ * SUCH DAMAGE.
+ */
+
+-#include <sys/cdefs.h>
+-
+ #include <libelf.h>
+ #include <stdio.h>
+ #include <string.h>
+diff --git a/libelf/elf_errno.c b/libelf/elf_errno.c
+index baf6c0d7..056f129e 100644
+--- a/libelf/elf_errno.c
++++ b/libelf/elf_errno.c
+@@ -24,8 +24,6 @@
+ * SUCH DAMAGE.
+ */
+
+-#include <sys/cdefs.h>
+-
+ #include <libelf.h>
+
+ #include "_libelf.h"
+diff --git a/libelf/elf_fill.c b/libelf/elf_fill.c
+index a6499182..bddec5d1 100644
+--- a/libelf/elf_fill.c
++++ b/libelf/elf_fill.c
+@@ -24,8 +24,6 @@
+ * SUCH DAMAGE.
+ */
+
+-#include <sys/cdefs.h>
+-
+ #include <libelf.h>
+
+ #include "_libelf.h"
+diff --git a/libelf/elf_flag.c b/libelf/elf_flag.c
+index 0e68ef08..9c56cfac 100644
+--- a/libelf/elf_flag.c
++++ b/libelf/elf_flag.c
+@@ -24,8 +24,6 @@
+ * SUCH DAMAGE.
+ */
+
+-#include <sys/cdefs.h>
+-
+ #include <libelf.h>
+
+ #include "_libelf.h"
+diff --git a/libelf/elf_getarhdr.c b/libelf/elf_getarhdr.c
+index 139ff36d..1a33171e 100644
+--- a/libelf/elf_getarhdr.c
++++ b/libelf/elf_getarhdr.c
+@@ -24,8 +24,6 @@
+ * SUCH DAMAGE.
+ */
+
+-#include <sys/cdefs.h>
+-
+ #include <libelf.h>
+
+ #include "_libelf.h"
+diff --git a/libelf/elf_getarsym.c b/libelf/elf_getarsym.c
+index e9bd479e..4bfaf7f7 100644
+--- a/libelf/elf_getarsym.c
++++ b/libelf/elf_getarsym.c
+@@ -24,8 +24,6 @@
+ * SUCH DAMAGE.
+ */
+
+-#include <sys/cdefs.h>
+-
+ #include <libelf.h>
+
+ #include "_libelf.h"
+diff --git a/libelf/elf_getbase.c b/libelf/elf_getbase.c
+index fe378afa..c42c0649 100644
+--- a/libelf/elf_getbase.c
++++ b/libelf/elf_getbase.c
+@@ -24,8 +24,6 @@
+ * SUCH DAMAGE.
+ */
+
+-#include <sys/cdefs.h>
+-
+ #include <libelf.h>
+
+ #include "_libelf.h"
+diff --git a/libelf/elf_getident.c b/libelf/elf_getident.c
+index 701b1f20..c7d33a28 100644
+--- a/libelf/elf_getident.c
++++ b/libelf/elf_getident.c
+@@ -24,8 +24,6 @@
+ * SUCH DAMAGE.
+ */
+
+-#include <sys/cdefs.h>
+-
+ #include <ar.h>
+ #include <assert.h>
+ #include <libelf.h>
+diff --git a/libelf/elf_getversion.c b/libelf/elf_getversion.c
+index 24e68e6d..b967453c 100644
+--- a/libelf/elf_getversion.c
++++ b/libelf/elf_getversion.c
+@@ -24,8 +24,6 @@
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+-#include <sys/cdefs.h>
+-
+ #include <libelf.h>
+
+ #include "_libelf.h"
+diff --git a/libelf/elf_hash.c b/libelf/elf_hash.c
+index 8d20acbd..f61e8268 100644
+--- a/libelf/elf_hash.c
++++ b/libelf/elf_hash.c
+@@ -24,8 +24,6 @@
+ * SUCH DAMAGE.
+ */
+
+-#include <sys/cdefs.h>
+-
+ #include <libelf.h>
+
+ #include "_libelf.h"
+diff --git a/libelf/elf_kind.c b/libelf/elf_kind.c
+index d182c37b..45989800 100644
+--- a/libelf/elf_kind.c
++++ b/libelf/elf_kind.c
+@@ -24,8 +24,6 @@
+ * SUCH DAMAGE.
+ */
+
+-#include <sys/cdefs.h>
+-
+ #include <libelf.h>
+
+ #include "_libelf.h"
+diff --git a/libelf/elf_memory.c b/libelf/elf_memory.c
+index 21cf2d2d..0544998c 100644
+--- a/libelf/elf_memory.c
++++ b/libelf/elf_memory.c
+@@ -24,8 +24,6 @@
+ * SUCH DAMAGE.
+ */
+
+-#include <sys/cdefs.h>
+-
+ #include <libelf.h>
+
+ #include "_libelf.h"
+diff --git a/libelf/elf_next.c b/libelf/elf_next.c
+index 66fd2e22..e2fe9a2b 100644
+--- a/libelf/elf_next.c
++++ b/libelf/elf_next.c
+@@ -24,8 +24,6 @@
+ * SUCH DAMAGE.
+ */
+
+-#include <sys/cdefs.h>
+-
+ #include <ar.h>
+ #include <assert.h>
+ #include <libelf.h>
+diff --git a/libelf/elf_open.c b/libelf/elf_open.c
+index 577bcc7f..adad0610 100644
+--- a/libelf/elf_open.c
++++ b/libelf/elf_open.c
+@@ -24,8 +24,6 @@
+ * SUCH DAMAGE.
+ */
+
+-#include <sys/cdefs.h>
+-
+ #include <libelf.h>
+
+ #include "_libelf.h"
+diff --git a/libelf/elf_phnum.c b/libelf/elf_phnum.c
+index 3ade2c45..3d2b1bcd 100644
+--- a/libelf/elf_phnum.c
++++ b/libelf/elf_phnum.c
+@@ -24,8 +24,6 @@
+ * SUCH DAMAGE.
+ */
+
+-#include <sys/cdefs.h>
+-
+ #include <ar.h>
+ #include <libelf.h>
+
+diff --git a/libelf/elf_rand.c b/libelf/elf_rand.c
+index 6946fa6a..eafb0686 100644
+--- a/libelf/elf_rand.c
++++ b/libelf/elf_rand.c
+@@ -24,8 +24,6 @@
+ * SUCH DAMAGE.
+ */
+
+-#include <sys/cdefs.h>
+-
+ #include <ar.h>
+ #include <libelf.h>
+
+diff --git a/libelf/elf_rawfile.c b/libelf/elf_rawfile.c
+index cd048e3a..5a5452b5 100644
+--- a/libelf/elf_rawfile.c
++++ b/libelf/elf_rawfile.c
+@@ -24,8 +24,6 @@
+ * SUCH DAMAGE.
+ */
+
+-#include <sys/cdefs.h>
+-
+ #include <libelf.h>
+
+ #include "_libelf.h"
+diff --git a/libelf/elf_scn.c b/libelf/elf_scn.c
+index 2557581a..dfa77f53 100644
+--- a/libelf/elf_scn.c
++++ b/libelf/elf_scn.c
+@@ -24,7 +24,6 @@
+ * SUCH DAMAGE.
+ */
+
+-#include <sys/cdefs.h>
+ #include <sys/queue.h>
+
+ #include <assert.h>
+diff --git a/libelf/elf_shnum.c b/libelf/elf_shnum.c
+index 4319a249..fbc0d0d5 100644
+--- a/libelf/elf_shnum.c
++++ b/libelf/elf_shnum.c
+@@ -24,8 +24,6 @@
+ * SUCH DAMAGE.
+ */
+
+-#include <sys/cdefs.h>
+-
+ #include <ar.h>
+ #include <libelf.h>
+
+diff --git a/libelf/elf_shstrndx.c b/libelf/elf_shstrndx.c
+index 90c4b57a..ef62285d 100644
+--- a/libelf/elf_shstrndx.c
++++ b/libelf/elf_shstrndx.c
+@@ -24,8 +24,6 @@
+ * SUCH DAMAGE.
+ */
+
+-#include <sys/cdefs.h>
+-
+ #include <ar.h>
+ #include <libelf.h>
+
+diff --git a/libelf/elf_strptr.c b/libelf/elf_strptr.c
+index 6a9e7c5d..5c594b45 100644
+--- a/libelf/elf_strptr.c
++++ b/libelf/elf_strptr.c
+@@ -24,7 +24,6 @@
+ * SUCH DAMAGE.
+ */
+
+-#include <sys/cdefs.h>
+ #include <sys/param.h>
+
+ #include <assert.h>
+diff --git a/libelf/elf_update.c b/libelf/elf_update.c
+index baf64809..3e19b78a 100644
+--- a/libelf/elf_update.c
++++ b/libelf/elf_update.c
+@@ -24,7 +24,6 @@
+ * SUCH DAMAGE.
+ */
+
+-#include <sys/cdefs.h>
+ #include <sys/param.h>
+ #include <sys/stat.h>
+
+diff --git a/libelf/elf_version.c b/libelf/elf_version.c
+index 4d4d9e06..f2037a16 100644
+--- a/libelf/elf_version.c
++++ b/libelf/elf_version.c
+@@ -24,8 +24,6 @@
+ * SUCH DAMAGE.
+ */
+
+-#include <sys/cdefs.h>
+-
+ #include <libelf.h>
+
+ #include "_libelf.h"
+diff --git a/libelf/gelf_cap.c b/libelf/gelf_cap.c
+index ed63d793..2e82fdf2 100644
+--- a/libelf/gelf_cap.c
++++ b/libelf/gelf_cap.c
+@@ -24,8 +24,6 @@
+ * SUCH DAMAGE.
+ */
+
+-#include <sys/cdefs.h>
+-
+ #include <assert.h>
+ #include <gelf.h>
+ #include <limits.h>
+diff --git a/libelf/gelf_checksum.c b/libelf/gelf_checksum.c
+index ae1f1015..d29dd25f 100644
+--- a/libelf/gelf_checksum.c
++++ b/libelf/gelf_checksum.c
+@@ -24,8 +24,6 @@
+ * SUCH DAMAGE.
+ */
+
+-#include <sys/cdefs.h>
+-
+ #include <gelf.h>
+ #include <libelf.h>
+
+diff --git a/libelf/gelf_dyn.c b/libelf/gelf_dyn.c
+index 950b9a72..653d39a5 100644
+--- a/libelf/gelf_dyn.c
++++ b/libelf/gelf_dyn.c
+@@ -24,8 +24,6 @@
+ * SUCH DAMAGE.
+ */
+
+-#include <sys/cdefs.h>
+-
+ #include <assert.h>
+ #include <gelf.h>
+ #include <limits.h>
+diff --git a/libelf/gelf_ehdr.c b/libelf/gelf_ehdr.c
+index 30983333..d6b42c7c 100644
+--- a/libelf/gelf_ehdr.c
++++ b/libelf/gelf_ehdr.c
+@@ -24,8 +24,6 @@
+ * SUCH DAMAGE.
+ */
+
+-#include <sys/cdefs.h>
+-
+ #include <assert.h>
+ #include <gelf.h>
+ #include <libelf.h>
+diff --git a/libelf/gelf_fsize.c b/libelf/gelf_fsize.c
+index 8cfeb7cc..3eeeb80c 100644
+--- a/libelf/gelf_fsize.c
++++ b/libelf/gelf_fsize.c
+@@ -24,8 +24,6 @@
+ * SUCH DAMAGE.
+ */
+
+-#include <sys/cdefs.h>
+-
+ #include <gelf.h>
+ #include <libelf.h>
+
+diff --git a/libelf/gelf_getclass.c b/libelf/gelf_getclass.c
+index eb8bfd4e..3e5bf4f3 100644
+--- a/libelf/gelf_getclass.c
++++ b/libelf/gelf_getclass.c
+@@ -24,8 +24,6 @@
+ * SUCH DAMAGE.
+ */
+
+-#include <sys/cdefs.h>
+-
+ #include <gelf.h>
+
+ #include "_libelf.h"
+diff --git a/libelf/gelf_move.c b/libelf/gelf_move.c
+index d3f2011e..20bc0d86 100644
+--- a/libelf/gelf_move.c
++++ b/libelf/gelf_move.c
+@@ -24,8 +24,6 @@
+ * SUCH DAMAGE.
+ */
+
+-#include <sys/cdefs.h>
+-
+ #include <assert.h>
+ #include <gelf.h>
+ #include <limits.h>
+diff --git a/libelf/gelf_phdr.c b/libelf/gelf_phdr.c
+index 0ac2c8bf..5996910d 100644
+--- a/libelf/gelf_phdr.c
++++ b/libelf/gelf_phdr.c
+@@ -24,8 +24,6 @@
+ * SUCH DAMAGE.
+ */
+
+-#include <sys/cdefs.h>
+-
+ #include <gelf.h>
+ #include <libelf.h>
+ #include <limits.h>
+diff --git a/libelf/gelf_rel.c b/libelf/gelf_rel.c
+index 1a1459ab..60332597 100644
+--- a/libelf/gelf_rel.c
++++ b/libelf/gelf_rel.c
+@@ -24,8 +24,6 @@
+ * SUCH DAMAGE.
+ */
+
+-#include <sys/cdefs.h>
+-
+ #include <assert.h>
+ #include <gelf.h>
+ #include <limits.h>
+diff --git a/libelf/gelf_rela.c b/libelf/gelf_rela.c
+index 40f94da7..40462248 100644
+--- a/libelf/gelf_rela.c
++++ b/libelf/gelf_rela.c
+@@ -24,8 +24,6 @@
+ * SUCH DAMAGE.
+ */
+
+-#include <sys/cdefs.h>
+-
+ #include <assert.h>
+ #include <gelf.h>
+ #include <limits.h>
+diff --git a/libelf/gelf_shdr.c b/libelf/gelf_shdr.c
+index 9150776b..2248551e 100644
+--- a/libelf/gelf_shdr.c
++++ b/libelf/gelf_shdr.c
+@@ -24,8 +24,6 @@
+ * SUCH DAMAGE.
+ */
+
+-#include <sys/cdefs.h>
+-
+ #include <assert.h>
+ #include <gelf.h>
+ #include <libelf.h>
+diff --git a/libelf/gelf_sym.c b/libelf/gelf_sym.c
+index a8422395..998bfda2 100644
+--- a/libelf/gelf_sym.c
++++ b/libelf/gelf_sym.c
+@@ -24,8 +24,6 @@
+ * SUCH DAMAGE.
+ */
+
+-#include <sys/cdefs.h>
+-
+ #include <assert.h>
+ #include <gelf.h>
+ #include <limits.h>
+diff --git a/libelf/gelf_syminfo.c b/libelf/gelf_syminfo.c
+index ae6c8473..d97ab291 100644
+--- a/libelf/gelf_syminfo.c
++++ b/libelf/gelf_syminfo.c
+@@ -24,8 +24,6 @@
+ * SUCH DAMAGE.
+ */
+
+-#include <sys/cdefs.h>
+-
+ #include <assert.h>
+ #include <gelf.h>
+
+diff --git a/libelf/gelf_symshndx.c b/libelf/gelf_symshndx.c
+index ab6e8519..0ba1cc08 100644
+--- a/libelf/gelf_symshndx.c
++++ b/libelf/gelf_symshndx.c
+@@ -24,8 +24,6 @@
+ * SUCH DAMAGE.
+ */
+
+-#include <sys/cdefs.h>
+-
+ #include <assert.h>
+ #include <gelf.h>
+
+diff --git a/libelf/gelf_xlate.c b/libelf/gelf_xlate.c
+index 228b17bf..af539a5a 100644
+--- a/libelf/gelf_xlate.c
++++ b/libelf/gelf_xlate.c
+@@ -24,8 +24,6 @@
+ * SUCH DAMAGE.
+ */
+
+-#include <sys/cdefs.h>
+-
+ #include <gelf.h>
+ #include <libelf.h>
+ #include <string.h>
+diff --git a/libelf/libelf_allocate.c b/libelf/libelf_allocate.c
+index 1387568e..3cf58ae7 100644
+--- a/libelf/libelf_allocate.c
++++ b/libelf/libelf_allocate.c
+@@ -28,8 +28,6 @@
+ * Internal APIs
+ */
+
+-#include <sys/cdefs.h>
+-
+ #include <assert.h>
+ #include <errno.h>
+ #include <libelf.h>
+diff --git a/libelf/libelf_ar.c b/libelf/libelf_ar.c
+index 2a8b834b..26632c86 100644
+--- a/libelf/libelf_ar.c
++++ b/libelf/libelf_ar.c
+@@ -24,8 +24,6 @@
+ * SUCH DAMAGE.
+ */
+
+-#include <sys/cdefs.h>
+-
+ #include <assert.h>
+ #include <ctype.h>
+ #include <libelf.h>
+diff --git a/libelf/libelf_ar_util.c b/libelf/libelf_ar_util.c
+index 601036fa..f98e7258 100644
+--- a/libelf/libelf_ar_util.c
++++ b/libelf/libelf_ar_util.c
+@@ -24,8 +24,6 @@
+ * SUCH DAMAGE.
+ */
+
+-#include <sys/cdefs.h>
+-
+ #include <assert.h>
+ #include <libelf.h>
+ #include <stdlib.h>
+diff --git a/libelf/libelf_checksum.c b/libelf/libelf_checksum.c
+index 84ab3370..d573bc20 100644
+--- a/libelf/libelf_checksum.c
++++ b/libelf/libelf_checksum.c
+@@ -24,8 +24,6 @@
+ * SUCH DAMAGE.
+ */
+
+-#include <sys/cdefs.h>
+-
+ #include <gelf.h>
+
+ #include "_libelf.h"
+diff --git a/libelf/libelf_convert.m4 b/libelf/libelf_convert.m4
+index c9e3c28a..e9eb743b 100644
+--- a/libelf/libelf_convert.m4
++++ b/libelf/libelf_convert.m4
+@@ -24,8 +24,6 @@
+ * SUCH DAMAGE.
+ */
+
+-#include <sys/cdefs.h>
+-
+ #include <assert.h>
+ #include <libelf.h>
+ #include <string.h>
+diff --git a/libelf/libelf_data.c b/libelf/libelf_data.c
+index 3f921a00..6b8f50ae 100644
+--- a/libelf/libelf_data.c
++++ b/libelf/libelf_data.c
+@@ -24,8 +24,6 @@
+ * SUCH DAMAGE.
+ */
+
+-#include <sys/cdefs.h>
+-
+ #include <libelf.h>
+
+ #include "_libelf.h"
+diff --git a/libelf/libelf_ehdr.c b/libelf/libelf_ehdr.c
+index 75b3dd00..813e4e17 100644
+--- a/libelf/libelf_ehdr.c
++++ b/libelf/libelf_ehdr.c
+@@ -24,8 +24,6 @@
+ * SUCH DAMAGE.
+ */
+
+-#include <sys/cdefs.h>
+-
+ #include <assert.h>
+ #include <gelf.h>
+ #include <libelf.h>
+diff --git a/libelf/libelf_elfmachine.c b/libelf/libelf_elfmachine.c
+index 5b8244f4..c7e44b39 100644
+--- a/libelf/libelf_elfmachine.c
++++ b/libelf/libelf_elfmachine.c
+@@ -24,8 +24,6 @@
+ * SUCH DAMAGE.
+ */
+
+-#include <sys/cdefs.h>
+-
+ #include <assert.h>
+ #include <libelf.h>
+
+diff --git a/libelf/libelf_extended.c b/libelf/libelf_extended.c
+index 2ddac923..2cde9fad 100644
+--- a/libelf/libelf_extended.c
++++ b/libelf/libelf_extended.c
+@@ -24,8 +24,6 @@
+ * SUCH DAMAGE.
+ */
+
+-#include <sys/cdefs.h>
+-
+ #include <assert.h>
+ #include <libelf.h>
+
+diff --git a/libelf/libelf_fsize.m4 b/libelf/libelf_fsize.m4
+index 256a856a..0192b7ed 100644
+--- a/libelf/libelf_fsize.m4
++++ b/libelf/libelf_fsize.m4
+@@ -24,8 +24,6 @@
+ * SUCH DAMAGE.
+ */
+
+-#include <sys/cdefs.h>
+-
+ #include <libelf.h>
+
+ #include "_libelf.h"
+diff --git a/libelf/libelf_memory.c b/libelf/libelf_memory.c
+index 9aad49b8..e2b6bd22 100644
+--- a/libelf/libelf_memory.c
++++ b/libelf/libelf_memory.c
+@@ -24,8 +24,6 @@
+ * SUCH DAMAGE.
+ */
+
+-#include <sys/cdefs.h>
+-
+ #include <ar.h>
+ #include <assert.h>
+ #include <string.h>
+diff --git a/libelf/libelf_msize.m4 b/libelf/libelf_msize.m4
+index b4cc8634..b6bfb80d 100644
+--- a/libelf/libelf_msize.m4
++++ b/libelf/libelf_msize.m4
+@@ -24,8 +24,6 @@
+ * SUCH DAMAGE.
+ */
+
+-#include <sys/cdefs.h>
+-
+ #include <assert.h>
+ #include <libelf.h>
+ #include <string.h>
+diff --git a/libelf/libelf_open.c b/libelf/libelf_open.c
+index 7216df14..4b0cec72 100644
+--- a/libelf/libelf_open.c
++++ b/libelf/libelf_open.c
+@@ -24,7 +24,6 @@
+ * SUCH DAMAGE.
+ */
+
+-#include <sys/cdefs.h>
+ #include <sys/types.h>
+ #include <sys/stat.h>
+
+diff --git a/libelf/libelf_phdr.c b/libelf/libelf_phdr.c
+index ac92679f..88cac8aa 100644
+--- a/libelf/libelf_phdr.c
++++ b/libelf/libelf_phdr.c
+@@ -24,8 +24,6 @@
+ * SUCH DAMAGE.
+ */
+
+-#include <sys/cdefs.h>
+-
+ #include <assert.h>
+ #include <gelf.h>
+ #include <libelf.h>
+diff --git a/libelf/libelf_shdr.c b/libelf/libelf_shdr.c
+index 463a0ed0..604a6701 100644
+--- a/libelf/libelf_shdr.c
++++ b/libelf/libelf_shdr.c
+@@ -24,8 +24,6 @@
+ * SUCH DAMAGE.
+ */
+
+-#include <sys/cdefs.h>
+-
+ #include <gelf.h>
+ #include <libelf.h>
+
+diff --git a/libelf/libelf_xlate.c b/libelf/libelf_xlate.c
+index 003f9532..f8a7967c 100644
+--- a/libelf/libelf_xlate.c
++++ b/libelf/libelf_xlate.c
+@@ -24,8 +24,6 @@
+ * SUCH DAMAGE.
+ */
+
+-#include <sys/cdefs.h>
+-
+ #include <assert.h>
+ #include <libelf.h>
+
+--
+2.31.1
+
diff --git a/pkg/elftoolchain/patch/0004-Use-_Alignof-when-built-as-C11.patch b/pkg/elftoolchain/patch/0004-Use-_Alignof-when-built-as-C11.patch
@@ -1,52 +0,0 @@
-From 642824dea853e98be336bea496e7e5301c70c3a1 Mon Sep 17 00:00:00 2001
-From: Michael Forney <mforney@mforney.org>
-Date: Tue, 2 Jul 2019 23:54:25 -0700
-Subject: [PATCH] Use _Alignof when built as C11
-
----
- libelf/libelf_align.c | 19 ++++++++++++++++---
- 1 file changed, 16 insertions(+), 3 deletions(-)
-
-diff --git a/libelf/libelf_align.c b/libelf/libelf_align.c
-index f74789f5..9ddf172e 100644
---- a/libelf/libelf_align.c
-+++ b/libelf/libelf_align.c
-@@ -37,19 +37,32 @@ struct align {
- unsigned int a64;
- };
-
--#ifdef __GNUC__
-+#if __STDC_VERSION__ >= 201112L
-+#define MALIGN(N) { \
-+ .a32 = _Alignof(Elf32_##N), \
-+ .a64 = _Alignof(Elf64_##N) \
-+ }
-+#define MALIGN64(V) { \
-+ .a32 = 0, \
-+ .a64 = _Alignof(Elf64_##V) \
-+ }
-+#define MALIGN_WORD() { \
-+ .a32 = _Alignof(int32_t), \
-+ .a64 = _Alignof(int64_t) \
-+ }
-+#elif defined(__GNUC__)
- #define MALIGN(N) { \
- .a32 = __alignof__(Elf32_##N), \
- .a64 = __alignof__(Elf64_##N) \
- }
--#define MALIGN64(V) { \
-+#define MALIGN64(V) { \
- .a32 = 0, \
- .a64 = __alignof__(Elf64_##V) \
- }
- #define MALIGN_WORD() { \
- .a32 = __alignof__(int32_t), \
- .a64 = __alignof__(int64_t) \
-- }
-+ }
- #else
- #error Need the __alignof__ builtin.
- #endif
---
-2.22.0
-
diff --git a/pkg/elftoolchain/patch/0004-readelf-remove-unnecessary-after-function-definition.patch b/pkg/elftoolchain/patch/0004-readelf-remove-unnecessary-after-function-definition.patch
@@ -0,0 +1,26 @@
+From ddc7be75561caab4927241df5473561eacc4cca4 Mon Sep 17 00:00:00 2001
+From: Michael Forney <mforney@mforney.org>
+Date: Thu, 29 Apr 2021 12:20:12 -0700
+Subject: [PATCH] readelf: remove unnecessary ';' after function definition
+
+This is not allowed by the ISO C grammar.
+---
+ readelf/readelf.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/readelf/readelf.c b/readelf/readelf.c
+index d3b1bb51..7dafd341 100644
+--- a/readelf/readelf.c
++++ b/readelf/readelf.c
+@@ -458,7 +458,7 @@ elf_osabi(unsigned int abi)
+ snprintf(s_abi, sizeof(s_abi), "<unknown: %#x>", abi);
+ return (s_abi);
+ }
+-};
++}
+
+ static const char *
+ elf_machine(unsigned int mach)
+--
+2.31.1
+
diff --git a/pkg/elftoolchain/patch/0005-Permit-the-parameters-related-extended.patch b/pkg/elftoolchain/patch/0005-Permit-the-parameters-related-extended.patch
@@ -1,112 +0,0 @@
-From 23f10d1262ff50c5cf28e47f8eac59dcbf6cd820 Mon Sep 17 00:00:00 2001
-From: jkoshy <jkoshy@95820547-d848-0410-985e-9ae8fe0fa350>
-Date: Sat, 26 Sep 2020 07:19:13 +0000
-Subject: [PATCH] Permit the parameters related extended section numbering to
- be NULL in a call to gelf_getsymshndx().
-
-This change improves compatibility with other
-implementations of libelf.
-
-Ticket: #593
-Draft patches by: Ethan Sommer & Michael Forney
-
-git-svn-id: https://svn.code.sf.net/p/elftoolchain/code/trunk@3873 95820547-d848-0410-985e-9ae8fe0fa350
----
- libelf/gelf_getsymshndx.3 | 31 +++++++++++++++++++++++++------
- libelf/gelf_symshndx.c | 15 +++++++++++----
- 2 files changed, 36 insertions(+), 10 deletions(-)
-
-diff --git a/libelf/gelf_getsymshndx.3 b/libelf/gelf_getsymshndx.3
-index 7d5a19c1..78327e8f 100644
---- a/libelf/gelf_getsymshndx.3
-+++ b/libelf/gelf_getsymshndx.3
-@@ -1,4 +1,4 @@
--.\" Copyright (c) 2006,2008 Joseph Koshy. All rights reserved.
-+.\" Copyright (c) 2006,2008,2020 Joseph Koshy. All rights reserved.
- .\"
- .\" Redistribution and use in source and binary forms, with or without
- .\" modification, are permitted provided that the following conditions
-@@ -23,7 +23,7 @@
- .\"
- .\" $Id: gelf_getsymshndx.3 189 2008-07-20 10:38:08Z jkoshy $
- .\"
--.Dd November 5, 2006
-+.Dd September 26, 2020
- .Os
- .Dt GELF_GETSYMSHNDX 3
- .Sh NAME
-@@ -88,17 +88,36 @@ retrieves symbol information at index
- .Ar ndx
- from the data descriptor specified by argument
- .Ar symdata
--and stores in class-independent form in argument
-+and stores it in class-independent form in argument
- .Ar sym .
--In addition it retrieves the extended section index for the
--symbol from data buffer
-+Additionally:
-+.Bl -bullet
-+.It
-+If the arguments
-+.Ad xndxdata
-+and
-+.Ar xndxptr
-+are both not
-+.Dv NULL ,
-+it retrieves the extended section index for the
-+symbol from the data buffer pointed to by the
-+argument
- .Ar xndxdata
- and stores it into the location pointed to by argument
- .Ar xndxptr .
-+.It
-+Otherwise, if the argument
-+.Ar xndxptr
-+is not
-+.Dv NULL ,
-+a value of zero is stored into the location pointed to by
-+argument
-+.Ar xndxptr .
-+.El
- .Pp
- Function
- .Fn gelf_update_symshndx
--updates the underlying symbol table entry in data
-+updates the underlying symbol table entry in the data
- descriptor
- .Ar symdata
- with the information in argument
-diff --git a/libelf/gelf_symshndx.c b/libelf/gelf_symshndx.c
-index 93ce2dba..0bd12040 100644
---- a/libelf/gelf_symshndx.c
-+++ b/libelf/gelf_symshndx.c
-@@ -1,5 +1,5 @@
- /*-
-- * Copyright (c) 2006,2008 Joseph Koshy
-+ * Copyright (c) 2006,2008,2020 Joseph Koshy
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
-@@ -48,9 +48,16 @@ gelf_getsymshndx(Elf_Data *d, Elf_Data *id, int ndx, GElf_Sym *dst,
- if (gelf_getsym(d, ndx, dst) == 0)
- return (NULL);
-
-- if (lid == NULL || (scn = lid->d_scn) == NULL ||
-- (e = scn->s_elf) == NULL || (e != ld->d_scn->s_elf) ||
-- shindex == NULL) {
-+ if (shindex == NULL)
-+ return (dst);
-+
-+ if (lid == NULL) {
-+ *shindex = 0;
-+ return (dst);
-+ }
-+
-+ if ((scn = lid->d_scn) == NULL ||
-+ (e = scn->s_elf) == NULL || (e != ld->d_scn->s_elf)) {
- LIBELF_SET_ERROR(ARGUMENT, 0);
- return (NULL);
- }
---
-2.29.0
-
diff --git a/pkg/elftoolchain/sha256 b/pkg/elftoolchain/sha256
@@ -1 +0,0 @@
-92bfe36f886024bbc433846483b026c7ce44d553b9b941a0fd13e451911ae297 elftoolchain-0.7.1.tgz
diff --git a/pkg/elftoolchain/src b/pkg/elftoolchain/src
@@ -0,0 +1 @@
+Subproject commit f7e9afc6f9ad0d84ea73b4659c5d6d13275d2306
diff --git a/pkg/elftoolchain/url b/pkg/elftoolchain/url
@@ -1 +0,0 @@
-url = "https://sourceforge.net/projects/elftoolchain/files/Sources/elftoolchain-0.7.1/elftoolchain-0.7.1.tgz"
diff --git a/pkg/elftoolchain/ver b/pkg/elftoolchain/ver
@@ -1 +1 @@
-0.7.1 r3
+ce6d62aaba r0