1 // SPDX-License-Identifier: GPL-2.0 1 2 #include <stdio.h> 3 #include <stdlib.h> 4 #include <string.h> 5 #include <elf.h> 6 7 int 8 main(int argc, char **argv) 9 { 10 unsigned char ei[EI_NIDENT]; 11 12 if (fread(ei, 1, EI_NIDENT, stdin) != 13 fprintf(stderr, "Error: input 14 return 1; 15 } 16 if (memcmp(ei, ELFMAG, SELFMAG) != 0) 17 fprintf(stderr, "Error: not EL 18 return 1; 19 } 20 switch (ei[EI_CLASS]) { 21 case ELFCLASS32: 22 printf("#define KERNEL_ELFCLAS 23 break; 24 case ELFCLASS64: 25 printf("#define KERNEL_ELFCLAS 26 break; 27 default: 28 exit(1); 29 } 30 31 return 0; 32 } 33
Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.