2018-04-19 13:23:52

by Greentime Hu

[permalink] [raw]
Subject: [PATCH 1/9] nds32: lib: To use generic lib instead of libgcc to prevent the symbol undefined issue.

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 <[email protected]>
---
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



2018-04-19 13:21:45

by Greentime Hu

[permalink] [raw]
Subject: [PATCH 9/9] nds32: Fix the allmodconfig build. To make sure CONFIG_CPU_LITTLE_ENDIAN is default y

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

Signed-off-by: Greentime Hu <[email protected]>
---
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


2018-04-19 13:22:06

by Greentime Hu

[permalink] [raw]
Subject: [PATCH 7/9] nds32: Fix the unknown type u8 issue.

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 <[email protected]>
---
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


2018-04-19 13:22:26

by Greentime Hu

[permalink] [raw]
Subject: [PATCH 8/9] nds32: Fix build failed because arch_trace_hardirqs_off is changed to trace_hardirqs_off.

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

Signed-off-by: Greentime Hu <[email protected]>
---
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


2018-04-19 13:22:40

by Greentime Hu

[permalink] [raw]
Subject: [PATCH 5/9] nds32: Fix xfs_buf built failed by export invalidate_kernel_vmap_range and flush_kernel_vmap_range

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 <[email protected]>
---
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


2018-04-19 13:22:55

by Greentime Hu

[permalink] [raw]
Subject: [PATCH 3/9] nds32: Fix building error of crypto/xor.c by adding xor.h

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 <[email protected]>
---
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


2018-04-19 13:23:03

by Greentime Hu

[permalink] [raw]
Subject: [PATCH 4/9] nds32: Fix drivers/gpu/drm/udl/udl_fb.c building error by defining PAGE_SHARED

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 <[email protected]>
---
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


2018-04-19 13:23:17

by Greentime Hu

[permalink] [raw]
Subject: [PATCH 2/9] nds32: Fix building error when CONFIG_FREEZE is enabled.

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 <[email protected]>
---
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


2018-04-19 13:23:25

by Greentime Hu

[permalink] [raw]
Subject: [PATCH 6/9] nds32: Fix the symbols undefined issue by exporting them.

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 <[email protected]>
---
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


2018-04-19 13:37:18

by Arnd Bergmann

[permalink] [raw]
Subject: Re: [PATCH 9/9] nds32: Fix the allmodconfig build. To make sure CONFIG_CPU_LITTLE_ENDIAN is default y

On Thu, Apr 19, 2018 at 3:18 PM, Greentime Hu <[email protected]> wrote:
> This way we can build kernel with CONFIG_CPU_LITTLE_ENDIAN=y and allmodconfig
> will be available.
>
> Signed-off-by: Greentime Hu <[email protected]>
> ---
> 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

2018-04-19 13:38:29

by Arnd Bergmann

[permalink] [raw]
Subject: Re: [PATCH 1/9] nds32: lib: To use generic lib instead of libgcc to prevent the symbol undefined issue.

On Thu, Apr 19, 2018 at 3:18 PM, Greentime Hu <[email protected]> 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 <[email protected]>

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

Acked-by: Arnd Bergmann <[email protected]>

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

Arnd

2018-04-19 18:40:25

by Guenter Roeck

[permalink] [raw]
Subject: Re: [9/9] nds32: Fix the allmodconfig build. To make sure CONFIG_CPU_LITTLE_ENDIAN is default y

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 <[email protected]>

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"

2018-04-20 10:42:55

by Christoph Hellwig

[permalink] [raw]
Subject: Re: [PATCH 6/9] nds32: Fix the symbols undefined issue by exporting them.

> +++ 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.

2018-04-20 11:56:55

by Greentime Hu

[permalink] [raw]
Subject: Re: [9/9] nds32: Fix the allmodconfig build. To make sure CONFIG_CPU_LITTLE_ENDIAN is default y

2018-04-20 2:38 GMT+08:00 Guenter Roeck <[email protected]>:
> 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 <[email protected]>
>
> 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

2018-04-20 12:04:07

by Greentime Hu

[permalink] [raw]
Subject: Re: [PATCH 6/9] nds32: Fix the symbols undefined issue by exporting them.

2018-04-20 18:41 GMT+08:00 Christoph Hellwig <[email protected]>:
>> +++ 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.