summaryrefslogtreecommitdiff
path: root/scripts/mod/mk_elfconfig.c
diff options
context:
space:
mode:
authorMasahiro Yamada <masahiroy@kernel.org>2024-07-27 16:42:02 +0900
committerMasahiro Yamada <masahiroy@kernel.org>2024-09-01 20:33:32 +0900
commita660deb0f1f62214439640292cd7726f6ed8023d (patch)
treebc1fe9ba8a9be42934c5a65860c249150bab4855 /scripts/mod/mk_elfconfig.c
parent4f32f799a950c7fffa17971177be42c79d74b69f (diff)
modpost: detect endianness on run-time
Endianness is currently detected on compile-time, but we can defer this until run-time. This change avoids re-executing scripts/mod/mk_elfconfig even if modpost in the linux-headers package needs to be rebuilt for a foreign architecture. Signed-off-by: Masahiro Yamada <masahiroy@kernel.org> Reviewed-by: Nicolas Schier <nicolas@fjasle.eu>
Diffstat (limited to 'scripts/mod/mk_elfconfig.c')
-rw-r--r--scripts/mod/mk_elfconfig.c19
1 files changed, 0 insertions, 19 deletions
diff --git a/scripts/mod/mk_elfconfig.c b/scripts/mod/mk_elfconfig.c
index aca96b3aada0..e8cee4e4bc73 100644
--- a/scripts/mod/mk_elfconfig.c
+++ b/scripts/mod/mk_elfconfig.c
@@ -8,7 +8,6 @@ int
main(int argc, char **argv)
{
unsigned char ei[EI_NIDENT];
- union { short s; char c[2]; } endian_test;
if (fread(ei, 1, EI_NIDENT, stdin) != EI_NIDENT) {
fprintf(stderr, "Error: input truncated\n");
@@ -28,24 +27,6 @@ main(int argc, char **argv)
default:
exit(1);
}
- switch (ei[EI_DATA]) {
- case ELFDATA2LSB:
- printf("#define KERNEL_ELFDATA ELFDATA2LSB\n");
- break;
- case ELFDATA2MSB:
- printf("#define KERNEL_ELFDATA ELFDATA2MSB\n");
- break;
- default:
- exit(1);
- }
-
- endian_test.s = 0x0102;
- if (memcmp(endian_test.c, "\x01\x02", 2) == 0)
- printf("#define HOST_ELFDATA ELFDATA2MSB\n");
- else if (memcmp(endian_test.c, "\x02\x01", 2) == 0)
- printf("#define HOST_ELFDATA ELFDATA2LSB\n");
- else
- exit(1);
return 0;
}