From b932b653dd5979f9ae6dc5acac5461ec8b41fc0d Mon Sep 17 00:00:00 2001 From: Xiang Xiao Date: Mon, 1 Jun 2020 02:41:11 +0800 Subject: [PATCH] arch: Select 64bit elf base on the architecture characteristic Signed-off-by: Xiang Xiao Change-Id: I09eec5a76f255016a910cfec3b3f70cd7577525e --- arch/Kconfig | 1 + arch/risc-v/Kconfig | 1 + arch/sim/Kconfig | 1 + binfmt/Kconfig | 7 ------- boards/risc-v/k210/maix-bit/configs/elf/defconfig | 1 - boards/risc-v/k210/maix-bit/configs/module/defconfig | 1 - boards/risc-v/k210/maix-bit/configs/posix_spawn/defconfig | 1 - boards/sim/sim/sim/configs/module/defconfig | 1 - include/elf.h | 2 +- libs/libc/machine/Kconfig | 5 +++++ 10 files changed, 9 insertions(+), 12 deletions(-) diff --git a/arch/Kconfig b/arch/Kconfig index d157c4d663..eaebb89a78 100644 --- a/arch/Kconfig +++ b/arch/Kconfig @@ -84,6 +84,7 @@ config ARCH_X86 config ARCH_X86_64 bool "x86_64" + select LIBC_ARCH_ELF_64BIT if LIBC_ARCH_ELF ---help--- x86-64 architectures. diff --git a/arch/risc-v/Kconfig b/arch/risc-v/Kconfig index c7a4115be8..5b2367130c 100644 --- a/arch/risc-v/Kconfig +++ b/arch/risc-v/Kconfig @@ -58,6 +58,7 @@ config ARCH_RV32IM config ARCH_RV64GC bool default n + select LIBC_ARCH_ELF_64BIT if LIBC_ARCH_ELF config ARCH_FAMILY string diff --git a/arch/sim/Kconfig b/arch/sim/Kconfig index 6e8a72e492..6ffd1a1fd4 100644 --- a/arch/sim/Kconfig +++ b/arch/sim/Kconfig @@ -13,6 +13,7 @@ choice config HOST_X86_64 bool "x86_64" select ARCH_HAVE_STACKCHECK + select LIBC_ARCH_ELF_64BIT if LIBC_ARCH_ELF && !SIM_M32 config HOST_X86 bool "x86" diff --git a/binfmt/Kconfig b/binfmt/Kconfig index 300a137b09..15e878af37 100644 --- a/binfmt/Kconfig +++ b/binfmt/Kconfig @@ -10,13 +10,6 @@ config BINFMT_DISABLE By default, support for loadable binary formats is built. This logic may be suppressed be defining this setting. -config ELF_64BIT - bool "64bit ELF support" - default n - depends on (!BINFMT_DISABLE && ELF) || LIBC_MODLIB - ---help--- - This option is used to load 64bit ELF files - if !BINFMT_DISABLE config PATH_INITIAL diff --git a/boards/risc-v/k210/maix-bit/configs/elf/defconfig b/boards/risc-v/k210/maix-bit/configs/elf/defconfig index c313c2c7c8..813790817f 100644 --- a/boards/risc-v/k210/maix-bit/configs/elf/defconfig +++ b/boards/risc-v/k210/maix-bit/configs/elf/defconfig @@ -21,7 +21,6 @@ CONFIG_DEBUG_FULLOPT=y CONFIG_DEBUG_SYMBOLS=y CONFIG_DEV_ZERO=y CONFIG_ELF=y -CONFIG_ELF_64BIT=y CONFIG_ELF_ALIGN_LOG2=3 CONFIG_EXAMPLES_ELF=y CONFIG_FS_PROCFS=y diff --git a/boards/risc-v/k210/maix-bit/configs/module/defconfig b/boards/risc-v/k210/maix-bit/configs/module/defconfig index dc0f20a268..69f00591f8 100644 --- a/boards/risc-v/k210/maix-bit/configs/module/defconfig +++ b/boards/risc-v/k210/maix-bit/configs/module/defconfig @@ -21,7 +21,6 @@ CONFIG_DEBUG_FULLOPT=y CONFIG_DEBUG_SYMBOLS=y CONFIG_DEV_ZERO=y CONFIG_ELF=y -CONFIG_ELF_64BIT=y CONFIG_ELF_ALIGN_LOG2=3 CONFIG_EXAMPLES_MODULE=y CONFIG_FS_PROCFS=y diff --git a/boards/risc-v/k210/maix-bit/configs/posix_spawn/defconfig b/boards/risc-v/k210/maix-bit/configs/posix_spawn/defconfig index 974b668bd8..b72cf8a9bb 100644 --- a/boards/risc-v/k210/maix-bit/configs/posix_spawn/defconfig +++ b/boards/risc-v/k210/maix-bit/configs/posix_spawn/defconfig @@ -21,7 +21,6 @@ CONFIG_DEBUG_FULLOPT=y CONFIG_DEBUG_SYMBOLS=y CONFIG_DEV_ZERO=y CONFIG_ELF=y -CONFIG_ELF_64BIT=y CONFIG_EXAMPLES_POSIXSPAWN=y CONFIG_FS_PROCFS=y CONFIG_FS_ROMFS=y diff --git a/boards/sim/sim/sim/configs/module/defconfig b/boards/sim/sim/sim/configs/module/defconfig index 12fb776fe5..d1e0505a49 100644 --- a/boards/sim/sim/sim/configs/module/defconfig +++ b/boards/sim/sim/sim/configs/module/defconfig @@ -19,7 +19,6 @@ CONFIG_BUILTIN=y CONFIG_CLOCK_MONOTONIC=y CONFIG_DEV_LOOP=y CONFIG_DEV_ZERO=y -CONFIG_ELF_64BIT=y CONFIG_EXAMPLES_MODULE=y CONFIG_EXAMPLES_MODULE_DEVMINOR=4 CONFIG_EXAMPLES_MODULE_DEVPATH="/dev/ram4" diff --git a/include/elf.h b/include/elf.h index bff9a49477..8f599d7960 100644 --- a/include/elf.h +++ b/include/elf.h @@ -33,7 +33,7 @@ /* NOTE: elf64.h and elf32.h refer EI_NIDENT defined above */ -#ifdef CONFIG_ELF_64BIT +#ifdef CONFIG_LIBC_ARCH_ELF_64BIT # include #else # include diff --git a/libs/libc/machine/Kconfig b/libs/libc/machine/Kconfig index f0c34acf9a..e02f87e221 100644 --- a/libs/libc/machine/Kconfig +++ b/libs/libc/machine/Kconfig @@ -88,6 +88,11 @@ config LIBC_ARCH_ELF bool default n +config LIBC_ARCH_ELF_64BIT + bool + default n + depends on LIBC_ARCH_ELF + config LIBM_ARCH_CEIL bool default n