summaryrefslogtreecommitdiff
path: root/sys-boot/refind/files/refind-0.14.0.2-clang.patch
blob: fe23233903550dec0f5dabcf1b6b285d9d9e1951 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
Fix compilation with clang.

Clang does not support nested functions (a gcc extension), so move it outside.

Compiling with _FORTIFY_SOURCE and -ffreestanding results in
nanojpeg.c:(.text+0xa28): undefined reference to `__memset_chk'

See also: https://bugs.gentoo.org/881131

--- a/filesystems/crc32c.c
+++ b/filesystems/crc32c.c
@@ -22,25 +22,24 @@
 
 static uint32_t crc32c_table [256];
 
-static void
-init_crc32c_table (void)
+uint32_t reflect (uint32_t ref, int len)
 {
-  auto uint32_t reflect (uint32_t ref, int len);
-  uint32_t reflect (uint32_t ref, int len)
-    {
-      uint32_t result = 0;
-      int i;
+  uint32_t result = 0;
+  int i;
 
-      for (i = 1; i <= len; i++)
-        {
-          if (ref & 1)
-            result |= 1 << (len - i);
-          ref >>= 1;
-        }
-
-      return result;
+  for (i = 1; i <= len; i++)
+    {
+      if (ref & 1)
+        result |= 1 << (len - i);
+      ref >>= 1;
     }
 
+  return result;
+}
+
+static void
+init_crc32c_table (void)
+{
   static int crc32c_table_inited;
   if(crc32c_table_inited)
 	  return;
--- a/libeg/nanojpeg.c
+++ b/libeg/nanojpeg.c
@@ -112,6 +112,8 @@
 #ifndef _NANOJPEG_H
 #define _NANOJPEG_H
 
+#undef _FORTIFY_SOURCE
+
 // Modified: Map libc-style free() and malloc() to their EFI equivalents....
 #define free MyFreePool
 #define malloc AllocatePool