1 // SPDX-License-Identifier: GPL-2.0-only 1 2 /* 3 * 32-bit compatibility support for ELF format 4 * 5 * Copyright (C) 2007 Red Hat, Inc. All right 6 * 7 * Red Hat Author: Roland McGrath. 8 * 9 * This file is used in a 64-bit kernel that w 10 * asm/elf.h is responsible for defining the c 11 * used below, with definitions appropriate fo 12 * 13 * We use macros to rename the ABI types and m 14 * functions used in binfmt_elf.c to compat ve 15 */ 16 17 #include <linux/elfcore-compat.h> 18 #include <linux/time.h> 19 20 #define ELF_COMPAT 1 21 22 /* 23 * Rename the basic ELF layout types to refer 24 */ 25 #undef ELF_CLASS 26 #define ELF_CLASS ELFCLASS32 27 28 #undef elfhdr 29 #undef elf_phdr 30 #undef elf_shdr 31 #undef elf_note 32 #undef elf_addr_t 33 #undef ELF_GNU_PROPERTY_ALIGN 34 #define elfhdr elf32_hdr 35 #define elf_phdr elf32_phdr 36 #define elf_shdr elf32_shdr 37 #define elf_note elf32_note 38 #define elf_addr_t Elf32_Addr 39 #define ELF_GNU_PROPERTY_ALIGN ELF32_GNU_PROP 40 41 /* 42 * Some data types as stored in coredump. 43 */ 44 #define user_long_t compat_long_t 45 #define user_siginfo_t compat_siginfo 46 #define copy_siginfo_to_external copy_s 47 48 /* 49 * The machine-dependent core note format type 50 * which requires asm/elf.h to define compat_e 51 */ 52 #define elf_prstatus compat_elf_prstatus 53 #define elf_prstatus_common compat_elf_prs 54 #define elf_prpsinfo compat_elf_prpsinfo 55 56 #undef ns_to_kernel_old_timeval 57 #define ns_to_kernel_old_timeval ns_to_old_tim 58 59 /* 60 * To use this file, asm/elf.h must define com 61 * The other following macros can be defined i 62 * differ from the native ones, or omitted whe 63 */ 64 65 #undef elf_check_arch 66 #define elf_check_arch compat_elf_check_arch 67 68 #ifdef COMPAT_ELF_PLATFORM 69 #undef ELF_PLATFORM 70 #define ELF_PLATFORM COMPAT_ELF_PLA 71 #endif 72 73 #ifdef COMPAT_ELF_HWCAP 74 #undef ELF_HWCAP 75 #define ELF_HWCAP COMPAT_ELF_HWC 76 #endif 77 78 #ifdef COMPAT_ELF_HWCAP2 79 #undef ELF_HWCAP2 80 #define ELF_HWCAP2 COMPAT_ELF_HWC 81 #endif 82 83 #ifdef COMPAT_ARCH_DLINFO 84 #undef ARCH_DLINFO 85 #define ARCH_DLINFO COMPAT_ARCH_DL 86 #endif 87 88 #ifdef COMPAT_ELF_ET_DYN_BASE 89 #undef ELF_ET_DYN_BASE 90 #define ELF_ET_DYN_BASE COMPAT_ELF_ET_ 91 #endif 92 93 #ifdef COMPAT_ELF_PLAT_INIT 94 #undef ELF_PLAT_INIT 95 #define ELF_PLAT_INIT COMPAT_ELF_PLA 96 #endif 97 98 #ifdef COMPAT_SET_PERSONALITY 99 #undef SET_PERSONALITY 100 #define SET_PERSONALITY COMPAT_SET_PER 101 #endif 102 103 #ifdef compat_start_thread 104 #define COMPAT_START_THREAD(ex, regs, new_ip, 105 compat_start_thread(regs, new_ip, new_ 106 #endif 107 108 #ifdef COMPAT_START_THREAD 109 #undef START_THREAD 110 #define START_THREAD COMPAT_START_T 111 #endif 112 113 #ifdef compat_arch_setup_additional_pages 114 #define COMPAT_ARCH_SETUP_ADDITIONAL_PAGES(bpr 115 compat_arch_setup_additional_pages(bpr 116 #endif 117 118 #ifdef COMPAT_ARCH_SETUP_ADDITIONAL_PAGES 119 #undef ARCH_HAS_SETUP_ADDITIONAL_PAGES 120 #define ARCH_HAS_SETUP_ADDITIONAL_PAGES 1 121 #undef ARCH_SETUP_ADDITIONAL_PAGES 122 #define ARCH_SETUP_ADDITIONAL_PAGES COMPAT_ARC 123 #endif 124 125 #ifdef compat_elf_read_implies_exec 126 #undef elf_read_implies_exec 127 #define elf_read_implies_exec compat_elf_read_ 128 #endif 129 130 /* 131 * Rename a few of the symbols that binfmt_elf 132 * These are all local so the names don't real 133 * might make some debugging less confusing no 134 */ 135 #define elf_format compat_elf_for 136 #define init_elf_binfmt init_compat_el 137 #define exit_elf_binfmt exit_compat_el 138 #define binfmt_elf_test_cases compat_binfmt_ 139 #define binfmt_elf_test_suite compat_binfmt_ 140 141 /* 142 * We share all the actual code with the nativ 143 */ 144 #include "binfmt_elf.c" 145
Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.