public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@linux-foundation.org>
To: Arnd Bergmann <arnd@arndb.de>
Cc: Sven Schmidt <4sschmid@informatik.uni-hamburg.de>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] lz4: fix KERNEL_LZ4 support
Date: Wed, 8 Feb 2017 13:34:59 -0800	[thread overview]
Message-ID: <20170208133459.c694a5bce66ab26c0ee80dee@linux-foundation.org> (raw)
In-Reply-To: <20170208211946.2839649-1-arnd@arndb.de>

On Wed,  8 Feb 2017 22:19:23 +0100 Arnd Bergmann <arnd@arndb.de> wrote:

> The updated lz4 library removed the #ifdef guards around the various
> EXPORT_SYMBOL statements in the original kernel lz4 support, which broke
> CONFIG_KERNEL_LZ4 on x86:
> 
> x86_64-linux-ld: -r and -pie may not be used together
> scripts/Makefile.build:308: recipe for target 'arch/x86/boot/compressed/misc.o' failed
> 
> This uses a simpler way to do the same thing, by overriding the
> EXPORT_SYMBOL macro.
> 

hm, why does this CONFIG_KERNEL_LZ4 thing exist?  What makes lz4
different from a billion other kernel modules?

> index 9bf918233749..a390f63bc475 100644
> --- a/lib/lz4/lz4_decompress.c
> +++ b/lib/lz4/lz4_decompress.c
> @@ -40,6 +40,11 @@
>  #include <linux/kernel.h>
>  #include <asm/unaligned.h>
>  
> +#ifdef STATIC
> +#undef EXPORT_SYMBOL
> +#define EXPORT_SYMBOL(x)
> +#endif
> +

That is a bit hacky, and somewhat "surprising".  Why not do it the old
fashioned way?

--- a/lib/lz4/lz4_decompress.c~lz4-fix-kernel_lz4-support-fix
+++ a/lib/lz4/lz4_decompress.c
@@ -328,7 +323,6 @@ int LZ4_decompress_safe(const char *sour
 		maxDecompressedSize, endOnInputSize, full, 0,
 		noDict, (BYTE *)dest, NULL, 0);
 }
-EXPORT_SYMBOL(LZ4_decompress_safe);
 
 int LZ4_decompress_safe_partial(const char *source, char *dest,
 	int compressedSize, int targetOutputSize, int maxDecompressedSize)
@@ -337,7 +331,6 @@ int LZ4_decompress_safe_partial(const ch
 		maxDecompressedSize, endOnInputSize, partial,
 		targetOutputSize, noDict, (BYTE *)dest, NULL, 0);
 }
-EXPORT_SYMBOL(LZ4_decompress_safe_partial);
 
 int LZ4_decompress_fast(const char *source, char *dest, int originalSize)
 {
@@ -345,7 +338,6 @@ int LZ4_decompress_fast(const char *sour
 		endOnOutputSize, full, 0, withPrefix64k,
 		(BYTE *)(dest - 64 * KB), NULL, 64 * KB);
 }
-EXPORT_SYMBOL(LZ4_decompress_fast);
 
 int LZ4_setStreamDecode(LZ4_streamDecode_t *LZ4_streamDecode,
 	const char *dictionary, int dictSize)
@@ -358,7 +350,6 @@ int LZ4_setStreamDecode(LZ4_streamDecode
 	lz4sd->extDictSize	= 0;
 	return 1;
 }
-EXPORT_SYMBOL(LZ4_setStreamDecode);
 
 /*
  * *_continue() :
@@ -406,7 +397,6 @@ int LZ4_decompress_safe_continue(LZ4_str
 
 	return result;
 }
-EXPORT_SYMBOL(LZ4_decompress_safe_continue);
 
 int LZ4_decompress_fast_continue(LZ4_streamDecode_t *LZ4_streamDecode,
 	const char *source, char *dest, int originalSize)
@@ -441,7 +431,6 @@ int LZ4_decompress_fast_continue(LZ4_str
 
 	return result;
 }
-EXPORT_SYMBOL(LZ4_decompress_fast_continue);
 
 /*
  * Advanced decoding functions :
@@ -478,7 +467,6 @@ int LZ4_decompress_safe_usingDict(const
 	return LZ4_decompress_usingDict_generic(source, dest,
 		compressedSize, maxOutputSize, 1, dictStart, dictSize);
 }
-EXPORT_SYMBOL(LZ4_decompress_safe_usingDict);
 
 int LZ4_decompress_fast_usingDict(const char *source, char *dest,
 	int originalSize, const char *dictStart, int dictSize)
@@ -486,7 +474,17 @@ int LZ4_decompress_fast_usingDict(const
 	return LZ4_decompress_usingDict_generic(source, dest, 0,
 		originalSize, 0, dictStart, dictSize);
 }
+
+#ifndef STATIC
+EXPORT_SYMBOL(LZ4_decompress_safe);
+EXPORT_SYMBOL(LZ4_decompress_safe_partial);
+EXPORT_SYMBOL(LZ4_decompress_fast);
+EXPORT_SYMBOL(LZ4_setStreamDecode);
+EXPORT_SYMBOL(LZ4_decompress_safe_continue);
+EXPORT_SYMBOL(LZ4_decompress_fast_continue);
+EXPORT_SYMBOL(LZ4_decompress_safe_usingDict);
 EXPORT_SYMBOL(LZ4_decompress_fast_usingDict);
+#endif
 
 MODULE_LICENSE("Dual BSD/GPL");
 MODULE_DESCRIPTION("LZ4 decompressor");
_

  reply	other threads:[~2017-02-08 22:30 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-02-08 21:19 [PATCH] lz4: fix KERNEL_LZ4 support Arnd Bergmann
2017-02-08 21:34 ` Andrew Morton [this message]
2017-02-08 22:06   ` Arnd Bergmann
2017-02-09 11:09     ` Sven Schmidt

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170208133459.c694a5bce66ab26c0ee80dee@linux-foundation.org \
    --to=akpm@linux-foundation.org \
    --cc=4sschmid@informatik.uni-hamburg.de \
    --cc=arnd@arndb.de \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox