Re: [PATCH] scripts/sorttable: riscv: fix undelcred identifier 'EM_RISCV' error
From: Jisheng Zhang
Date: Wed Sep 15 2021 - 10:01:48 EST
On Mon, 13 Sep 2021 11:06:25 +0800
Miles Chen <miles.chen@xxxxxxxxxxxx> wrote:
> Fix the following build break by adding a conditional definition
> of EM_RISCV in order to allow cross-compilation on machines
> which do not have EM_RISCV definition in their host.
>
> build break log from [1]:
> scripts/sorttable.c:352:7: error: use of undeclared identifier 'EM_RISCV'
Looks strange I can't reproduce it. FWICT, this may be seen with some old
toolchains.
>
> [1] https://lore.kernel.org/lkml/e8965b25-f15b-c7b4-748c-d207dda9c8e8@xxxxxxxx/
>
> Cc: Jisheng Zhang <jszhang@xxxxxxxxxx>
> Reported-by: Stefan Wahren <stefan.wahren@xxxxxxxx>
> Fixes: 54fed35fd393 ("riscv: Enable BUILDTIME_TABLE_SORT")
> Signed-off-by: Miles Chen <miles.chen@xxxxxxxxxxxx>
Reviewed-by: Jisheng Zhang <jszhang@xxxxxxxxxx>
> ---
> scripts/sorttable.c | 4 ++++
> 1 file changed, 4 insertions(+)
>
> diff --git a/scripts/sorttable.c b/scripts/sorttable.c
> index f355869c65cd..6ee4fa882919 100644
> --- a/scripts/sorttable.c
> +++ b/scripts/sorttable.c
> @@ -54,6 +54,10 @@
> #define EM_ARCV2 195
> #endif
>
> +#ifndef EM_RISCV
> +#define EM_RISCV 243
> +#endif
> +
> static uint32_t (*r)(const uint32_t *);
> static uint16_t (*r2)(const uint16_t *);
> static uint64_t (*r8)(const uint64_t *);