Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1418814 > unrolled thread

[PATCH] m32r: add __ucmpdi2 to fix build failure

Started bySudip Mukherjee <sudipm.mukherjee@gmail.com>
First post2016-06-10 00:00 +0200
Last post2016-06-10 09:10 +0200
Articles 3 — 2 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH] m32r: add __ucmpdi2 to fix build failure Sudip Mukherjee <sudipm.mukherjee@gmail.com> - 2016-06-10 00:00 +0200
    Re: [PATCH] m32r: add __ucmpdi2 to fix build failure Andrew Morton <akpm@linux-foundation.org> - 2016-06-10 00:20 +0200
      Re: [PATCH] m32r: add __ucmpdi2 to fix build failure Sudip Mukherjee <sudipm.mukherjee@gmail.com> - 2016-06-10 09:10 +0200

#1418814 — [PATCH] m32r: add __ucmpdi2 to fix build failure

FromSudip Mukherjee <sudipm.mukherjee@gmail.com>
Date2016-06-10 00:00 +0200
Subject[PATCH] m32r: add __ucmpdi2 to fix build failure
Message-ID<rIg9A-3KD-31@gated-at.bofh.it>
We are having build failure with m32r and the error message being:
ERROR: "__ucmpdi2" [lib/842/842_decompress.ko] undefined!
ERROR: "__ucmpdi2" [fs/btrfs/btrfs.ko] undefined!
ERROR: "__ucmpdi2" [drivers/scsi/sd_mod.ko] undefined!
ERROR: "__ucmpdi2" [drivers/media/i2c/adv7842.ko] undefined!
ERROR: "__ucmpdi2" [drivers/md/bcache/bcache.ko] undefined!
ERROR: "__ucmpdi2" [drivers/iio/imu/inv_mpu6050/inv-mpu6050.ko] undefined!

__ucmpdi2 is introduced to m32r architecture taking example from other
architectures like h8300, microblaze, mips.

Signed-off-by: Sudip Mukherjee <sudip.mukherjee@codethink.co.uk>
---

Can some one please tell me how can i get a board of this architecture?
I am only testing for builds, but i dont know if anyone actually test it
on board. After all its orphan.

 arch/m32r/kernel/m32r_ksyms.c |  3 +++
 arch/m32r/lib/Makefile        |  4 ++--
 arch/m32r/lib/libgcc.h        | 24 ++++++++++++++++++++++++
 arch/m32r/lib/ucmpdi2.c       | 17 +++++++++++++++++
 4 files changed, 46 insertions(+), 2 deletions(-)
 create mode 100644 arch/m32r/lib/libgcc.h
 create mode 100644 arch/m32r/lib/ucmpdi2.c

diff --git a/arch/m32r/kernel/m32r_ksyms.c b/arch/m32r/kernel/m32r_ksyms.c
index b727e69..23f26f4a 100644
--- a/arch/m32r/kernel/m32r_ksyms.c
+++ b/arch/m32r/kernel/m32r_ksyms.c
@@ -41,6 +41,9 @@ EXPORT_SYMBOL(cpu_data);
 EXPORT_SYMBOL(smp_flush_tlb_page);
 #endif
 
+extern int __ucmpdi2(unsigned long long a, unsigned long long b);
+EXPORT_SYMBOL(__ucmpdi2);
+
 /* compiler generated symbol */
 extern void __ashldi3(void);
 extern void __ashrdi3(void);
diff --git a/arch/m32r/lib/Makefile b/arch/m32r/lib/Makefile
index d16b4e4..5889eb9 100644
--- a/arch/m32r/lib/Makefile
+++ b/arch/m32r/lib/Makefile
@@ -3,5 +3,5 @@
 #
 
 lib-y  := checksum.o ashxdi3.o memset.o memcpy.o \
-	  delay.o strlen.o usercopy.o csum_partial_copy.o
-
+	  delay.o strlen.o usercopy.o csum_partial_copy.o \
+	  ucmpdi2.o
diff --git a/arch/m32r/lib/libgcc.h b/arch/m32r/lib/libgcc.h
new file mode 100644
index 0000000..b2f45d0
--- /dev/null
+++ b/arch/m32r/lib/libgcc.h
@@ -0,0 +1,24 @@
+#ifndef __ASM_LIBGCC_H
+#define __ASM_LIBGCC_H
+
+#include <asm/byteorder.h>
+
+#ifdef __BIG_ENDIAN
+struct DWstruct {
+	int high, low;
+};
+#elif defined(__LITTLE_ENDIAN)
+struct DWstruct {
+	int low, high;
+};
+#else
+#error I feel sick.
+#endif
+
+typedef union {
+	struct DWstruct s;
+	long long ll;
+} DWunion;
+
+#endif /* __ASM_LIBGCC_H */
+
diff --git a/arch/m32r/lib/ucmpdi2.c b/arch/m32r/lib/ucmpdi2.c
new file mode 100644
index 0000000..d212b7f
--- /dev/null
+++ b/arch/m32r/lib/ucmpdi2.c
@@ -0,0 +1,17 @@
+#include "libgcc.h"
+
+int __ucmpdi2(unsigned long long a, unsigned long long b)
+{
+	const DWunion au = {.ll = a};
+	const DWunion bu = {.ll = b};
+
+	if ((unsigned int)au.s.high < (unsigned int)bu.s.high)
+		return 0;
+	else if ((unsigned int)au.s.high > (unsigned int)bu.s.high)
+		return 2;
+	if ((unsigned int)au.s.low < (unsigned int)bu.s.low)
+		return 0;
+	else if ((unsigned int)au.s.low > (unsigned int)bu.s.low)
+		return 2;
+	return 1;
+}
-- 
1.9.1

[toc] | [next] | [standalone]


#1418888

FromAndrew Morton <akpm@linux-foundation.org>
Date2016-06-10 00:20 +0200
Message-ID<rIgsX-47V-39@gated-at.bofh.it>
In reply to#1418814
On Thu,  9 Jun 2016 22:53:33 +0100 Sudip Mukherjee <sudipm.mukherjee@gmail.com> wrote:

> We are having build failure with m32r and the error message being:
> ERROR: "__ucmpdi2" [lib/842/842_decompress.ko] undefined!
> ERROR: "__ucmpdi2" [fs/btrfs/btrfs.ko] undefined!
> ERROR: "__ucmpdi2" [drivers/scsi/sd_mod.ko] undefined!
> ERROR: "__ucmpdi2" [drivers/media/i2c/adv7842.ko] undefined!
> ERROR: "__ucmpdi2" [drivers/md/bcache/bcache.ko] undefined!
> ERROR: "__ucmpdi2" [drivers/iio/imu/inv_mpu6050/inv-mpu6050.ko] undefined!
> 
> __ucmpdi2 is introduced to m32r architecture taking example from other
> architectures like h8300, microblaze, mips.
> 
> --- a/arch/m32r/kernel/m32r_ksyms.c
> +++ b/arch/m32r/kernel/m32r_ksyms.c
> @@ -41,6 +41,9 @@ EXPORT_SYMBOL(cpu_data);
>  EXPORT_SYMBOL(smp_flush_tlb_page);
>  #endif
>  
> +extern int __ucmpdi2(unsigned long long a, unsigned long long b);
> +EXPORT_SYMBOL(__ucmpdi2);
> +

This would be neater.  Does it work?


From: Andrew Morton <akpm@linux-foundation.org>
Subject: m32r-add-__ucmpdi2-to-fix-build-failure-fix

avoid extern declaration in .c file

Cc: Sudip Mukherjee <sudip.mukherjee@codethink.co.uk>
Cc: Sudip Mukherjee <sudipm.mukherjee@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>

--- a/arch/m32r/kernel/m32r_ksyms.c~m32r-add-__ucmpdi2-to-fix-build-failure-fix
+++ a/arch/m32r/kernel/m32r_ksyms.c
@@ -41,7 +41,6 @@ EXPORT_SYMBOL(cpu_data);
 EXPORT_SYMBOL(smp_flush_tlb_page);
 #endif
 
-extern int __ucmpdi2(unsigned long long a, unsigned long long b);
 EXPORT_SYMBOL(__ucmpdi2);
 
 /* compiler generated symbol */
--- a/arch/m32r/lib/libgcc.h~m32r-add-__ucmpdi2-to-fix-build-failure-fix
+++ a/arch/m32r/lib/libgcc.h
@@ -22,3 +22,4 @@ typedef union {
 
 #endif /* __ASM_LIBGCC_H */
 
+extern int __ucmpdi2(unsigned long long a, unsigned long long b);

[toc] | [prev] | [next] | [standalone]


#1419075

FromSudip Mukherjee <sudipm.mukherjee@gmail.com>
Date2016-06-10 09:10 +0200
Message-ID<rIoJP-1vU-9@gated-at.bofh.it>
In reply to#1418888
On Thursday 09 June 2016 11:16 PM, Andrew Morton wrote:
> On Thu,  9 Jun 2016 22:53:33 +0100 Sudip Mukherjee <sudipm.mukherjee@gmail.com> wrote:
>
>> We are having build failure with m32r and the error message being:
>> ERROR: "__ucmpdi2" [lib/842/842_decompress.ko] undefined!
>> ERROR: "__ucmpdi2" [fs/btrfs/btrfs.ko] undefined!
>> ERROR: "__ucmpdi2" [drivers/scsi/sd_mod.ko] undefined!
>> ERROR: "__ucmpdi2" [drivers/media/i2c/adv7842.ko] undefined!
>> ERROR: "__ucmpdi2" [drivers/md/bcache/bcache.ko] undefined!
>> ERROR: "__ucmpdi2" [drivers/iio/imu/inv_mpu6050/inv-mpu6050.ko] undefined!
>>
>> __ucmpdi2 is introduced to m32r architecture taking example from other
>> architectures like h8300, microblaze, mips.
>>
>> --- a/arch/m32r/kernel/m32r_ksyms.c
>> +++ b/arch/m32r/kernel/m32r_ksyms.c
>> @@ -41,6 +41,9 @@ EXPORT_SYMBOL(cpu_data);
>>   EXPORT_SYMBOL(smp_flush_tlb_page);
>>   #endif
>>
>> +extern int __ucmpdi2(unsigned long long a, unsigned long long b);
>> +EXPORT_SYMBOL(__ucmpdi2);
>> +
>
> This would be neater.  Does it work?
>
>
> From: Andrew Morton <akpm@linux-foundation.org>
> Subject: m32r-add-__ucmpdi2-to-fix-build-failure-fix
>
> avoid extern declaration in .c file
>
> Cc: Sudip Mukherjee <sudip.mukherjee@codethink.co.uk>
> Cc: Sudip Mukherjee <sudipm.mukherjee@gmail.com>
> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
>
> --- a/arch/m32r/kernel/m32r_ksyms.c~m32r-add-__ucmpdi2-to-fix-build-failure-fix
> +++ a/arch/m32r/kernel/m32r_ksyms.c
> @@ -41,7 +41,6 @@ EXPORT_SYMBOL(cpu_data);
>   EXPORT_SYMBOL(smp_flush_tlb_page);
>   #endif
>
> -extern int __ucmpdi2(unsigned long long a, unsigned long long b);
>   EXPORT_SYMBOL(__ucmpdi2);
>
>   /* compiler generated symbol */
> --- a/arch/m32r/lib/libgcc.h~m32r-add-__ucmpdi2-to-fix-build-failure-fix
> +++ a/arch/m32r/lib/libgcc.h
> @@ -22,3 +22,4 @@ typedef union {
>
>   #endif /* __ASM_LIBGCC_H */
>
> +extern int __ucmpdi2(unsigned long long a, unsigned long long b);
>


Nope.
In file included from ../include/linux/linkage.h:6:0,
                  from ../include/linux/kernel.h:6,
                  from ../include/linux/list.h:8,
                  from ../include/linux/module.h:9,
                  from ../arch/m32r/kernel/m32r_ksyms.c:1:
../arch/m32r/kernel/m32r_ksyms.c:44:15: error: '__ucmpdi2' undeclared 
here (not in a function)
  EXPORT_SYMBOL(__ucmpdi2);
                ^
../include/linux/export.h:57:16: note: in definition of macro 
'___EXPORT_SYMBOL'
   extern typeof(sym) sym;     \
                 ^
../arch/m32r/kernel/m32r_ksyms.c:44:1: note: in expansion of macro 
'EXPORT_SYMBOL'
  EXPORT_SYMBOL(__ucmpdi2);
  ^
make[2]: *** [arch/m32r/kernel/m32r_ksyms.o] Error 1
make[2]: *** Waiting for unfinished jobs....
make[1]: *** [arch/m32r/kernel] Error 2
make[1]: *** Waiting for unfinished jobs....

m32r_ksyms.c is not having any reference to the name. If you want to 
remove the extern from the C file then I think we should declare it in 
some header file and include that in the m32r_ksyms.c. And if that works 
then that can be applied to all the other arch also, as almost all of 
them have these externs in *_ksyms.c.

Regards
Sudip

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web