aboutsummaryrefslogtreecommitdiff
path: root/main/efivar/musl-bswap.patch
diff options
context:
space:
mode:
Diffstat (limited to 'main/efivar/musl-bswap.patch')
-rw-r--r--main/efivar/musl-bswap.patch33
1 files changed, 33 insertions, 0 deletions
diff --git a/main/efivar/musl-bswap.patch b/main/efivar/musl-bswap.patch
new file mode 100644
index 0000000000..8b86d9ae54
--- /dev/null
+++ b/main/efivar/musl-bswap.patch
@@ -0,0 +1,33 @@
1From c9b54ee2cd504542cac4ed95fa7842bd14b39f9c Mon Sep 17 00:00:00 2001
2From: "A. Wilcox" <AWilcox@Wilcox-Tech.com>
3Date: Fri, 18 Aug 2017 20:36:03 -0500
4Subject: [PATCH] makeguids: Ensure compatibility with other libcs
5
6The musl libc does not provide __bswap_constant_XX.
7If <endian.h> does not provide these macros, use our own.
8
9This fixes issue #84.
10---
11 src/makeguids.c | 9 +++++++++
12 1 file changed, 9 insertions(+)
13
14diff --git a/src/makeguids.c b/src/makeguids.c
15index ec75a86..6b0d80e 100644
16--- a/src/makeguids.c
17+++ b/src/makeguids.c
18@@ -152,6 +152,15 @@ main(int argc, char *argv[])
19 fprintf(symout, "#include <efivar/efivar.h>\n");
20 fprintf(symout, "#include <endian.h>\n");
21 fprintf(symout, """\n\
22+#ifndef __bswap_constant_16\n\
23+#define __bswap_constant_16(x)\\\n\
24+ ((unsigned short int) ((((x) >> 8) & 0xff) | (((x) & 0xff) << 8)))\n\
25+#endif\n\
26+#ifndef __bswap_constant_32\n\
27+#define __bswap_constant_32(x)\\\n\
28+ ((((x) & 0xff000000) >> 24) | (((x) & 0x00ff0000) >> 8) | \\\n\
29+ (((x) & 0x0000ff00) << 8) | (((x) & 0x000000ff) << 24))\n\
30+#endif\n\
31 #if BYTE_ORDER == BIG_ENDIAN\n\
32 #define cpu_to_be32(n) (n)\n\
33 #define cpu_to_be16(n) (n)\n\