LoongArch architecture development
 help / color / mirror / Atom feed
* [PATCH 0/2] LoongArch: Allow building with kcov
@ 2023-07-04 12:53 Feiyang Chen
  2023-07-04 12:53 ` [PATCH 1/2] LoongArch: relocatable: Provide kaslr_offset() to get the kernel offset Feiyang Chen
  2023-07-04 12:53 ` [PATCH 2/2] LoongArch: Allow building with kcov coverage Feiyang Chen
  0 siblings, 2 replies; 8+ messages in thread
From: Feiyang Chen @ 2023-07-04 12:53 UTC (permalink / raw)
  To: chenhuacai
  Cc: Feiyang Chen, hejinyang, dvyukov, andreyknvl, loongarch,
	kasan-dev, chris.chenfeiyang, loongson-kernel

Provide kaslr_offset() and allow building with kcov.

Feiyang Chen (2):
  LoongArch: relocatable: Provide kaslr_offset() to get the kernel
    offset
  LoongArch: Allow building with kcov coverage

 arch/loongarch/Kconfig             |  1 +
 arch/loongarch/include/asm/setup.h |  6 ++++++
 arch/loongarch/kernel/relocate.c   | 18 ++++++++----------
 arch/loongarch/kernel/setup.c      |  3 +++
 arch/loongarch/vdso/Makefile       |  2 ++
 5 files changed, 20 insertions(+), 10 deletions(-)

-- 
2.39.3


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

* [PATCH 1/2] LoongArch: relocatable: Provide kaslr_offset() to get the kernel offset
  2023-07-04 12:53 [PATCH 0/2] LoongArch: Allow building with kcov Feiyang Chen
@ 2023-07-04 12:53 ` Feiyang Chen
  2023-07-09  3:50   ` Huacai Chen
  2023-07-04 12:53 ` [PATCH 2/2] LoongArch: Allow building with kcov coverage Feiyang Chen
  1 sibling, 1 reply; 8+ messages in thread
From: Feiyang Chen @ 2023-07-04 12:53 UTC (permalink / raw)
  To: chenhuacai
  Cc: Feiyang Chen, dvyukov, andreyknvl, loongarch, kasan-dev,
	chris.chenfeiyang, loongson-kernel

Provide kaslr_offset() to get the kernel offset when KASLR is enabled.
Rename reloc_offset to __reloc_offset and export it.

Signed-off-by: Feiyang Chen <chenfeiyang@loongson.cn>
---
 arch/loongarch/include/asm/setup.h |  6 ++++++
 arch/loongarch/kernel/relocate.c   | 18 ++++++++----------
 arch/loongarch/kernel/setup.c      |  3 +++
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/arch/loongarch/include/asm/setup.h b/arch/loongarch/include/asm/setup.h
index 2dca0d1dd90a..39f9964bbdd4 100644
--- a/arch/loongarch/include/asm/setup.h
+++ b/arch/loongarch/include/asm/setup.h
@@ -37,4 +37,10 @@ extern unsigned long __init relocate_kernel(void);
 
 #endif
 
+extern unsigned long __reloc_offset;
+static inline unsigned long kaslr_offset(void)
+{
+	return __reloc_offset;
+}
+
 #endif /* __SETUP_H */
diff --git a/arch/loongarch/kernel/relocate.c b/arch/loongarch/kernel/relocate.c
index 6c3eff9af9fb..9ba560d514e1 100644
--- a/arch/loongarch/kernel/relocate.c
+++ b/arch/loongarch/kernel/relocate.c
@@ -16,11 +16,9 @@
 #include <asm/sections.h>
 #include <asm/setup.h>
 
-#define RELOCATED(x) ((void *)((long)x + reloc_offset))
+#define RELOCATED(x) ((void *)((long)x + __reloc_offset))
 #define RELOCATED_KASLR(x) ((void *)((long)x + random_offset))
 
-static unsigned long reloc_offset;
-
 static inline void __init relocate_relative(void)
 {
 	Elf64_Rela *rela, *rela_end;
@@ -154,7 +152,7 @@ static inline void __init update_reloc_offset(unsigned long *addr, long random_o
 {
 	unsigned long *new_addr = (unsigned long *)RELOCATED_KASLR(addr);
 
-	*new_addr = (unsigned long)reloc_offset;
+	*new_addr = (unsigned long)__reloc_offset;
 }
 
 unsigned long __init relocate_kernel(void)
@@ -173,7 +171,7 @@ unsigned long __init relocate_kernel(void)
 	if (relocation_addr_valid(location_new))
 		random_offset = (unsigned long)location_new - (unsigned long)(_text);
 #endif
-	reloc_offset = (unsigned long)_text - VMLINUX_LOAD_ADDRESS;
+	__reloc_offset = (unsigned long)_text - VMLINUX_LOAD_ADDRESS;
 
 	if (random_offset) {
 		kernel_length = (long)(_end) - (long)(_text);
@@ -187,15 +185,15 @@ unsigned long __init relocate_kernel(void)
 			"dbar 0 \t\n"
 			::: "memory");
 
-		reloc_offset += random_offset;
+		__reloc_offset += random_offset;
 
 		/* The current thread is now within the relocated kernel */
 		__current_thread_info = RELOCATED_KASLR(__current_thread_info);
 
-		update_reloc_offset(&reloc_offset, random_offset);
+		update_reloc_offset(&__reloc_offset, random_offset);
 	}
 
-	if (reloc_offset)
+	if (__reloc_offset)
 		relocate_relative();
 
 	relocate_absolute(random_offset);
@@ -208,9 +206,9 @@ unsigned long __init relocate_kernel(void)
  */
 static void show_kernel_relocation(const char *level)
 {
-	if (reloc_offset > 0) {
+	if (__reloc_offset > 0) {
 		printk(level);
-		pr_cont("Kernel relocated by 0x%lx\n", reloc_offset);
+		pr_cont("Kernel relocated by 0x%lx\n", __reloc_offset);
 		pr_cont(" .text @ 0x%px\n", _text);
 		pr_cont(" .data @ 0x%px\n", _sdata);
 		pr_cont(" .bss  @ 0x%px\n", __bss_start);
diff --git a/arch/loongarch/kernel/setup.c b/arch/loongarch/kernel/setup.c
index 95e6b579dfdd..d7bda711824f 100644
--- a/arch/loongarch/kernel/setup.c
+++ b/arch/loongarch/kernel/setup.c
@@ -65,6 +65,9 @@ struct cpuinfo_loongarch cpu_data[NR_CPUS] __read_mostly;
 
 EXPORT_SYMBOL(cpu_data);
 
+unsigned long __reloc_offset __ro_after_init;
+EXPORT_SYMBOL(__reloc_offset);
+
 struct loongson_board_info b_info;
 static const char dmi_empty_string[] = "        ";
 
-- 
2.39.3


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

* [PATCH 2/2] LoongArch: Allow building with kcov coverage
  2023-07-04 12:53 [PATCH 0/2] LoongArch: Allow building with kcov Feiyang Chen
  2023-07-04 12:53 ` [PATCH 1/2] LoongArch: relocatable: Provide kaslr_offset() to get the kernel offset Feiyang Chen
@ 2023-07-04 12:53 ` Feiyang Chen
  2023-07-09  3:55   ` Huacai Chen
  2023-09-10 15:51   ` Guenter Roeck
  1 sibling, 2 replies; 8+ messages in thread
From: Feiyang Chen @ 2023-07-04 12:53 UTC (permalink / raw)
  To: chenhuacai
  Cc: Feiyang Chen, dvyukov, andreyknvl, loongarch, kasan-dev,
	chris.chenfeiyang, loongson-kernel

Add ARCH_HAS_KCOV to the LoongArch Kconfig. Also disable
instrumentation of vdso.

Signed-off-by: Feiyang Chen <chenfeiyang@loongson.cn>
---
 arch/loongarch/Kconfig       | 1 +
 arch/loongarch/vdso/Makefile | 2 ++
 2 files changed, 3 insertions(+)

diff --git a/arch/loongarch/Kconfig b/arch/loongarch/Kconfig
index ed9a148cdcde..4c21a961ab88 100644
--- a/arch/loongarch/Kconfig
+++ b/arch/loongarch/Kconfig
@@ -14,6 +14,7 @@ config LOONGARCH
 	select ARCH_HAS_ACPI_TABLE_UPGRADE	if ACPI
 	select ARCH_HAS_CPU_FINALIZE_INIT
 	select ARCH_HAS_FORTIFY_SOURCE
+	select ARCH_HAS_KCOV
 	select ARCH_HAS_NMI_SAFE_THIS_CPU_OPS
 	select ARCH_HAS_PTE_SPECIAL
 	select ARCH_HAS_TICK_BROADCAST if GENERIC_CLOCKEVENTS_BROADCAST
diff --git a/arch/loongarch/vdso/Makefile b/arch/loongarch/vdso/Makefile
index 7bb794604af3..7dc87377688b 100644
--- a/arch/loongarch/vdso/Makefile
+++ b/arch/loongarch/vdso/Makefile
@@ -5,6 +5,8 @@ ifdef CONFIG_KASAN
 KASAN_SANITIZE := n
 endif
 
+KCOV_INSTRUMENT := n
+
 # Include the generic Makefile to check the built vdso.
 include $(srctree)/lib/vdso/Makefile
 
-- 
2.39.3


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

* Re: [PATCH 1/2] LoongArch: relocatable: Provide kaslr_offset() to get the kernel offset
  2023-07-04 12:53 ` [PATCH 1/2] LoongArch: relocatable: Provide kaslr_offset() to get the kernel offset Feiyang Chen
@ 2023-07-09  3:50   ` Huacai Chen
  0 siblings, 0 replies; 8+ messages in thread
From: Huacai Chen @ 2023-07-09  3:50 UTC (permalink / raw)
  To: Feiyang Chen
  Cc: dvyukov, andreyknvl, loongarch, kasan-dev, chris.chenfeiyang,
	loongson-kernel

Hi, Feiyang,

On Tue, Jul 4, 2023 at 8:53 PM Feiyang Chen <chenfeiyang@loongson.cn> wrote:
>
> Provide kaslr_offset() to get the kernel offset when KASLR is enabled.
> Rename reloc_offset to __reloc_offset and export it.
>
> Signed-off-by: Feiyang Chen <chenfeiyang@loongson.cn>
> ---
>  arch/loongarch/include/asm/setup.h |  6 ++++++
>  arch/loongarch/kernel/relocate.c   | 18 ++++++++----------
>  arch/loongarch/kernel/setup.c      |  3 +++
>  3 files changed, 17 insertions(+), 10 deletions(-)
>
> diff --git a/arch/loongarch/include/asm/setup.h b/arch/loongarch/include/asm/setup.h
> index 2dca0d1dd90a..39f9964bbdd4 100644
> --- a/arch/loongarch/include/asm/setup.h
> +++ b/arch/loongarch/include/asm/setup.h
> @@ -37,4 +37,10 @@ extern unsigned long __init relocate_kernel(void);
>
>  #endif
>
> +extern unsigned long __reloc_offset;
> +static inline unsigned long kaslr_offset(void)
> +{
> +       return __reloc_offset;
I doubt that we should return random_offset here.

Huacai
> +}
> +
>  #endif /* __SETUP_H */
> diff --git a/arch/loongarch/kernel/relocate.c b/arch/loongarch/kernel/relocate.c
> index 6c3eff9af9fb..9ba560d514e1 100644
> --- a/arch/loongarch/kernel/relocate.c
> +++ b/arch/loongarch/kernel/relocate.c
> @@ -16,11 +16,9 @@
>  #include <asm/sections.h>
>  #include <asm/setup.h>
>
> -#define RELOCATED(x) ((void *)((long)x + reloc_offset))
> +#define RELOCATED(x) ((void *)((long)x + __reloc_offset))
>  #define RELOCATED_KASLR(x) ((void *)((long)x + random_offset))
>
> -static unsigned long reloc_offset;
> -
>  static inline void __init relocate_relative(void)
>  {
>         Elf64_Rela *rela, *rela_end;
> @@ -154,7 +152,7 @@ static inline void __init update_reloc_offset(unsigned long *addr, long random_o
>  {
>         unsigned long *new_addr = (unsigned long *)RELOCATED_KASLR(addr);
>
> -       *new_addr = (unsigned long)reloc_offset;
> +       *new_addr = (unsigned long)__reloc_offset;
>  }
>
>  unsigned long __init relocate_kernel(void)
> @@ -173,7 +171,7 @@ unsigned long __init relocate_kernel(void)
>         if (relocation_addr_valid(location_new))
>                 random_offset = (unsigned long)location_new - (unsigned long)(_text);
>  #endif
> -       reloc_offset = (unsigned long)_text - VMLINUX_LOAD_ADDRESS;
> +       __reloc_offset = (unsigned long)_text - VMLINUX_LOAD_ADDRESS;
>
>         if (random_offset) {
>                 kernel_length = (long)(_end) - (long)(_text);
> @@ -187,15 +185,15 @@ unsigned long __init relocate_kernel(void)
>                         "dbar 0 \t\n"
>                         ::: "memory");
>
> -               reloc_offset += random_offset;
> +               __reloc_offset += random_offset;
>
>                 /* The current thread is now within the relocated kernel */
>                 __current_thread_info = RELOCATED_KASLR(__current_thread_info);
>
> -               update_reloc_offset(&reloc_offset, random_offset);
> +               update_reloc_offset(&__reloc_offset, random_offset);
>         }
>
> -       if (reloc_offset)
> +       if (__reloc_offset)
>                 relocate_relative();
>
>         relocate_absolute(random_offset);
> @@ -208,9 +206,9 @@ unsigned long __init relocate_kernel(void)
>   */
>  static void show_kernel_relocation(const char *level)
>  {
> -       if (reloc_offset > 0) {
> +       if (__reloc_offset > 0) {
>                 printk(level);
> -               pr_cont("Kernel relocated by 0x%lx\n", reloc_offset);
> +               pr_cont("Kernel relocated by 0x%lx\n", __reloc_offset);
>                 pr_cont(" .text @ 0x%px\n", _text);
>                 pr_cont(" .data @ 0x%px\n", _sdata);
>                 pr_cont(" .bss  @ 0x%px\n", __bss_start);
> diff --git a/arch/loongarch/kernel/setup.c b/arch/loongarch/kernel/setup.c
> index 95e6b579dfdd..d7bda711824f 100644
> --- a/arch/loongarch/kernel/setup.c
> +++ b/arch/loongarch/kernel/setup.c
> @@ -65,6 +65,9 @@ struct cpuinfo_loongarch cpu_data[NR_CPUS] __read_mostly;
>
>  EXPORT_SYMBOL(cpu_data);
>
> +unsigned long __reloc_offset __ro_after_init;
> +EXPORT_SYMBOL(__reloc_offset);
> +
>  struct loongson_board_info b_info;
>  static const char dmi_empty_string[] = "        ";
>
> --
> 2.39.3
>

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

* Re: [PATCH 2/2] LoongArch: Allow building with kcov coverage
  2023-07-04 12:53 ` [PATCH 2/2] LoongArch: Allow building with kcov coverage Feiyang Chen
@ 2023-07-09  3:55   ` Huacai Chen
  2023-09-10 15:51   ` Guenter Roeck
  1 sibling, 0 replies; 8+ messages in thread
From: Huacai Chen @ 2023-07-09  3:55 UTC (permalink / raw)
  To: Feiyang Chen
  Cc: dvyukov, andreyknvl, loongarch, kasan-dev, chris.chenfeiyang,
	loongson-kernel

Hi, Feiyang,

Please update Documentation/features/debug/kcov/arch-support.txt, thanks.

Huacai

On Tue, Jul 4, 2023 at 8:53 PM Feiyang Chen <chenfeiyang@loongson.cn> wrote:
>
> Add ARCH_HAS_KCOV to the LoongArch Kconfig. Also disable
> instrumentation of vdso.
>
> Signed-off-by: Feiyang Chen <chenfeiyang@loongson.cn>
> ---
>  arch/loongarch/Kconfig       | 1 +
>  arch/loongarch/vdso/Makefile | 2 ++
>  2 files changed, 3 insertions(+)
>
> diff --git a/arch/loongarch/Kconfig b/arch/loongarch/Kconfig
> index ed9a148cdcde..4c21a961ab88 100644
> --- a/arch/loongarch/Kconfig
> +++ b/arch/loongarch/Kconfig
> @@ -14,6 +14,7 @@ config LOONGARCH
>         select ARCH_HAS_ACPI_TABLE_UPGRADE      if ACPI
>         select ARCH_HAS_CPU_FINALIZE_INIT
>         select ARCH_HAS_FORTIFY_SOURCE
> +       select ARCH_HAS_KCOV
>         select ARCH_HAS_NMI_SAFE_THIS_CPU_OPS
>         select ARCH_HAS_PTE_SPECIAL
>         select ARCH_HAS_TICK_BROADCAST if GENERIC_CLOCKEVENTS_BROADCAST
> diff --git a/arch/loongarch/vdso/Makefile b/arch/loongarch/vdso/Makefile
> index 7bb794604af3..7dc87377688b 100644
> --- a/arch/loongarch/vdso/Makefile
> +++ b/arch/loongarch/vdso/Makefile
> @@ -5,6 +5,8 @@ ifdef CONFIG_KASAN
>  KASAN_SANITIZE := n
>  endif
>
> +KCOV_INSTRUMENT := n
> +
>  # Include the generic Makefile to check the built vdso.
>  include $(srctree)/lib/vdso/Makefile
>
> --
> 2.39.3
>

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

* Re: [PATCH 2/2] LoongArch: Allow building with kcov coverage
  2023-07-04 12:53 ` [PATCH 2/2] LoongArch: Allow building with kcov coverage Feiyang Chen
  2023-07-09  3:55   ` Huacai Chen
@ 2023-09-10 15:51   ` Guenter Roeck
  2023-09-10 16:07     ` Xi Ruoyao
  1 sibling, 1 reply; 8+ messages in thread
From: Guenter Roeck @ 2023-09-10 15:51 UTC (permalink / raw)
  To: Feiyang Chen
  Cc: chenhuacai, dvyukov, andreyknvl, loongarch, kasan-dev,
	chris.chenfeiyang, loongson-kernel

Hi,

On Tue, Jul 04, 2023 at 08:53:32PM +0800, Feiyang Chen wrote:
> Add ARCH_HAS_KCOV to the LoongArch Kconfig. Also disable
> instrumentation of vdso.
> 
> Signed-off-by: Feiyang Chen <chenfeiyang@loongson.cn>

When trying to build loongarch:allmodconfig, this patch results in

Error log:
In file included from /opt/kernel/gcc-12.2.0-2.39-nolibc/loongarch64-linux-gnu/bin/../lib/gcc/loongarch64-linux-gnu/12.2.0/plugin/include/options.h:8,
                 from /opt/kernel/gcc-12.2.0-2.39-nolibc/loongarch64-linux-gnu/bin/../lib/gcc/loongarch64-linux-gnu/12.2.0/plugin/include/tm.h:46,
                 from /opt/kernel/gcc-12.2.0-2.39-nolibc/loongarch64-linux-gnu/bin/../lib/gcc/loongarch64-linux-gnu/12.2.0/plugin/include/backend.h:28,
                 from /opt/kernel/gcc-12.2.0-2.39-nolibc/loongarch64-linux-gnu/bin/../lib/gcc/loongarch64-linux-gnu/12.2.0/plugin/include/gcc-plugin.h:30,
                 from scripts/gcc-plugins/gcc-common.h:7,
                 from scripts/gcc-plugins/latent_entropy_plugin.c:78:
/opt/kernel/gcc-12.2.0-2.39-nolibc/loongarch64-linux-gnu/bin/../lib/gcc/loongarch64-linux-gnu/12.2.0/plugin/include/config/loongarch/loongarch-opts.h:31:10: fatal error: loongarch-def.h: No such file or directory
   31 | #include "loongarch-def.h"

for me. I tried with gcc 12.2 / binutils 2.39 and gcc 13.1 / binutils 2.40.

Reverting the patch or explicitly disabling CONFIG_GCC_PLUGINS fixes
the problem.

What compiler / binutils version combination is needed for this to work,
or, alternatively, how would I have to configure the compiler ?

Thanks,
Guenter

> ---
>  arch/loongarch/Kconfig       | 1 +
>  arch/loongarch/vdso/Makefile | 2 ++
>  2 files changed, 3 insertions(+)
> 
> diff --git a/arch/loongarch/Kconfig b/arch/loongarch/Kconfig
> index ed9a148cdcde..4c21a961ab88 100644
> --- a/arch/loongarch/Kconfig
> +++ b/arch/loongarch/Kconfig
> @@ -14,6 +14,7 @@ config LOONGARCH
>  	select ARCH_HAS_ACPI_TABLE_UPGRADE	if ACPI
>  	select ARCH_HAS_CPU_FINALIZE_INIT
>  	select ARCH_HAS_FORTIFY_SOURCE
> +	select ARCH_HAS_KCOV
>  	select ARCH_HAS_NMI_SAFE_THIS_CPU_OPS
>  	select ARCH_HAS_PTE_SPECIAL
>  	select ARCH_HAS_TICK_BROADCAST if GENERIC_CLOCKEVENTS_BROADCAST
> diff --git a/arch/loongarch/vdso/Makefile b/arch/loongarch/vdso/Makefile
> index 7bb794604af3..7dc87377688b 100644
> --- a/arch/loongarch/vdso/Makefile
> +++ b/arch/loongarch/vdso/Makefile
> @@ -5,6 +5,8 @@ ifdef CONFIG_KASAN
>  KASAN_SANITIZE := n
>  endif
>  
> +KCOV_INSTRUMENT := n
> +
>  # Include the generic Makefile to check the built vdso.
>  include $(srctree)/lib/vdso/Makefile
>  
> -- 
> 2.39.3
> 

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

* Re: [PATCH 2/2] LoongArch: Allow building with kcov coverage
  2023-09-10 15:51   ` Guenter Roeck
@ 2023-09-10 16:07     ` Xi Ruoyao
  2023-09-10 16:46       ` Guenter Roeck
  0 siblings, 1 reply; 8+ messages in thread
From: Xi Ruoyao @ 2023-09-10 16:07 UTC (permalink / raw)
  To: Guenter Roeck, Feiyang Chen
  Cc: chenhuacai, dvyukov, andreyknvl, loongarch, kasan-dev,
	chris.chenfeiyang, loongson-kernel

On Sun, 2023-09-10 at 08:51 -0700, Guenter Roeck wrote:
> Hi,
> 
> On Tue, Jul 04, 2023 at 08:53:32PM +0800, Feiyang Chen wrote:
> > Add ARCH_HAS_KCOV to the LoongArch Kconfig. Also disable
> > instrumentation of vdso.
> > 
> > Signed-off-by: Feiyang Chen <chenfeiyang@loongson.cn>
> 
> When trying to build loongarch:allmodconfig, this patch results in
> 
> Error log:
> In file included from /opt/kernel/gcc-12.2.0-2.39-nolibc/loongarch64-linux-gnu/bin/../lib/gcc/loongarch64-linux-gnu/12.2.0/plugin/include/options.h:8,
>                  from /opt/kernel/gcc-12.2.0-2.39-nolibc/loongarch64-linux-gnu/bin/../lib/gcc/loongarch64-linux-gnu/12.2.0/plugin/include/tm.h:46,
>                  from /opt/kernel/gcc-12.2.0-2.39-nolibc/loongarch64-linux-gnu/bin/../lib/gcc/loongarch64-linux-gnu/12.2.0/plugin/include/backend.h:28,
>                  from /opt/kernel/gcc-12.2.0-2.39-nolibc/loongarch64-linux-gnu/bin/../lib/gcc/loongarch64-linux-gnu/12.2.0/plugin/include/gcc-plugin.h:30,
>                  from scripts/gcc-plugins/gcc-common.h:7,
>                  from scripts/gcc-plugins/latent_entropy_plugin.c:78:
> /opt/kernel/gcc-12.2.0-2.39-nolibc/loongarch64-linux-gnu/bin/../lib/gcc/loongarch64-linux-gnu/12.2.0/plugin/include/config/loongarch/loongarch-opts.h:31:10: fatal error: loongarch-def.h: No such file or directory
>    31 | #include "loongarch-def.h"

> for me. I tried with gcc 12.2 / binutils 2.39 and gcc 13.1 / binutils 2.40.

> Reverting the patch or explicitly disabling CONFIG_GCC_PLUGINS fixes
> the problem.
> 
> What compiler / binutils version combination is needed for this to work,
> or, alternatively, how would I have to configure the compiler ?

Hi Guenter,

This is a GCC bug.  It's fixed in GCC trunk and the fix has been
backported to 12/13 release branches, so GCC 14.1, 13.3, and 12.4 will
contain the fix.

The fix is available at https://gcc.gnu.org/r14-3331, you can apply the
patch building the compiler.

Sorry for the inconvenience.

-- 
Xi Ruoyao <xry111@xry111.site>
School of Aerospace Science and Technology, Xidian University

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

* Re: [PATCH 2/2] LoongArch: Allow building with kcov coverage
  2023-09-10 16:07     ` Xi Ruoyao
@ 2023-09-10 16:46       ` Guenter Roeck
  0 siblings, 0 replies; 8+ messages in thread
From: Guenter Roeck @ 2023-09-10 16:46 UTC (permalink / raw)
  To: Xi Ruoyao, Feiyang Chen
  Cc: chenhuacai, dvyukov, andreyknvl, loongarch, kasan-dev,
	chris.chenfeiyang, loongson-kernel

On 9/10/23 09:07, Xi Ruoyao wrote:
> On Sun, 2023-09-10 at 08:51 -0700, Guenter Roeck wrote:
>> Hi,
>>
>> On Tue, Jul 04, 2023 at 08:53:32PM +0800, Feiyang Chen wrote:
>>> Add ARCH_HAS_KCOV to the LoongArch Kconfig. Also disable
>>> instrumentation of vdso.
>>>
>>> Signed-off-by: Feiyang Chen <chenfeiyang@loongson.cn>
>>
>> When trying to build loongarch:allmodconfig, this patch results in
>>
>> Error log:
>> In file included from /opt/kernel/gcc-12.2.0-2.39-nolibc/loongarch64-linux-gnu/bin/../lib/gcc/loongarch64-linux-gnu/12.2.0/plugin/include/options.h:8,
>>                   from /opt/kernel/gcc-12.2.0-2.39-nolibc/loongarch64-linux-gnu/bin/../lib/gcc/loongarch64-linux-gnu/12.2.0/plugin/include/tm.h:46,
>>                   from /opt/kernel/gcc-12.2.0-2.39-nolibc/loongarch64-linux-gnu/bin/../lib/gcc/loongarch64-linux-gnu/12.2.0/plugin/include/backend.h:28,
>>                   from /opt/kernel/gcc-12.2.0-2.39-nolibc/loongarch64-linux-gnu/bin/../lib/gcc/loongarch64-linux-gnu/12.2.0/plugin/include/gcc-plugin.h:30,
>>                   from scripts/gcc-plugins/gcc-common.h:7,
>>                   from scripts/gcc-plugins/latent_entropy_plugin.c:78:
>> /opt/kernel/gcc-12.2.0-2.39-nolibc/loongarch64-linux-gnu/bin/../lib/gcc/loongarch64-linux-gnu/12.2.0/plugin/include/config/loongarch/loongarch-opts.h:31:10: fatal error: loongarch-def.h: No such file or directory
>>     31 | #include "loongarch-def.h"
> 
>> for me. I tried with gcc 12.2 / binutils 2.39 and gcc 13.1 / binutils 2.40.
> 
>> Reverting the patch or explicitly disabling CONFIG_GCC_PLUGINS fixes
>> the problem.
>>
>> What compiler / binutils version combination is needed for this to work,
>> or, alternatively, how would I have to configure the compiler ?
> 
> Hi Guenter,
> 
> This is a GCC bug.  It's fixed in GCC trunk and the fix has been
> backported to 12/13 release branches, so GCC 14.1, 13.3, and 12.4 will
> contain the fix.
> 
> The fix is available at https://gcc.gnu.org/r14-3331, you can apply the
> patch building the compiler.
> 
> Sorry for the inconvenience.
> 

Thanks for the information. I'll add a note to my builders and just disable
gcc plugins for now until the new compiler versions are available.

Guenter


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

end of thread, other threads:[~2023-09-10 16:46 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-07-04 12:53 [PATCH 0/2] LoongArch: Allow building with kcov Feiyang Chen
2023-07-04 12:53 ` [PATCH 1/2] LoongArch: relocatable: Provide kaslr_offset() to get the kernel offset Feiyang Chen
2023-07-09  3:50   ` Huacai Chen
2023-07-04 12:53 ` [PATCH 2/2] LoongArch: Allow building with kcov coverage Feiyang Chen
2023-07-09  3:55   ` Huacai Chen
2023-09-10 15:51   ` Guenter Roeck
2023-09-10 16:07     ` Xi Ruoyao
2023-09-10 16:46       ` Guenter Roeck

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox