[U-Boot] [PATCH v3 5/6] lib: crc32: mark function crc32() as __efi_runtime

Heinrich Schuchardt xypron.glpk at gmx.de
Sat Jul 7 13:36:08 UTC 2018


The function crc32() is needed by the EFI subsystem at runtime. So it has
to be linked into the runtime section together with all dependencies.

Eliminate empty define ZEXPORT.

Signed-off-by: Heinrich Schuchardt <xypron.glpk at gmx.de>
---
v3
	new patch
---
 lib/crc32.c | 17 ++++++++++-------
 1 file changed, 10 insertions(+), 7 deletions(-)

diff --git a/lib/crc32.c b/lib/crc32.c
index 7f545fde4a..bcb140ba06 100644
--- a/lib/crc32.c
+++ b/lib/crc32.c
@@ -12,6 +12,7 @@
 #include <arpa/inet.h>
 #else
 #include <common.h>
+#include <efi_loader.h>
 #endif
 #include <compiler.h>
 #include <u-boot/crc.h>
@@ -21,8 +22,11 @@
 #endif
 #include "u-boot/zlib.h"
 
-#define local static
-#define ZEXPORT	/* empty */
+#ifdef USE_HOSTCC
+#define __efi_runtime
+#define __efi_runtime_data
+#endif
+#define local static __efi_runtime_data
 
 #define tole(x) cpu_to_le32(x)
 
@@ -176,7 +180,7 @@ const uint32_t * ZEXPORT get_crc_table()
 /* No ones complement version. JFFS2 (and other things ?)
  * don't use ones compliment in their CRC calculations.
  */
-uint32_t ZEXPORT crc32_no_comp(uint32_t crc, const Bytef *buf, uInt len)
+uint32_t __efi_runtime crc32_no_comp(uint32_t crc, const Bytef *buf, uInt len)
 {
     const uint32_t *tab = crc_table;
     const uint32_t *b =(const uint32_t *)buf;
@@ -218,7 +222,7 @@ uint32_t ZEXPORT crc32_no_comp(uint32_t crc, const Bytef *buf, uInt len)
 }
 #undef DO_CRC
 
-uint32_t ZEXPORT crc32 (uint32_t crc, const Bytef *p, uInt len)
+uint32_t __efi_runtime crc32(uint32_t crc, const Bytef *p, uInt len)
 {
      return crc32_no_comp(crc ^ 0xffffffffL, p, len) ^ 0xffffffffL;
 }
@@ -227,9 +231,8 @@ uint32_t ZEXPORT crc32 (uint32_t crc, const Bytef *p, uInt len)
  * Calculate the crc32 checksum triggering the watchdog every 'chunk_sz' bytes
  * of input.
  */
-uint32_t ZEXPORT crc32_wd (uint32_t crc,
-			   const unsigned char *buf,
-			   uInt len, uInt chunk_sz)
+uint32_t crc32_wd(uint32_t crc, const unsigned char *buf, uInt len,
+		  uInt chunk_sz)
 {
 #if defined(CONFIG_HW_WATCHDOG) || defined(CONFIG_WATCHDOG)
 	const unsigned char *end, *curr;
-- 
2.18.0



More information about the U-Boot mailing list