All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] tools/perf: Fix compiling with libelf on rv32
@ 2024-04-15  9:55 ` cp0613
  0 siblings, 0 replies; 6+ messages in thread
From: cp0613 @ 2024-04-15  9:55 UTC (permalink / raw)
  To: palmer, paul.walmsley, aou
  Cc: linux-perf-users, linux-kernel, linux-riscv, Chen Pei

From: Chen Pei <cp0613@linux.alibaba.com>

When cross-compiling perf with libelf, the following error occurred:

	In file included from tests/genelf.c:14:
	tests/../util/genelf.h:50:2: error: #error "unsupported architecture"
	50 | #error "unsupported architecture"
		|  ^~~~~
	tests/../util/genelf.h:59:5: warning: "GEN_ELF_CLASS" is not defined, evaluates to 0 [-Wundef]
	59 | #if GEN_ELF_CLASS == ELFCLASS64

Fix this by adding GEN-ELF-ARCH and GEN-ELF-CLASS definitions for rv32.

Signed-off-by: Chen Pei <cp0613@linux.alibaba.com>
---
 tools/perf/util/genelf.h | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/tools/perf/util/genelf.h b/tools/perf/util/genelf.h
index 5f18d20ea903..4e2e4f40e134 100644
--- a/tools/perf/util/genelf.h
+++ b/tools/perf/util/genelf.h
@@ -43,6 +43,9 @@ int jit_add_debug_info(Elf *e, uint64_t code_addr, void *debug, int nr_debug_ent
 #elif defined(__riscv) && __riscv_xlen == 64
 #define GEN_ELF_ARCH	EM_RISCV
 #define GEN_ELF_CLASS	ELFCLASS64
+#elif defined(__riscv) && __riscv_xlen == 32
+#define GEN_ELF_ARCH	EM_RISCV
+#define GEN_ELF_CLASS	ELFCLASS32
 #elif defined(__loongarch__)
 #define GEN_ELF_ARCH	EM_LOONGARCH
 #define GEN_ELF_CLASS	ELFCLASS64
-- 
2.25.1


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

* [PATCH] tools/perf: Fix compiling with libelf on rv32
@ 2024-04-15  9:55 ` cp0613
  0 siblings, 0 replies; 6+ messages in thread
From: cp0613 @ 2024-04-15  9:55 UTC (permalink / raw)
  To: palmer, paul.walmsley, aou
  Cc: linux-perf-users, linux-kernel, linux-riscv, Chen Pei

From: Chen Pei <cp0613@linux.alibaba.com>

When cross-compiling perf with libelf, the following error occurred:

	In file included from tests/genelf.c:14:
	tests/../util/genelf.h:50:2: error: #error "unsupported architecture"
	50 | #error "unsupported architecture"
		|  ^~~~~
	tests/../util/genelf.h:59:5: warning: "GEN_ELF_CLASS" is not defined, evaluates to 0 [-Wundef]
	59 | #if GEN_ELF_CLASS == ELFCLASS64

Fix this by adding GEN-ELF-ARCH and GEN-ELF-CLASS definitions for rv32.

Signed-off-by: Chen Pei <cp0613@linux.alibaba.com>
---
 tools/perf/util/genelf.h | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/tools/perf/util/genelf.h b/tools/perf/util/genelf.h
index 5f18d20ea903..4e2e4f40e134 100644
--- a/tools/perf/util/genelf.h
+++ b/tools/perf/util/genelf.h
@@ -43,6 +43,9 @@ int jit_add_debug_info(Elf *e, uint64_t code_addr, void *debug, int nr_debug_ent
 #elif defined(__riscv) && __riscv_xlen == 64
 #define GEN_ELF_ARCH	EM_RISCV
 #define GEN_ELF_CLASS	ELFCLASS64
+#elif defined(__riscv) && __riscv_xlen == 32
+#define GEN_ELF_ARCH	EM_RISCV
+#define GEN_ELF_CLASS	ELFCLASS32
 #elif defined(__loongarch__)
 #define GEN_ELF_ARCH	EM_LOONGARCH
 #define GEN_ELF_CLASS	ELFCLASS64
-- 
2.25.1


_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

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

* Re: [PATCH] tools/perf: Fix compiling with libelf on rv32
  2024-04-15  9:55 ` cp0613
@ 2024-04-16 15:04   ` Ian Rogers
  -1 siblings, 0 replies; 6+ messages in thread
From: Ian Rogers @ 2024-04-16 15:04 UTC (permalink / raw)
  To: cp0613
  Cc: palmer, paul.walmsley, aou, linux-perf-users, linux-kernel, linux-riscv

On Mon, Apr 15, 2024 at 2:57 AM <cp0613@linux.alibaba.com> wrote:
>
> From: Chen Pei <cp0613@linux.alibaba.com>
>
> When cross-compiling perf with libelf, the following error occurred:
>
>         In file included from tests/genelf.c:14:
>         tests/../util/genelf.h:50:2: error: #error "unsupported architecture"
>         50 | #error "unsupported architecture"
>                 |  ^~~~~
>         tests/../util/genelf.h:59:5: warning: "GEN_ELF_CLASS" is not defined, evaluates to 0 [-Wundef]
>         59 | #if GEN_ELF_CLASS == ELFCLASS64
>
> Fix this by adding GEN-ELF-ARCH and GEN-ELF-CLASS definitions for rv32.
>
> Signed-off-by: Chen Pei <cp0613@linux.alibaba.com>

Reviewed-by: Ian Rogers <irogers@google.com>

Thanks,
Ian

> ---
>  tools/perf/util/genelf.h | 3 +++
>  1 file changed, 3 insertions(+)
>
> diff --git a/tools/perf/util/genelf.h b/tools/perf/util/genelf.h
> index 5f18d20ea903..4e2e4f40e134 100644
> --- a/tools/perf/util/genelf.h
> +++ b/tools/perf/util/genelf.h
> @@ -43,6 +43,9 @@ int jit_add_debug_info(Elf *e, uint64_t code_addr, void *debug, int nr_debug_ent
>  #elif defined(__riscv) && __riscv_xlen == 64
>  #define GEN_ELF_ARCH   EM_RISCV
>  #define GEN_ELF_CLASS  ELFCLASS64
> +#elif defined(__riscv) && __riscv_xlen == 32
> +#define GEN_ELF_ARCH   EM_RISCV
> +#define GEN_ELF_CLASS  ELFCLASS32
>  #elif defined(__loongarch__)
>  #define GEN_ELF_ARCH   EM_LOONGARCH
>  #define GEN_ELF_CLASS  ELFCLASS64
> --
> 2.25.1
>
>

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

* Re: [PATCH] tools/perf: Fix compiling with libelf on rv32
@ 2024-04-16 15:04   ` Ian Rogers
  0 siblings, 0 replies; 6+ messages in thread
From: Ian Rogers @ 2024-04-16 15:04 UTC (permalink / raw)
  To: cp0613
  Cc: palmer, paul.walmsley, aou, linux-perf-users, linux-kernel, linux-riscv

On Mon, Apr 15, 2024 at 2:57 AM <cp0613@linux.alibaba.com> wrote:
>
> From: Chen Pei <cp0613@linux.alibaba.com>
>
> When cross-compiling perf with libelf, the following error occurred:
>
>         In file included from tests/genelf.c:14:
>         tests/../util/genelf.h:50:2: error: #error "unsupported architecture"
>         50 | #error "unsupported architecture"
>                 |  ^~~~~
>         tests/../util/genelf.h:59:5: warning: "GEN_ELF_CLASS" is not defined, evaluates to 0 [-Wundef]
>         59 | #if GEN_ELF_CLASS == ELFCLASS64
>
> Fix this by adding GEN-ELF-ARCH and GEN-ELF-CLASS definitions for rv32.
>
> Signed-off-by: Chen Pei <cp0613@linux.alibaba.com>

Reviewed-by: Ian Rogers <irogers@google.com>

Thanks,
Ian

> ---
>  tools/perf/util/genelf.h | 3 +++
>  1 file changed, 3 insertions(+)
>
> diff --git a/tools/perf/util/genelf.h b/tools/perf/util/genelf.h
> index 5f18d20ea903..4e2e4f40e134 100644
> --- a/tools/perf/util/genelf.h
> +++ b/tools/perf/util/genelf.h
> @@ -43,6 +43,9 @@ int jit_add_debug_info(Elf *e, uint64_t code_addr, void *debug, int nr_debug_ent
>  #elif defined(__riscv) && __riscv_xlen == 64
>  #define GEN_ELF_ARCH   EM_RISCV
>  #define GEN_ELF_CLASS  ELFCLASS64
> +#elif defined(__riscv) && __riscv_xlen == 32
> +#define GEN_ELF_ARCH   EM_RISCV
> +#define GEN_ELF_CLASS  ELFCLASS32
>  #elif defined(__loongarch__)
>  #define GEN_ELF_ARCH   EM_LOONGARCH
>  #define GEN_ELF_CLASS  ELFCLASS64
> --
> 2.25.1
>
>

_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

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

* Re: [PATCH] tools/perf: Fix compiling with libelf on rv32
  2024-04-16 15:04   ` Ian Rogers
@ 2024-04-17 15:59     ` Arnaldo Carvalho de Melo
  -1 siblings, 0 replies; 6+ messages in thread
From: Arnaldo Carvalho de Melo @ 2024-04-17 15:59 UTC (permalink / raw)
  To: Ian Rogers
  Cc: cp0613, palmer, paul.walmsley, aou, linux-perf-users,
	linux-kernel, linux-riscv

On Tue, Apr 16, 2024 at 08:04:55AM -0700, Ian Rogers wrote:
> On Mon, Apr 15, 2024 at 2:57 AM <cp0613@linux.alibaba.com> wrote:
> >
> > From: Chen Pei <cp0613@linux.alibaba.com>
> >
> > When cross-compiling perf with libelf, the following error occurred:
> >
> >         In file included from tests/genelf.c:14:
> >         tests/../util/genelf.h:50:2: error: #error "unsupported architecture"
> >         50 | #error "unsupported architecture"
> >                 |  ^~~~~
> >         tests/../util/genelf.h:59:5: warning: "GEN_ELF_CLASS" is not defined, evaluates to 0 [-Wundef]
> >         59 | #if GEN_ELF_CLASS == ELFCLASS64
> >
> > Fix this by adding GEN-ELF-ARCH and GEN-ELF-CLASS definitions for rv32.
> >
> > Signed-off-by: Chen Pei <cp0613@linux.alibaba.com>
> 
> Reviewed-by: Ian Rogers <irogers@google.com>

Thanks, applied to perf-tools-next,

- Arnaldo

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

* Re: [PATCH] tools/perf: Fix compiling with libelf on rv32
@ 2024-04-17 15:59     ` Arnaldo Carvalho de Melo
  0 siblings, 0 replies; 6+ messages in thread
From: Arnaldo Carvalho de Melo @ 2024-04-17 15:59 UTC (permalink / raw)
  To: Ian Rogers
  Cc: cp0613, palmer, paul.walmsley, aou, linux-perf-users,
	linux-kernel, linux-riscv

On Tue, Apr 16, 2024 at 08:04:55AM -0700, Ian Rogers wrote:
> On Mon, Apr 15, 2024 at 2:57 AM <cp0613@linux.alibaba.com> wrote:
> >
> > From: Chen Pei <cp0613@linux.alibaba.com>
> >
> > When cross-compiling perf with libelf, the following error occurred:
> >
> >         In file included from tests/genelf.c:14:
> >         tests/../util/genelf.h:50:2: error: #error "unsupported architecture"
> >         50 | #error "unsupported architecture"
> >                 |  ^~~~~
> >         tests/../util/genelf.h:59:5: warning: "GEN_ELF_CLASS" is not defined, evaluates to 0 [-Wundef]
> >         59 | #if GEN_ELF_CLASS == ELFCLASS64
> >
> > Fix this by adding GEN-ELF-ARCH and GEN-ELF-CLASS definitions for rv32.
> >
> > Signed-off-by: Chen Pei <cp0613@linux.alibaba.com>
> 
> Reviewed-by: Ian Rogers <irogers@google.com>

Thanks, applied to perf-tools-next,

- Arnaldo

_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

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

end of thread, other threads:[~2024-04-17 15:59 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-04-15  9:55 [PATCH] tools/perf: Fix compiling with libelf on rv32 cp0613
2024-04-15  9:55 ` cp0613
2024-04-16 15:04 ` Ian Rogers
2024-04-16 15:04   ` Ian Rogers
2024-04-17 15:59   ` Arnaldo Carvalho de Melo
2024-04-17 15:59     ` Arnaldo Carvalho de Melo

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.