Skip to contentSkip to conversation

mipsel-linux-ld: decompress.c:undefined reference to `memmove'

PATCH Superseded kernel test robot 3 participants 11 messages Jul 6, 2021 – Jul 15, 2021

Subsystems (3)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

kernel test robot

author build bot
#0 lore raw
tree:   https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git linux-5.4.y
head:   3909e2374335335c9504467caabc906d3f7487e4
commit: defcc2b5e54a4724fb5733f802edf5dd596018b6 [7045/7049] lib/lz4: explicitly support in-place decompression
config: mips-randconfig-r036-20210706 (attached as .config)
compiler: mipsel-linux-gcc (GCC) 9.3.0

reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git/commit/?id=defcc2b5e54a4724fb5733f802edf5dd596018b6
git remote add linux-stable-rc https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git
git fetch --no-tags linux-stable-rc linux-5.4.y
git checkout defcc2b5e54a4724fb5733f802edf5dd596018b6
# save the attached .config to linux build tree
mkdir build_dir
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross O=build_dir ARCH=mips SHELL=/bin/bash

If you fix the issue, kindly add following tag as appropriate

All errors (new ones prefixed by >>):

mipsel-linux-ld: arch/mips/boot/compressed/decompress.o: in function `LZ4_decompress_safe_withSmallPrefix':
decompress.c:(.text+0x220): undefined reference to `memmove'
mipsel-linux-ld: arch/mips/boot/compressed/decompress.o: in function `LZ4_decompress_fast_extDict':
decompress.c:(.text+0x694): undefined reference to `memmove'

>> mipsel-linux-ld: decompress.c:(.text+0x774): undefined reference to `memmove'

mipsel-linux-ld: arch/mips/boot/compressed/decompress.o: in function `LZ4_decompress_safe':
decompress.c:(.text+0xb88): undefined reference to `memmove'
mipsel-linux-ld: arch/mips/boot/compressed/decompress.o: in function `LZ4_decompress_safe_partial':
decompress.c:(.text+0x1078): undefined reference to `memmove'
mipsel-linux-ld: arch/mips/boot/compressed/decompress.o:decompress.c:(.text+0x12f8): more undefined references to `memmove' follow

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org

#1 lore raw
Quoted 16 lines · kernel test robot
tree:   https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git linux-5.4.y
head:   3909e2374335335c9504467caabc906d3f7487e4
commit: defcc2b5e54a4724fb5733f802edf5dd596018b6 [7045/7049] lib/lz4: explicitly support in-place decompression
config: mips-randconfig-r036-20210706 (attached as .config)
compiler: mipsel-linux-gcc (GCC) 9.3.0

reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git/commit/?id=defcc2b5e54a4724fb5733f802edf5dd596018b6
git remote add linux-stable-rc https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git
git fetch --no-tags linux-stable-rc linux-5.4.y
git checkout defcc2b5e54a4724fb5733f802edf5dd596018b6
# save the attached .config to linux build tree
mkdir build_dir
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross O=build_dir ARCH=mips SHELL=/bin/bash

Quoted 2 lines

If you fix the issue, kindly add following tag as appropriate

Which is weird, does the preboot environment miss memmove() on mipsel? Just a guess, I may look into that myself later...

Thanks,
Gao Xiang

Quoted 17 lines

All errors (new ones prefixed by >>):

mipsel-linux-ld: arch/mips/boot/compressed/decompress.o: in function `LZ4_decompress_safe_withSmallPrefix':

   decompress.c:(.text+0x220): undefined reference to `memmove'
   mipsel-linux-ld: arch/mips/boot/compressed/decompress.o: in function `LZ4_decompress_fast_extDict':
   decompress.c:(.text+0x694): undefined reference to `memmove'
Quoted 1 line
Quoted 1 line

mipsel-linux-ld: decompress.c:(.text+0x774): undefined reference to `memmove'

mipsel-linux-ld: arch/mips/boot/compressed/decompress.o: in function `LZ4_decompress_safe':
decompress.c:(.text+0xb88): undefined reference to `memmove'
mipsel-linux-ld: arch/mips/boot/compressed/decompress.o: in function `LZ4_decompress_safe_partial':
decompress.c:(.text+0x1078): undefined reference to `memmove'
mipsel-linux-ld: arch/mips/boot/compressed/decompress.o:decompress.c:(.text+0x12f8): more undefined references to `memmove' follow

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org

#2 lore raw

Hi Greg, stable all,

Quoted 17 lines · Gao Xiang
Quoted 16 lines · kernel test robot
tree:   https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git linux-5.4.y
head:   3909e2374335335c9504467caabc906d3f7487e4
commit: defcc2b5e54a4724fb5733f802edf5dd596018b6 [7045/7049] lib/lz4: explicitly support in-place decompression
config: mips-randconfig-r036-20210706 (attached as .config)
compiler: mipsel-linux-gcc (GCC) 9.3.0

reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git/commit/?id=defcc2b5e54a4724fb5733f802edf5dd596018b6
git remote add linux-stable-rc https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git
git fetch --no-tags linux-stable-rc linux-5.4.y
git checkout defcc2b5e54a4724fb5733f802edf5dd596018b6
# save the attached .config to linux build tree
mkdir build_dir
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross O=build_dir ARCH=mips SHELL=/bin/bash

Quoted 6 lines
Quoted 2 lines

If you fix the issue, kindly add following tag as appropriate

Which is weird, does the preboot environment miss memmove() on mipsel? Just a guess, I may look into that myself later...

After manually checking, I found memmove() for the mips preboot environment was incidentally introduced by commit a510b616131f ("MIPS: Add support for ZSTD-compressed kernels") which wasn't included in v5.4, but included in v5.10 as below (so v5.10.y is fine):
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/arch/mips/boot/compressed?h=v5.10&id=a510b616131f85215ba156ed67e5ed1c0701f80f

And when I applied the following patch partially from the original commit, the compile error with the command lines mentioned above was gone:

arch/mips/boot/compressed/string.c +16 -0
index 43beecc3587c..e9ab7ea592ba 100644
@@ -27,3 +27,19 @@ void *memset(void *s, int c, size_t n)
 		ss[i] = c;
 	return s;
 }
+
+void * __weak memmove(void *dest, const void *src, size_t n)
+{
+	unsigned int i;
+	const char *s = src;
+	char *d = dest;
+
+	if ((uintptr_t)dest < (uintptr_t)src) {
+		for (i = 0; i < n; i++)
+			d[i] = s[i];
+	} else {
+		for (i = n; i > 0; i--)
+			d[i - 1] = s[i - 1];
+	}
+	return dest;
+}

How to backport such commit partially to the v5.4.y stable kernel? ... Also, it would be better to check other mips compile combinations automatically since it's hard for me to check all such combinations one-by-one...

Thanks,
Gao Xiang

Quoted 21 lines

Thanks,
Gao Xiang

Quoted 17 lines

All errors (new ones prefixed by >>):

mipsel-linux-ld: arch/mips/boot/compressed/decompress.o: in function `LZ4_decompress_safe_withSmallPrefix':

   decompress.c:(.text+0x220): undefined reference to `memmove'
   mipsel-linux-ld: arch/mips/boot/compressed/decompress.o: in function `LZ4_decompress_fast_extDict':
   decompress.c:(.text+0x694): undefined reference to `memmove'
Quoted 1 line
Quoted 1 line

mipsel-linux-ld: decompress.c:(.text+0x774): undefined reference to `memmove'

mipsel-linux-ld: arch/mips/boot/compressed/decompress.o: in function `LZ4_decompress_safe':
decompress.c:(.text+0xb88): undefined reference to `memmove'
mipsel-linux-ld: arch/mips/boot/compressed/decompress.o: in function `LZ4_decompress_safe_partial':
decompress.c:(.text+0x1078): undefined reference to `memmove'
mipsel-linux-ld: arch/mips/boot/compressed/decompress.o:decompress.c:(.text+0x12f8): more undefined references to `memmove' follow

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org

#3 lore raw
Quoted 61 lines · Gao Xiang

Hi Greg, stable all,

Quoted 17 lines · Gao Xiang
Quoted 16 lines · kernel test robot
tree:   https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git linux-5.4.y
head:   3909e2374335335c9504467caabc906d3f7487e4
commit: defcc2b5e54a4724fb5733f802edf5dd596018b6 [7045/7049] lib/lz4: explicitly support in-place decompression
config: mips-randconfig-r036-20210706 (attached as .config)
compiler: mipsel-linux-gcc (GCC) 9.3.0

reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git/commit/?id=defcc2b5e54a4724fb5733f802edf5dd596018b6
git remote add linux-stable-rc https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git
git fetch --no-tags linux-stable-rc linux-5.4.y
git checkout defcc2b5e54a4724fb5733f802edf5dd596018b6
# save the attached .config to linux build tree
mkdir build_dir
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross O=build_dir ARCH=mips SHELL=/bin/bash

Quoted 6 lines
Quoted 2 lines

If you fix the issue, kindly add following tag as appropriate

Which is weird, does the preboot environment miss memmove() on mipsel? Just a guess, I may look into that myself later...

After manually checking, I found memmove() for the mips preboot environment was incidentally introduced by commit a510b616131f ("MIPS: Add support for ZSTD-compressed kernels") which wasn't included in v5.4, but included in v5.10 as below (so v5.10.y is fine):
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/arch/mips/boot/compressed?h=v5.10&id=a510b616131f85215ba156ed67e5ed1c0701f80f

And when I applied the following patch partially from the original commit, the compile error with the command lines mentioned above was gone:

arch/mips/boot/compressed/string.c +16 -0
index 43beecc3587c..e9ab7ea592ba 100644
@@ -27,3 +27,19 @@ void *memset(void *s, int c, size_t n)
 		ss[i] = c;
 	return s;
 }
+
+void * __weak memmove(void *dest, const void *src, size_t n)
+{
+	unsigned int i;
+	const char *s = src;
+	char *d = dest;
+
+	if ((uintptr_t)dest < (uintptr_t)src) {
+		for (i = 0; i < n; i++)
+			d[i] = s[i];
+	} else {
+		for (i = n; i > 0; i--)
+			d[i - 1] = s[i - 1];
+	}
+	return dest;
+}
Quoted 1 line

How to backport such commit partially to the v5.4.y stable kernel?

Please submit it in a format which we can apply it.

Quoted 3 lines

... Also, it would be better to check other mips compile combinations automatically since it's hard for me to check all such combinations one-by-one...

That's what kernelci is for, can you use that?

thanks,

greg k-h

#4 lore raw

PATCH 1/1 MIPS: fix "mipsel-linux-ld: decompress.c:undefined reference to `memmove'"

commit a510b616131f85215ba156ed67e5ed1c0701f80f upstream.

kernel test robot reported a 5.4.y build issue found by randconfig [1] after backporting commit 89b158635ad7 ("lib/lz4: explicitly support in-place decompression""). This isn't a problem for v5.10+ since commit a510b616131f ("MIPS: Add support for ZSTD-compressed kernels") which wasn't included in v5.4, but included in v5.10.y, so only v5.4.y is effected.

This partially cherry-picks the memmove part of commit a510b616131f to fix the reported build issue for v5.4.y stable only. Hopefully kernelci could also double check this.

[1] https://lore.kernel.org/r/[email protected]/

Fixes defcc2b5e54a ("lib/lz4: explicitly support in-place decompression") # 5.4.y

---
not sure if the stable-only patch format is like this, it partially cherry-picks the useful memmove part of commit a510b616131f to fix the build issue found by randconfig fuzz only.

 arch/mips/boot/compressed/string.c | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)
arch/mips/boot/compressed/string.c +16 -0
index 43beecc3587c..e9ab7ea592ba 100644
@@ -27,3 +27,19 @@ void *memset(void *s, int c, size_t n)
 		ss[i] = c;
 	return s;
 }
+
+void * __weak memmove(void *dest, const void *src, size_t n)
+{
+	unsigned int i;
+	const char *s = src;
+	char *d = dest;
+
+	if ((uintptr_t)dest < (uintptr_t)src) {
+		for (i = 0; i < n; i++)
+			d[i] = s[i];
+	} else {
+		for (i = n; i > 0; i--)
+			d[i - 1] = s[i - 1];
+	}
+	return dest;
+}
Signature · 1 line
2.24.4
#5 lore raw

Re: [PATCH 5.4.y stable only] MIPS: fix "mipsel-linux-ld: decompress.c:undefined reference to `memmove'"

Hi,

Quoted 13 lines · Gao Xiang

commit a510b616131f85215ba156ed67e5ed1c0701f80f upstream.

kernel test robot reported a 5.4.y build issue found by randconfig [1] after backporting commit 89b158635ad7 ("lib/lz4: explicitly support in-place decompression""). This isn't a problem for v5.10+ since commit a510b616131f ("MIPS: Add support for ZSTD-compressed kernels") which wasn't included in v5.4, but included in v5.10.y, so only v5.4.y is effected.

This partially cherry-picks the memmove part of commit a510b616131f to fix the reported build issue for v5.4.y stable only. Hopefully kernelci could also double check this.

Quoted 8 lines

[1] https://lore.kernel.org/r/[email protected]/

Fixes defcc2b5e54a ("lib/lz4: explicitly support in-place decompression") # 5.4.y

---
not sure if the stable-only patch format is like this, it partially cherry-picks the useful memmove part of commit a510b616131f to fix the build issue found by randconfig fuzz only.

ping.. are there more things I can do for this?

Thanks,
Gao Xiang

Quoted 30 lines
 arch/mips/boot/compressed/string.c | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)
arch/mips/boot/compressed/string.c +16 -0
index 43beecc3587c..e9ab7ea592ba 100644
@@ -27,3 +27,19 @@ void *memset(void *s, int c, size_t n)
 		ss[i] = c;
 	return s;
 }
+
+void * __weak memmove(void *dest, const void *src, size_t n)
+{
+	unsigned int i;
+	const char *s = src;
+	char *d = dest;
+
+	if ((uintptr_t)dest < (uintptr_t)src) {
+		for (i = 0; i < n; i++)
+			d[i] = s[i];
+	} else {
+		for (i = n; i > 0; i--)
+			d[i - 1] = s[i - 1];
+	}
+	return dest;
+}
Signature · 1 line
2.24.4
#6 lore raw

Re: [PATCH 5.4.y stable only] MIPS: fix "mipsel-linux-ld: decompress.c:undefined reference to `memmove'"

In reply to Gao Xiang
Quoted 1 line · Gao Xiang

commit a510b616131f85215ba156ed67e5ed1c0701f80f upstream.

That is not what this commit id is :(

Please fix this up and be more careful.

thanks,

greg k-h

#7 lore raw

Re: [PATCH 5.4.y stable only] MIPS: fix "mipsel-linux-ld: decompress.c:undefined reference to `memmove'"

Hi Greg,

Quoted 6 lines · Greg Kroah-Hartman
Quoted 1 line · Gao Xiang

commit a510b616131f85215ba156ed67e5ed1c0701f80f upstream.

That is not what this commit id is :(

Please fix this up and be more careful.

That's the exact commit, the original upstream commit was named as "MIPS: Add support for ZSTD-compressed kernels", which contains the memmove() definition so the upstream / 5.10 LTS kernel is fine.

But for 5.4 LTS, we shouldn't backport the whole patch since only memmove() part is needed in order to fix the build regression...

Thanks,
Gao Xiang

Quoted 4 lines

thanks,

greg k-h

#8 lore raw

Re: [PATCH 5.4.y stable only] MIPS: fix "mipsel-linux-ld: decompress.c:undefined reference to `memmove'"

Quoted 8 lines · Gao Xiang

Hi Greg,

Quoted 5 lines · Greg Kroah-Hartman
Quoted 1 line · Gao Xiang

commit a510b616131f85215ba156ed67e5ed1c0701f80f upstream.

That is not what this commit id is :(

Quoted 8 lines
Quoted 1 line

Please fix this up and be more careful.

That's the exact commit, the original upstream commit was named as "MIPS: Add support for ZSTD-compressed kernels", which contains the memmove() definition so the upstream / 5.10 LTS kernel is fine.

But for 5.4 LTS, we shouldn't backport the whole patch since only memmove() part is needed in order to fix the build regression...

That was not obvious, and is confusing :(

Please just submit the fix and say _why_ this is not an upstream commit, do not attempt to emulate an upstream commit like your change did.

thanks,

greg k-h

#9 lore raw

Re: [PATCH 5.4.y stable only] MIPS: fix "mipsel-linux-ld: decompress.c:undefined reference to `memmove'"

Quoted 15 lines · Greg Kroah-Hartman
Quoted 14 lines · Gao Xiang

Hi Greg,

Quoted 6 lines · Greg Kroah-Hartman
Quoted 1 line · Gao Xiang

commit a510b616131f85215ba156ed67e5ed1c0701f80f upstream.

That is not what this commit id is :(

Please fix this up and be more careful.

That's the exact commit, the original upstream commit was named as "MIPS: Add support for ZSTD-compressed kernels", which contains the memmove() definition so the upstream / 5.10 LTS kernel is fine.

Quoted 7 lines
Quoted 2 lines

But for 5.4 LTS, we shouldn't backport the whole patch since only memmove() part is needed in order to fix the build regression...

That was not obvious, and is confusing :(

Please just submit the fix and say _why_ this is not an upstream commit, do not attempt to emulate an upstream commit like your change did.

Ok, got it. I was confused how to handle such condition as well... Let me resend it...

Thanks,
Gao Xiang

Quoted 4 lines

thanks,

greg k-h

#10 lore raw
In reply to Greg Kroah-Hartman
Quoted 62 lines · Greg Kroah-Hartman
Quoted 61 lines · Gao Xiang

Hi Greg, stable all,

Quoted 17 lines · Gao Xiang
Quoted 16 lines · kernel test robot
tree:   https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git linux-5.4.y
head:   3909e2374335335c9504467caabc906d3f7487e4
commit: defcc2b5e54a4724fb5733f802edf5dd596018b6 [7045/7049] lib/lz4: explicitly support in-place decompression
config: mips-randconfig-r036-20210706 (attached as .config)
compiler: mipsel-linux-gcc (GCC) 9.3.0

reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git/commit/?id=defcc2b5e54a4724fb5733f802edf5dd596018b6
git remote add linux-stable-rc https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git
git fetch --no-tags linux-stable-rc linux-5.4.y
git checkout defcc2b5e54a4724fb5733f802edf5dd596018b6
# save the attached .config to linux build tree
mkdir build_dir
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross O=build_dir ARCH=mips SHELL=/bin/bash

Quoted 6 lines
Quoted 2 lines

If you fix the issue, kindly add following tag as appropriate

Which is weird, does the preboot environment miss memmove() on mipsel? Just a guess, I may look into that myself later...

After manually checking, I found memmove() for the mips preboot environment was incidentally introduced by commit a510b616131f ("MIPS: Add support for ZSTD-compressed kernels") which wasn't included in v5.4, but included in v5.10 as below (so v5.10.y is fine):
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/arch/mips/boot/compressed?h=v5.10&id=a510b616131f85215ba156ed67e5ed1c0701f80f

And when I applied the following patch partially from the original commit, the compile error with the command lines mentioned above was gone:

arch/mips/boot/compressed/string.c +16 -0
index 43beecc3587c..e9ab7ea592ba 100644
@@ -27,3 +27,19 @@ void *memset(void *s, int c, size_t n)
 		ss[i] = c;
 	return s;
 }
+
+void * __weak memmove(void *dest, const void *src, size_t n)
+{
+	unsigned int i;
+	const char *s = src;
+	char *d = dest;
+
+	if ((uintptr_t)dest < (uintptr_t)src) {
+		for (i = 0; i < n; i++)
+			d[i] = s[i];
+	} else {
+		for (i = n; i > 0; i--)
+			d[i - 1] = s[i - 1];
+	}
+	return dest;
+}
Quoted 3 lines
Quoted 1 line

How to backport such commit partially to the v5.4.y stable kernel?

Please submit it in a format which we can apply it.

I've sent out a patch (although not sure if the exact format like this):
https://lore.kernel.org/r/20210709132408.174206-1-hsiangkao(a)linux.alibaba.com/

Quoted 6 lines
Quoted 4 lines

... Also, it would be better to check other mips compile combinations automatically since it's hard for me to check all such combinations one-by-one...

That's what kernelci is for, can you use that?

I'm not sure how to use kernelci myself, maybe I missed something...

Thanks,
Gao Xiang

Quoted 4 lines

thanks,

greg k-h