From: Miles Chen <miles.chen@xxxxxxxxxxxx> Subject: scripts/sorttable: riscv: fix undeclared identifier 'EM_RISCV' error 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' [1] https://lore.kernel.org/lkml/e8965b25-f15b-c7b4-748c-d207dda9c8e8@xxxxxxxx/ EM_RISCV was added to <elf.h> in glibc 2.24 so builds on systems with glibc headers < 2.24 should show this error. [mkubecek@xxxxxxx: changelog addition] Link: https://lkml.kernel.org/r/20210913030625.4525-1-miles.chen@xxxxxxxxxxxx Fixes: 54fed35fd393 ("riscv: Enable BUILDTIME_TABLE_SORT") Signed-off-by: Miles Chen <miles.chen@xxxxxxxxxxxx> Reported-by: Stefan Wahren <stefan.wahren@xxxxxxxx> Tested-by: Stefan Wahren <stefan.wahren@xxxxxxxx> Reviewed-by: Jisheng Zhang <jszhang@xxxxxxxxxx> Cc: Michal Kubecek <mkubecek@xxxxxxx> Cc: Paul Walmsley <paul.walmsley@xxxxxxxxxx> Cc: Palmer Dabbelt <palmer@xxxxxxxxxxx> Cc: Albert Ou <aou@xxxxxxxxxxxxxxxxx> Cc: Markus Mayer <mmayer@xxxxxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- scripts/sorttable.c | 4 ++++ 1 file changed, 4 insertions(+) --- a/scripts/sorttable.c~scripts-sorttable-riscv-fix-undelcred-identifier-em_riscv-error +++ a/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 *); _