LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* [PATCH 1/9] nds32: lib: To use generic lib instead of libgcc to prevent the symbol undefined issue.
@ 2018-04-19 13:18 Greentime Hu
  2018-04-19 13:18 ` [PATCH 2/9] nds32: Fix building error when CONFIG_FREEZE is enabled Greentime Hu
                   ` (8 more replies)
  0 siblings, 9 replies; 15+ messages in thread
From: Greentime Hu @ 2018-04-19 13:18 UTC (permalink / raw)
  To: linux-kernel, arnd, greentime, green.hu, private

We can use the generic lib to fix these error because the symbol of
libgcc in toolchain is not exported.

ERROR: "__ucmpdi2" [fs/xfs/xfs.ko] undefined!
ERROR: "__ashrdi3" [fs/xfs/xfs.ko] undefined!
ERROR: "__lshrdi3" [fs/xfs/xfs.ko] undefined!
ERROR: "__ashldi3" [fs/ntfs/ntfs.ko] undefined!
...

Signed-off-by: Greentime Hu <greentime@andestech.com>
---
 arch/nds32/Kconfig  | 6 ++++++
 arch/nds32/Makefile | 3 ---
 2 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/arch/nds32/Kconfig b/arch/nds32/Kconfig
index 249f38d3388f..98e05f997f91 100644
--- a/arch/nds32/Kconfig
+++ b/arch/nds32/Kconfig
@@ -9,6 +9,12 @@ config NDS32
 	select CLKSRC_MMIO
 	select CLONE_BACKWARDS
 	select COMMON_CLK
+	select GENERIC_ASHLDI3
+	select GENERIC_ASHRDI3
+	select GENERIC_LSHRDI3
+	select GENERIC_CMPDI2
+	select GENERIC_MULDI3
+	select GENERIC_UCMPDI2
 	select GENERIC_ATOMIC64
 	select GENERIC_CPU_DEVICES
 	select GENERIC_CLOCKEVENTS
diff --git a/arch/nds32/Makefile b/arch/nds32/Makefile
index 91f933d5a962..20edf34e70ce 100644
--- a/arch/nds32/Makefile
+++ b/arch/nds32/Makefile
@@ -23,9 +23,6 @@ export	TEXTADDR
 # If we have a machine-specific directory, then include it in the build.
 core-y				+= arch/nds32/kernel/ arch/nds32/mm/
 libs-y				+= arch/nds32/lib/
-LIBGCC_PATH     		:= \
-  $(shell $(CC) $(KBUILD_CFLAGS) $(KCFLAGS) -print-libgcc-file-name)
-libs-y				+= $(LIBGCC_PATH)
 
 ifneq '$(CONFIG_NDS32_BUILTIN_DTB)' '""'
 BUILTIN_DTB := y
-- 
1.9.5

^ permalink raw reply	[flat|nested] 15+ messages in thread

* [PATCH 2/9] nds32: Fix building error when CONFIG_FREEZE is enabled.
  2018-04-19 13:18 [PATCH 1/9] nds32: lib: To use generic lib instead of libgcc to prevent the symbol undefined issue Greentime Hu
@ 2018-04-19 13:18 ` Greentime Hu
  2018-04-19 13:18 ` [PATCH 3/9] nds32: Fix building error of crypto/xor.c by adding xor.h Greentime Hu
                   ` (7 subsequent siblings)
  8 siblings, 0 replies; 15+ messages in thread
From: Greentime Hu @ 2018-04-19 13:18 UTC (permalink / raw)
  To: linux-kernel, arnd, greentime, green.hu, private

To include kernel/Kconfig.freezer to make sure the dependency between
CONFIG_CGROUP_FREEZER and CONFIG_FREEZER

It will cause building error when I make allmodconfig.

kernel/cgroup/freezer.c: In function 'freezer_css_online':
kernel/cgroup/freezer.c:116:15: error: 'system_freezing_cnt' undeclared (first use in this function)
   atomic_inc(&system_freezing_cnt);
               ^~~~~~~~~~~~~~~~~~~
kernel/cgroup/freezer.c:116:15: note: each undeclared identifier is reported only once for each function it appears in
kernel/cgroup/freezer.c: In function 'freezer_css_offline':
kernel/cgroup/freezer.c:137:15: error: 'system_freezing_cnt' undeclared (first use in this function)
   atomic_dec(&system_freezing_cnt);
               ^~~~~~~~~~~~~~~~~~~
kernel/cgroup/freezer.c: In function 'freezer_attach':
kernel/cgroup/freezer.c:181:4: error: implicit declaration of function 'freeze_task' [-Werror=implicit-function-declaration]
    freeze_task(task);
    ^~~~~~~~~~~
kernel/cgroup/freezer.c: In function 'freezer_apply_state':
kernel/cgroup/freezer.c:360:16: error: 'system_freezing_cnt' undeclared (first use in this function)
    atomic_inc(&system_freezing_cnt);
                ^~~~~~~~~~~~~~~~~~~

Signed-off-by: Greentime Hu <greentime@andestech.com>
---
 arch/nds32/Kconfig | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/nds32/Kconfig b/arch/nds32/Kconfig
index 98e05f997f91..b7404f2dcf5b 100644
--- a/arch/nds32/Kconfig
+++ b/arch/nds32/Kconfig
@@ -88,6 +88,7 @@ endmenu
 
 menu "Kernel Features"
 source "kernel/Kconfig.preempt"
+source "kernel/Kconfig.freezer"
 source "mm/Kconfig"
 source "kernel/Kconfig.hz"
 endmenu
-- 
1.9.5

^ permalink raw reply	[flat|nested] 15+ messages in thread

* [PATCH 3/9] nds32: Fix building error of crypto/xor.c by adding xor.h
  2018-04-19 13:18 [PATCH 1/9] nds32: lib: To use generic lib instead of libgcc to prevent the symbol undefined issue Greentime Hu
  2018-04-19 13:18 ` [PATCH 2/9] nds32: Fix building error when CONFIG_FREEZE is enabled Greentime Hu
@ 2018-04-19 13:18 ` Greentime Hu
  2018-04-19 13:18 ` [PATCH 4/9] nds32: Fix drivers/gpu/drm/udl/udl_fb.c building error by defining PAGE_SHARED Greentime Hu
                   ` (6 subsequent siblings)
  8 siblings, 0 replies; 15+ messages in thread
From: Greentime Hu @ 2018-04-19 13:18 UTC (permalink / raw)
  To: linux-kernel, arnd, greentime, green.hu, private

When I compiled with allmodconfig, it caused this building failed.
crypto/xor.c:25:21: fatal error: asm/xor.h: No such file or directory
 #include <asm/xor.h>
                     ^
compilation terminated.

Signed-off-by: Greentime Hu <greentime@andestech.com>
---
 arch/nds32/include/asm/Kbuild | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/nds32/include/asm/Kbuild b/arch/nds32/include/asm/Kbuild
index 06bdf8167f5a..a64e87cc8b49 100644
--- a/arch/nds32/include/asm/Kbuild
+++ b/arch/nds32/include/asm/Kbuild
@@ -49,6 +49,7 @@ generic-y += switch_to.h
 generic-y += timex.h
 generic-y += topology.h
 generic-y += trace_clock.h
+generic-y += xor.h
 generic-y += unaligned.h
 generic-y += user.h
 generic-y += vga.h
-- 
1.9.5

^ permalink raw reply	[flat|nested] 15+ messages in thread

* [PATCH 4/9] nds32: Fix drivers/gpu/drm/udl/udl_fb.c building error by defining PAGE_SHARED
  2018-04-19 13:18 [PATCH 1/9] nds32: lib: To use generic lib instead of libgcc to prevent the symbol undefined issue Greentime Hu
  2018-04-19 13:18 ` [PATCH 2/9] nds32: Fix building error when CONFIG_FREEZE is enabled Greentime Hu
  2018-04-19 13:18 ` [PATCH 3/9] nds32: Fix building error of crypto/xor.c by adding xor.h Greentime Hu
@ 2018-04-19 13:18 ` Greentime Hu
  2018-04-19 13:18 ` [PATCH 5/9] nds32: Fix xfs_buf built failed by export invalidate_kernel_vmap_range and flush_kernel_vmap_range Greentime Hu
                   ` (5 subsequent siblings)
  8 siblings, 0 replies; 15+ messages in thread
From: Greentime Hu @ 2018-04-19 13:18 UTC (permalink / raw)
  To: linux-kernel, arnd, greentime, green.hu, private

It broke the 'allmodconfig' build.
drivers/gpu/drm/udl/udl_fb.c: In function 'udl_fb_mmap':
drivers/gpu/drm/udl/udl_fb.c:183:52: error: 'PAGE_SHARED' undeclared (first use in this function)
   if (remap_pfn_range(vma, start, page, PAGE_SIZE, PAGE_SHARED))
                                                    ^~~~~~~~~~~
drivers/gpu/drm/udl/udl_fb.c:183:52: note: each undeclared identifier is reported only once for each function it appears in
make[4]: *** [drivers/gpu/drm/udl/udl_fb.o] Error 1

Signed-off-by: Greentime Hu <greentime@andestech.com>
---
 arch/nds32/include/asm/pgtable.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/nds32/include/asm/pgtable.h b/arch/nds32/include/asm/pgtable.h
index 6783937edbeb..d3e19a55cf53 100644
--- a/arch/nds32/include/asm/pgtable.h
+++ b/arch/nds32/include/asm/pgtable.h
@@ -152,6 +152,7 @@
 #define PAGE_CACHE_L1	__pgprot(_HAVE_PAGE_L | _PAGE_V | _PAGE_M_KRW | _PAGE_D | _PAGE_E | _PAGE_G | _PAGE_CACHE)
 #define PAGE_MEMORY	__pgprot(_HAVE_PAGE_L | _PAGE_V | _PAGE_M_KRW | _PAGE_D | _PAGE_E | _PAGE_G | _PAGE_CACHE_SHRD)
 #define PAGE_KERNEL	__pgprot(_PAGE_V | _PAGE_M_KRW | _PAGE_D | _PAGE_E | _PAGE_G | _PAGE_CACHE_SHRD)
+#define PAGE_SHARED	__pgprot(_PAGE_V | _PAGE_M_URW_KRW | _PAGE_D | _PAGE_CACHE_SHRD)
 #define PAGE_DEVICE    __pgprot(_PAGE_V | _PAGE_M_KRW | _PAGE_D | _PAGE_G | _PAGE_C_DEV)
 #endif /* __ASSEMBLY__ */
 
-- 
1.9.5

^ permalink raw reply	[flat|nested] 15+ messages in thread

* [PATCH 5/9] nds32: Fix xfs_buf built failed by export invalidate_kernel_vmap_range and flush_kernel_vmap_range
  2018-04-19 13:18 [PATCH 1/9] nds32: lib: To use generic lib instead of libgcc to prevent the symbol undefined issue Greentime Hu
                   ` (2 preceding siblings ...)
  2018-04-19 13:18 ` [PATCH 4/9] nds32: Fix drivers/gpu/drm/udl/udl_fb.c building error by defining PAGE_SHARED Greentime Hu
@ 2018-04-19 13:18 ` Greentime Hu
  2018-04-19 13:18 ` [PATCH 6/9] nds32: Fix the symbols undefined issue by exporting them Greentime Hu
                   ` (4 subsequent siblings)
  8 siblings, 0 replies; 15+ messages in thread
From: Greentime Hu @ 2018-04-19 13:18 UTC (permalink / raw)
  To: linux-kernel, arnd, greentime, green.hu, private

It broke the 'allmodconfig' build.
fs/xfs/xfs_buf.c: In function 'xfs_buf_bio_end_io':
fs/xfs/xfs_buf.c:1242:3: error: implicit declaration of function 'invalidate_kernel_vmap_range' [-Werror=implicit-function-declaration]
   invalidate_kernel_vmap_range(bp->b_addr, xfs_buf_vmap_len(bp));
   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
fs/xfs/xfs_buf.c: In function 'xfs_buf_ioapply_map':
fs/xfs/xfs_buf.c:1312:4: error: implicit declaration of function 'flush_kernel_vmap_range' [-Werror=implicit-function-declaration]
    flush_kernel_vmap_range(bp->b_addr,
    ^~~~~~~~~~~~~~~~~~~~~~~

Signed-off-by: Greentime Hu <greentime@andestech.com>
---
 arch/nds32/include/asm/cacheflush.h |  2 ++
 arch/nds32/mm/cacheflush.c          | 18 ++++++++++++++++++
 2 files changed, 20 insertions(+)

diff --git a/arch/nds32/include/asm/cacheflush.h b/arch/nds32/include/asm/cacheflush.h
index 1240f148ec0f..10b48f0d8e85 100644
--- a/arch/nds32/include/asm/cacheflush.h
+++ b/arch/nds32/include/asm/cacheflush.h
@@ -32,6 +32,8 @@ void flush_anon_page(struct vm_area_struct *vma,
 
 #define ARCH_HAS_FLUSH_KERNEL_DCACHE_PAGE
 void flush_kernel_dcache_page(struct page *page);
+void flush_kernel_vmap_range(void *addr, int size);
+void invalidate_kernel_vmap_range(void *addr, int size);
 void flush_icache_range(unsigned long start, unsigned long end);
 void flush_icache_page(struct vm_area_struct *vma, struct page *page);
 #define flush_dcache_mmap_lock(mapping)   xa_lock_irq(&(mapping)->i_pages)
diff --git a/arch/nds32/mm/cacheflush.c b/arch/nds32/mm/cacheflush.c
index 6eb786a399a2..bd52918d5923 100644
--- a/arch/nds32/mm/cacheflush.c
+++ b/arch/nds32/mm/cacheflush.c
@@ -273,6 +273,24 @@ void flush_kernel_dcache_page(struct page *page)
 	local_irq_restore(flags);
 }
 
+void flush_kernel_vmap_range(void *addr, int size)
+{
+	unsigned long flags;
+	local_irq_save(flags);
+	cpu_dcache_wb_range((unsigned long)addr, (unsigned long)addr +  size);
+	local_irq_restore(flags);
+}
+EXPORT_SYMBOL(flush_kernel_vmap_range);
+
+void invalidate_kernel_vmap_range(void *addr, int size)
+{
+	unsigned long flags;
+	local_irq_save(flags);
+	cpu_dcache_inval_range((unsigned long)addr, (unsigned long)addr + size);
+	local_irq_restore(flags);
+}
+EXPORT_SYMBOL(invalidate_kernel_vmap_range);
+
 void flush_icache_range(unsigned long start, unsigned long end)
 {
 	unsigned long line_size, flags;
-- 
1.9.5

^ permalink raw reply	[flat|nested] 15+ messages in thread

* [PATCH 6/9] nds32: Fix the symbols undefined issue by exporting them.
  2018-04-19 13:18 [PATCH 1/9] nds32: lib: To use generic lib instead of libgcc to prevent the symbol undefined issue Greentime Hu
                   ` (3 preceding siblings ...)
  2018-04-19 13:18 ` [PATCH 5/9] nds32: Fix xfs_buf built failed by export invalidate_kernel_vmap_range and flush_kernel_vmap_range Greentime Hu
@ 2018-04-19 13:18 ` Greentime Hu
  2018-04-20 10:41   ` Christoph Hellwig
  2018-04-19 13:18 ` [PATCH 7/9] nds32: Fix the unknown type u8 issue Greentime Hu
                   ` (3 subsequent siblings)
  8 siblings, 1 reply; 15+ messages in thread
From: Greentime Hu @ 2018-04-19 13:18 UTC (permalink / raw)
  To: linux-kernel, arnd, greentime, green.hu, private

It broke the 'allmodconfig' build.
  LD      vmlinux
  SYSMAP  System.map
  Building modules, stage 2.
  MODPOST 5028 modules
ERROR: "flush_dcache_page" [net/sunrpc/xprtrdma/rpcrdma.ko] undefined!
ERROR: "empty_zero_page" [net/ceph/libceph.ko] undefined!
ERROR: "save_stack_trace" [kernel/backtracetest.ko] undefined!
ERROR: "clear_page" [fs/ocfs2/dlm/ocfs2_dlm.ko] undefined!
ERROR: "copy_page" [fs/nilfs2/nilfs2.ko] undefined!
...

Signed-off-by: Greentime Hu <greentime@andestech.com>
---
 arch/nds32/include/asm/Kbuild  |  1 +
 arch/nds32/include/asm/page.h  |  3 +++
 arch/nds32/kernel/stacktrace.c |  1 +
 arch/nds32/lib/copy_page.S     |  3 +++
 arch/nds32/mm/cacheflush.c     | 22 ++++++++++++++++++++++
 arch/nds32/mm/init.c           |  1 +
 6 files changed, 31 insertions(+)

diff --git a/arch/nds32/include/asm/Kbuild b/arch/nds32/include/asm/Kbuild
index a64e87cc8b49..142e612aa639 100644
--- a/arch/nds32/include/asm/Kbuild
+++ b/arch/nds32/include/asm/Kbuild
@@ -16,6 +16,7 @@ generic-y += dma.h
 generic-y += emergency-restart.h
 generic-y += errno.h
 generic-y += exec.h
+generic-y += export.h
 generic-y += fb.h
 generic-y += fcntl.h
 generic-y += ftrace.h
diff --git a/arch/nds32/include/asm/page.h b/arch/nds32/include/asm/page.h
index e27365c097b6..947f0491c9a7 100644
--- a/arch/nds32/include/asm/page.h
+++ b/arch/nds32/include/asm/page.h
@@ -27,6 +27,9 @@ extern void copy_user_highpage(struct page *to, struct page *from,
 			       unsigned long vaddr, struct vm_area_struct *vma);
 extern void clear_user_highpage(struct page *page, unsigned long vaddr);
 
+void copy_user_page(void *vto, void *vfrom, unsigned long vaddr,
+		    struct page *to);
+void clear_user_page(void *addr, unsigned long vaddr, struct page *page);
 #define __HAVE_ARCH_COPY_USER_HIGHPAGE
 #define clear_user_highpage	clear_user_highpage
 #else
diff --git a/arch/nds32/kernel/stacktrace.c b/arch/nds32/kernel/stacktrace.c
index bc70113c0e84..168562eb3ad2 100644
--- a/arch/nds32/kernel/stacktrace.c
+++ b/arch/nds32/kernel/stacktrace.c
@@ -9,6 +9,7 @@ void save_stack_trace(struct stack_trace *trace)
 {
 	save_stack_trace_tsk(current, trace);
 }
+EXPORT_SYMBOL(save_stack_trace);
 
 void save_stack_trace_tsk(struct task_struct *tsk, struct stack_trace *trace)
 {
diff --git a/arch/nds32/lib/copy_page.S b/arch/nds32/lib/copy_page.S
index 4a2ff85f17ee..f8701ed161a8 100644
--- a/arch/nds32/lib/copy_page.S
+++ b/arch/nds32/lib/copy_page.S
@@ -2,6 +2,7 @@
 // Copyright (C) 2005-2017 Andes Technology Corporation
 
 #include <linux/linkage.h>
+#include <asm/export.h>
 #include <asm/page.h>
 
 	.text
@@ -16,6 +17,7 @@ ENTRY(copy_page)
 	popm	$r2, $r10
 	ret
 ENDPROC(copy_page)
+EXPORT_SYMBOL(copy_page)
 
 ENTRY(clear_page)
 	pushm	$r1, $r9
@@ -35,3 +37,4 @@ ENTRY(clear_page)
 	popm	$r1, $r9
         ret
 ENDPROC(clear_page)
+EXPORT_SYMBOL(clear_page)
diff --git a/arch/nds32/mm/cacheflush.c b/arch/nds32/mm/cacheflush.c
index bd52918d5923..ee44ad96b6ed 100644
--- a/arch/nds32/mm/cacheflush.c
+++ b/arch/nds32/mm/cacheflush.c
@@ -147,6 +147,25 @@ void flush_cache_vunmap(unsigned long start, unsigned long end)
 	cpu_icache_inval_all();
 }
 
+void copy_user_page(void *vto, void *vfrom, unsigned long vaddr,
+		    struct page *to)
+{
+	cpu_dcache_wbinval_page((unsigned long)vaddr);
+	cpu_icache_inval_page((unsigned long)vaddr);
+	copy_page(vto, vfrom);
+	cpu_dcache_wbinval_page((unsigned long)vto);
+	cpu_icache_inval_page((unsigned long)vto);
+}
+
+void clear_user_page(void *addr, unsigned long vaddr, struct page *page)
+{
+	cpu_dcache_wbinval_page((unsigned long)vaddr);
+	cpu_icache_inval_page((unsigned long)vaddr);
+	clear_page(addr);
+	cpu_dcache_wbinval_page((unsigned long)addr);
+	cpu_icache_inval_page((unsigned long)addr);
+}
+
 void copy_user_highpage(struct page *to, struct page *from,
 			unsigned long vaddr, struct vm_area_struct *vma)
 {
@@ -213,6 +232,7 @@ void flush_dcache_page(struct page *page)
 		local_irq_restore(flags);
 	}
 }
+EXPORT_SYMBOL(flush_dcache_page);
 
 void copy_to_user_page(struct vm_area_struct *vma, struct page *page,
 		       unsigned long vaddr, void *dst, void *src, int len)
@@ -272,6 +292,7 @@ void flush_kernel_dcache_page(struct page *page)
 	cpu_dcache_wbinval_page((unsigned long)page_address(page));
 	local_irq_restore(flags);
 }
+EXPORT_SYMBOL(flush_kernel_dcache_page);
 
 void flush_kernel_vmap_range(void *addr, int size)
 {
@@ -301,6 +322,7 @@ void flush_icache_range(unsigned long start, unsigned long end)
 	cpu_cache_wbinval_range(start, end, 1);
 	local_irq_restore(flags);
 }
+EXPORT_SYMBOL(flush_icache_range);
 
 void flush_icache_page(struct vm_area_struct *vma, struct page *page)
 {
diff --git a/arch/nds32/mm/init.c b/arch/nds32/mm/init.c
index 93ee0160720b..c713d2ad55dc 100644
--- a/arch/nds32/mm/init.c
+++ b/arch/nds32/mm/init.c
@@ -30,6 +30,7 @@
  * zero-initialized data and COW.
  */
 struct page *empty_zero_page;
+EXPORT_SYMBOL(empty_zero_page);
 
 static void __init zone_sizes_init(void)
 {
-- 
1.9.5

^ permalink raw reply	[flat|nested] 15+ messages in thread

* [PATCH 7/9] nds32: Fix the unknown type u8 issue.
  2018-04-19 13:18 [PATCH 1/9] nds32: lib: To use generic lib instead of libgcc to prevent the symbol undefined issue Greentime Hu
                   ` (4 preceding siblings ...)
  2018-04-19 13:18 ` [PATCH 6/9] nds32: Fix the symbols undefined issue by exporting them Greentime Hu
@ 2018-04-19 13:18 ` Greentime Hu
  2018-04-19 13:18 ` [PATCH 8/9] nds32: Fix build failed because arch_trace_hardirqs_off is changed to trace_hardirqs_off Greentime Hu
                   ` (2 subsequent siblings)
  8 siblings, 0 replies; 15+ messages in thread
From: Greentime Hu @ 2018-04-19 13:18 UTC (permalink / raw)
  To: linux-kernel, arnd, greentime, green.hu, private

It broke the 'allmodconfig' build.
We need to include <linux/types.h> to make sure the type is defined
before using it.

Signed-off-by: Greentime Hu <greentime@andestech.com>
---
 arch/nds32/include/asm/io.h | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/arch/nds32/include/asm/io.h b/arch/nds32/include/asm/io.h
index 966e71b3c960..71cd226d6863 100644
--- a/arch/nds32/include/asm/io.h
+++ b/arch/nds32/include/asm/io.h
@@ -4,6 +4,8 @@
 #ifndef __ASM_NDS32_IO_H
 #define __ASM_NDS32_IO_H
 
+#include <linux/types.h>
+
 extern void iounmap(volatile void __iomem *addr);
 #define __raw_writeb __raw_writeb
 static inline void __raw_writeb(u8 val, volatile void __iomem *addr)
-- 
1.9.5

^ permalink raw reply	[flat|nested] 15+ messages in thread

* [PATCH 8/9] nds32: Fix build failed because arch_trace_hardirqs_off is changed to trace_hardirqs_off.
  2018-04-19 13:18 [PATCH 1/9] nds32: lib: To use generic lib instead of libgcc to prevent the symbol undefined issue Greentime Hu
                   ` (5 preceding siblings ...)
  2018-04-19 13:18 ` [PATCH 7/9] nds32: Fix the unknown type u8 issue Greentime Hu
@ 2018-04-19 13:18 ` Greentime Hu
  2018-04-19 13:18 ` [PATCH 9/9] nds32: Fix the allmodconfig build. To make sure CONFIG_CPU_LITTLE_ENDIAN is default y Greentime Hu
  2018-04-19 13:36 ` [PATCH 1/9] nds32: lib: To use generic lib instead of libgcc to prevent the symbol undefined issue Arnd Bergmann
  8 siblings, 0 replies; 15+ messages in thread
From: Greentime Hu @ 2018-04-19 13:18 UTC (permalink / raw)
  To: linux-kernel, arnd, greentime, green.hu, private

It broke the 'allmodconfig' build when CONFIG_TRACE_IRQFLAGS is enabled.

Signed-off-by: Greentime Hu <greentime@andestech.com>
---
 arch/nds32/kernel/ex-entry.S | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/nds32/kernel/ex-entry.S b/arch/nds32/kernel/ex-entry.S
index a72e83d804f5..b8ae4e9a6b93 100644
--- a/arch/nds32/kernel/ex-entry.S
+++ b/arch/nds32/kernel/ex-entry.S
@@ -118,7 +118,7 @@ common_exception_handler:
 	/* interrupt */
 2:
 #ifdef CONFIG_TRACE_IRQFLAGS
-	jal     arch_trace_hardirqs_off
+	jal     trace_hardirqs_off
 #endif
 	move	$r0, $sp
 	sethi	$lp, hi20(ret_from_intr)
-- 
1.9.5

^ permalink raw reply	[flat|nested] 15+ messages in thread

* [PATCH 9/9] nds32: Fix the allmodconfig build. To make sure CONFIG_CPU_LITTLE_ENDIAN is default y
  2018-04-19 13:18 [PATCH 1/9] nds32: lib: To use generic lib instead of libgcc to prevent the symbol undefined issue Greentime Hu
                   ` (6 preceding siblings ...)
  2018-04-19 13:18 ` [PATCH 8/9] nds32: Fix build failed because arch_trace_hardirqs_off is changed to trace_hardirqs_off Greentime Hu
@ 2018-04-19 13:18 ` Greentime Hu
  2018-04-19 13:35   ` Arnd Bergmann
  2018-04-19 18:38   ` [9/9] " Guenter Roeck
  2018-04-19 13:36 ` [PATCH 1/9] nds32: lib: To use generic lib instead of libgcc to prevent the symbol undefined issue Arnd Bergmann
  8 siblings, 2 replies; 15+ messages in thread
From: Greentime Hu @ 2018-04-19 13:18 UTC (permalink / raw)
  To: linux-kernel, arnd, greentime, green.hu, private

This way we can build kernel with CONFIG_CPU_LITTLE_ENDIAN=y and allmodconfig
will be available.

Signed-off-by: Greentime Hu <greentime@andestech.com>
---
 arch/nds32/Kconfig.cpu | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/arch/nds32/Kconfig.cpu b/arch/nds32/Kconfig.cpu
index ba44cc539da9..b8c8984d1456 100644
--- a/arch/nds32/Kconfig.cpu
+++ b/arch/nds32/Kconfig.cpu
@@ -1,10 +1,11 @@
 comment "Processor Features"
 
 config CPU_BIG_ENDIAN
-	bool "Big endian"
+	def_bool !CPU_LITTLE_ENDIAN
 
 config CPU_LITTLE_ENDIAN
-        def_bool !CPU_BIG_ENDIAN
+	bool "Little endian"
+	default y
 
 config HWZOL
 	bool "hardware zero overhead loop support"
-- 
1.9.5

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH 9/9] nds32: Fix the allmodconfig build. To make sure CONFIG_CPU_LITTLE_ENDIAN is default y
  2018-04-19 13:18 ` [PATCH 9/9] nds32: Fix the allmodconfig build. To make sure CONFIG_CPU_LITTLE_ENDIAN is default y Greentime Hu
@ 2018-04-19 13:35   ` Arnd Bergmann
  2018-04-19 18:38   ` [9/9] " Guenter Roeck
  1 sibling, 0 replies; 15+ messages in thread
From: Arnd Bergmann @ 2018-04-19 13:35 UTC (permalink / raw)
  To: Greentime Hu; +Cc: Linux Kernel Mailing List, Greentime, Guenter Roeck

On Thu, Apr 19, 2018 at 3:18 PM, Greentime Hu <green.hu@gmail.com> wrote:
> This way we can build kernel with CONFIG_CPU_LITTLE_ENDIAN=y and allmodconfig
> will be available.
>
> Signed-off-by: Greentime Hu <greentime@andestech.com>
> ---
>  arch/nds32/Kconfig.cpu | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/arch/nds32/Kconfig.cpu b/arch/nds32/Kconfig.cpu
> index ba44cc539da9..b8c8984d1456 100644
> --- a/arch/nds32/Kconfig.cpu
> +++ b/arch/nds32/Kconfig.cpu
> @@ -1,10 +1,11 @@
>  comment "Processor Features"
>
>  config CPU_BIG_ENDIAN
> -       bool "Big endian"
> +       def_bool !CPU_LITTLE_ENDIAN
>
>  config CPU_LITTLE_ENDIAN
> -        def_bool !CPU_BIG_ENDIAN
> +       bool "Little endian"
> +       default y

Can you still build 'allnoconfig' after this? It will default to big-endian now,
and I'm not sure if this works with an nds32le toolchain.

On other architectures, we pass -mlittle-endian/-mbig-endian to the
compiler to force it into whichever mode the kernel is configured for,
but you don't seem to do that (or your gcc can't do it maybe).

     Arnd

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH 1/9] nds32: lib: To use generic lib instead of libgcc to prevent the symbol undefined issue.
  2018-04-19 13:18 [PATCH 1/9] nds32: lib: To use generic lib instead of libgcc to prevent the symbol undefined issue Greentime Hu
                   ` (7 preceding siblings ...)
  2018-04-19 13:18 ` [PATCH 9/9] nds32: Fix the allmodconfig build. To make sure CONFIG_CPU_LITTLE_ENDIAN is default y Greentime Hu
@ 2018-04-19 13:36 ` Arnd Bergmann
  8 siblings, 0 replies; 15+ messages in thread
From: Arnd Bergmann @ 2018-04-19 13:36 UTC (permalink / raw)
  To: Greentime Hu; +Cc: Linux Kernel Mailing List, Greentime, Guenter Roeck

On Thu, Apr 19, 2018 at 3:18 PM, Greentime Hu <green.hu@gmail.com> wrote:
> We can use the generic lib to fix these error because the symbol of
> libgcc in toolchain is not exported.
>
> ERROR: "__ucmpdi2" [fs/xfs/xfs.ko] undefined!
> ERROR: "__ashrdi3" [fs/xfs/xfs.ko] undefined!
> ERROR: "__lshrdi3" [fs/xfs/xfs.ko] undefined!
> ERROR: "__ashldi3" [fs/ntfs/ntfs.ko] undefined!
> ...
>
> Signed-off-by: Greentime Hu <greentime@andestech.com>

I looked at all nine patches, they all seem like useful fixes:

Acked-by: Arnd Bergmann <arnd@arndb.de>

For the last patch, I commented separately, we might need an additional
patch on top to make it more robust.

        Arnd

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [9/9] nds32: Fix the allmodconfig build. To make sure CONFIG_CPU_LITTLE_ENDIAN is default y
  2018-04-19 13:18 ` [PATCH 9/9] nds32: Fix the allmodconfig build. To make sure CONFIG_CPU_LITTLE_ENDIAN is default y Greentime Hu
  2018-04-19 13:35   ` Arnd Bergmann
@ 2018-04-19 18:38   ` Guenter Roeck
  2018-04-20 11:54     ` Greentime Hu
  1 sibling, 1 reply; 15+ messages in thread
From: Guenter Roeck @ 2018-04-19 18:38 UTC (permalink / raw)
  To: Greentime Hu; +Cc: linux-kernel, arnd, greentime, private

On Thu, Apr 19, 2018 at 09:18:15PM +0800, Greentime Hu wrote:
> This way we can build kernel with CONFIG_CPU_LITTLE_ENDIAN=y and allmodconfig
> will be available.
> 
> Signed-off-by: Greentime Hu <greentime@andestech.com>

As Arnd suspected, this causes allnoconfig to fail.
The failure is due to endianness mismatches in vdso code.

Not sure if that is really an improvement.

Guenter

> ---
>  arch/nds32/Kconfig.cpu | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/arch/nds32/Kconfig.cpu b/arch/nds32/Kconfig.cpu
> index ba44cc539da9..b8c8984d1456 100644
> --- a/arch/nds32/Kconfig.cpu
> +++ b/arch/nds32/Kconfig.cpu
> @@ -1,10 +1,11 @@
>  comment "Processor Features"
>  
>  config CPU_BIG_ENDIAN
> -	bool "Big endian"
> +	def_bool !CPU_LITTLE_ENDIAN
>  
>  config CPU_LITTLE_ENDIAN
> -        def_bool !CPU_BIG_ENDIAN
> +	bool "Little endian"
> +	default y
>  
>  config HWZOL
>  	bool "hardware zero overhead loop support"

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH 6/9] nds32: Fix the symbols undefined issue by exporting them.
  2018-04-19 13:18 ` [PATCH 6/9] nds32: Fix the symbols undefined issue by exporting them Greentime Hu
@ 2018-04-20 10:41   ` Christoph Hellwig
  2018-04-20 12:01     ` Greentime Hu
  0 siblings, 1 reply; 15+ messages in thread
From: Christoph Hellwig @ 2018-04-20 10:41 UTC (permalink / raw)
  To: Greentime Hu; +Cc: linux-kernel, arnd, greentime, private

> +++ b/arch/nds32/kernel/stacktrace.c
> @@ -9,6 +9,7 @@ void save_stack_trace(struct stack_trace *trace)
>  {
>  	save_stack_trace_tsk(current, trace);
>  }
> +EXPORT_SYMBOL(save_stack_trace);

All other architectures use EXPORT_SYMBOL_GPL here.

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [9/9] nds32: Fix the allmodconfig build. To make sure CONFIG_CPU_LITTLE_ENDIAN is default y
  2018-04-19 18:38   ` [9/9] " Guenter Roeck
@ 2018-04-20 11:54     ` Greentime Hu
  0 siblings, 0 replies; 15+ messages in thread
From: Greentime Hu @ 2018-04-20 11:54 UTC (permalink / raw)
  To: Guenter Roeck
  Cc: Linux Kernel Mailing List, Arnd Bergmann, Greentime, Guenter Roeck

2018-04-20 2:38 GMT+08:00 Guenter Roeck <linux@roeck-us.net>:
> On Thu, Apr 19, 2018 at 09:18:15PM +0800, Greentime Hu wrote:
>> This way we can build kernel with CONFIG_CPU_LITTLE_ENDIAN=y and allmodconfig
>> will be available.
>>
>> Signed-off-by: Greentime Hu <greentime@andestech.com>
>
> As Arnd suspected, this causes allnoconfig to fail.
> The failure is due to endianness mismatches in vdso code.
>
> Not sure if that is really an improvement.
>

Thank you for reviewing.
The reason of this issue is because some objects are compiled with -EL
and some objects are compiled with -EB to cause endianness mismatch
issue.
It happened because AFLAGS and LDFLAGS is not passed correctly. I will
send the 2nd verson patch to fix this issue.

Yes, allnoconfig is fine after applying these fixes.

diff --git a/arch/nds32/Makefile b/arch/nds32/Makefile
index 20edf34e70ce..513bb2e9baf9 100644
--- a/arch/nds32/Makefile
+++ b/arch/nds32/Makefile
@@ -32,8 +32,12 @@ endif

 ifdef CONFIG_CPU_LITTLE_ENDIAN
 KBUILD_CFLAGS   += $(call cc-option, -EL)
+KBUILD_AFLAGS   += $(call cc-option, -EL)
+LDFLAGS         += $(call cc-option, -EL)
 else
 KBUILD_CFLAGS   += $(call cc-option, -EB)
+KBUILD_AFLAGS   += $(call cc-option, -EB)
+LDFLAGS         += $(call cc-option, -EB)
 endif

---
greentime@atcsqa02:/sqa2/greentime/contrib/travis/build_script/src_pkg/linux
<gt-master> $ nds32le-elf-readelf -h vmlinux
ELF Header:
  Magic:   7f 45 4c 46 01 02 01 00 00 00 00 00 00 00 00 00
  Class:                             ELF32
  Data:                              2's complement, big endian
  Version:                           1 (current)
  OS/ABI:                            UNIX - System V
  ABI Version:                       0
  Type:                              EXEC (Executable file)
  Machine:                           Andes Technology compact code
size embedded RISC processor family
  Version:                           0x1
  Entry point address:               0xc000
  Start of program headers:          52 (bytes into file)
  Start of section headers:          905772 (bytes into file)
  Flags:                             0x30000242, AABI, Andes ELF V1.4,
Andes Star v3.0, PERF1
  Size of this header:               52 (bytes)
  Size of program headers:           32 (bytes)
  Number of program headers:         4
  Size of section headers:           40 (bytes)
  Number of section headers:         18
  Section header string table index: 15

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH 6/9] nds32: Fix the symbols undefined issue by exporting them.
  2018-04-20 10:41   ` Christoph Hellwig
@ 2018-04-20 12:01     ` Greentime Hu
  0 siblings, 0 replies; 15+ messages in thread
From: Greentime Hu @ 2018-04-20 12:01 UTC (permalink / raw)
  To: Christoph Hellwig
  Cc: Linux Kernel Mailing List, Arnd Bergmann, Greentime, Guenter Roeck

2018-04-20 18:41 GMT+08:00 Christoph Hellwig <hch@infradead.org>:
>> +++ b/arch/nds32/kernel/stacktrace.c
>> @@ -9,6 +9,7 @@ void save_stack_trace(struct stack_trace *trace)
>>  {
>>       save_stack_trace_tsk(current, trace);
>>  }
>> +EXPORT_SYMBOL(save_stack_trace);
>
> All other architectures use EXPORT_SYMBOL_GPL here.

Thank you.
I will update it and other architectures also export save_stack_trace_tsk.
I will export it too.

^ permalink raw reply	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2018-04-20 12:02 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-04-19 13:18 [PATCH 1/9] nds32: lib: To use generic lib instead of libgcc to prevent the symbol undefined issue Greentime Hu
2018-04-19 13:18 ` [PATCH 2/9] nds32: Fix building error when CONFIG_FREEZE is enabled Greentime Hu
2018-04-19 13:18 ` [PATCH 3/9] nds32: Fix building error of crypto/xor.c by adding xor.h Greentime Hu
2018-04-19 13:18 ` [PATCH 4/9] nds32: Fix drivers/gpu/drm/udl/udl_fb.c building error by defining PAGE_SHARED Greentime Hu
2018-04-19 13:18 ` [PATCH 5/9] nds32: Fix xfs_buf built failed by export invalidate_kernel_vmap_range and flush_kernel_vmap_range Greentime Hu
2018-04-19 13:18 ` [PATCH 6/9] nds32: Fix the symbols undefined issue by exporting them Greentime Hu
2018-04-20 10:41   ` Christoph Hellwig
2018-04-20 12:01     ` Greentime Hu
2018-04-19 13:18 ` [PATCH 7/9] nds32: Fix the unknown type u8 issue Greentime Hu
2018-04-19 13:18 ` [PATCH 8/9] nds32: Fix build failed because arch_trace_hardirqs_off is changed to trace_hardirqs_off Greentime Hu
2018-04-19 13:18 ` [PATCH 9/9] nds32: Fix the allmodconfig build. To make sure CONFIG_CPU_LITTLE_ENDIAN is default y Greentime Hu
2018-04-19 13:35   ` Arnd Bergmann
2018-04-19 18:38   ` [9/9] " Guenter Roeck
2018-04-20 11:54     ` Greentime Hu
2018-04-19 13:36 ` [PATCH 1/9] nds32: lib: To use generic lib instead of libgcc to prevent the symbol undefined issue Arnd Bergmann

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).