mirror of
https://github.com/apache/nuttx.git
synced 2026-08-02 12:49:00 +00:00
arch:use ARCH_64BIT to mark arch is support 64bit
Add ARCH_64BIT macro to indicate architectures with 64-bit support, improving portability and conditional compilation. Signed-off-by: anjiahao <anjiahao@xiaomi.com>
This commit is contained in:
parent
8a02ca5913
commit
b623c781c5
10 changed files with 21 additions and 19 deletions
10
arch/Kconfig
10
arch/Kconfig
|
|
@ -26,6 +26,7 @@ config ARCH_ARM
|
|||
config ARCH_ARM64
|
||||
bool "ARM64"
|
||||
select ALARM_ARCH
|
||||
select ARCH_64BIT
|
||||
select ARCH_HAVE_BACKTRACE
|
||||
select ARCH_HAVE_INTERRUPTSTACK
|
||||
select ARCH_HAVE_FORK if !BUILD_KERNEL
|
||||
|
|
@ -39,7 +40,6 @@ config ARCH_ARM64
|
|||
select ARCH_HAVE_THREAD_LOCAL
|
||||
select ARCH_HAVE_PERF_EVENTS
|
||||
select ONESHOT
|
||||
select LIBC_ARCH_ELF_64BIT if LIBC_ARCH_ELF
|
||||
select ONESHOT_COUNT
|
||||
---help---
|
||||
The ARM64 architectures
|
||||
|
|
@ -135,6 +135,7 @@ config ARCH_X86
|
|||
|
||||
config ARCH_X86_64
|
||||
bool "x86_64"
|
||||
select ARCH_64BIT
|
||||
select ARCH_HAVE_TCBINFO
|
||||
select ARCH_HAVE_FPU
|
||||
select ARCH_HAVE_DPFPU
|
||||
|
|
@ -144,7 +145,6 @@ config ARCH_X86_64
|
|||
select ARCH_HAVE_CUSTOMOPT
|
||||
select ARCH_HAVE_THREAD_LOCAL
|
||||
select PCI_LATE_DRIVERS_REGISTER if PCI
|
||||
select LIBC_ARCH_ELF_64BIT if LIBC_ARCH_ELF
|
||||
select ARCH_TOOLCHAIN_GNU
|
||||
select ARCH_HAVE_BACKTRACE
|
||||
select ARCH_HAVE_FORK if !BUILD_KERNEL
|
||||
|
|
@ -371,6 +371,12 @@ config ARCH_INSTRUMENT_ALL
|
|||
|
||||
comment "Architecture Options"
|
||||
|
||||
config ARCH_64BIT
|
||||
bool
|
||||
default n
|
||||
---help---
|
||||
Indicates that the current architecture is 64-bit.
|
||||
|
||||
config ARCH_NOINTC
|
||||
bool
|
||||
default n
|
||||
|
|
|
|||
|
|
@ -445,7 +445,7 @@ config ARCH_RV32
|
|||
config ARCH_RV64
|
||||
bool
|
||||
default n
|
||||
select LIBC_ARCH_ELF_64BIT if LIBC_ARCH_ELF && !ARCH_RV64ILP32
|
||||
select ARCH_64BIT if !ARCH_RV64ILP32
|
||||
|
||||
config ARCH_RV64ILP32
|
||||
bool
|
||||
|
|
|
|||
|
|
@ -46,7 +46,7 @@ set_property(
|
|||
PROPERTY NUTTX_ELF_MODULE_LINK_OPTIONS -r -e module_initialize -T
|
||||
${NUTTX_DIR}/libs/libc/elf/gnu-elf.ld)
|
||||
|
||||
if(CONFIG_LIBC_ARCH_ELF_64BIT)
|
||||
if(CONFIG_ARCH_64BIT)
|
||||
# For amd64: It seems macOS/x86_64 loads the program text around
|
||||
# 00000001_xxxxxxxx. The gcc default (-mcmodel=small) would produce
|
||||
# out-of-range 32-bit relocations. Even on Linux, NuttX modules are loaded
|
||||
|
|
|
|||
|
|
@ -12,8 +12,8 @@ choice
|
|||
|
||||
config HOST_X86_64
|
||||
bool "x86_64"
|
||||
select ARCH_64BIT if !SIM_M32
|
||||
select ARCH_HAVE_STACKCHECK
|
||||
select LIBC_ARCH_ELF_64BIT if LIBC_ARCH_ELF && !SIM_M32
|
||||
select ARCH_HAVE_MATH_H
|
||||
|
||||
config HOST_X86
|
||||
|
|
@ -26,6 +26,7 @@ config HOST_ARM
|
|||
|
||||
config HOST_ARM64
|
||||
bool "arm64"
|
||||
select ARCH_64BIT if !SIM_M32
|
||||
select ARCH_HAVE_STACKCHECK
|
||||
|
||||
endchoice # Host CPU Type
|
||||
|
|
|
|||
|
|
@ -252,7 +252,7 @@ CMODULEFLAGS = $(CFLAGS) -fvisibility=hidden
|
|||
|
||||
# -fno-pic to avoid GOT relocations
|
||||
CMODULEFLAGS += -fno-pic
|
||||
ifeq ($(CONFIG_LIBC_ARCH_ELF_64BIT),y)
|
||||
ifeq ($(CONFIG_ARCH_64BIT),y)
|
||||
# For amd64:
|
||||
# It seems macOS/x86_64 loads the program text around 00000001_xxxxxxxx.
|
||||
# The gcc default (-mcmodel=small) would produce out-of-range 32-bit
|
||||
|
|
@ -286,7 +286,7 @@ CXXELFFLAGS = $(CXXFLAGS) -fvisibility=hidden
|
|||
# -fno-pic to avoid GOT relocations
|
||||
CELFFLAGS += -fno-pic
|
||||
CXXELFFLAGS += -fno-pic
|
||||
ifeq ($(CONFIG_LIBC_ARCH_ELF_64BIT),y)
|
||||
ifeq ($(CONFIG_ARCH_64BIT),y)
|
||||
# See the comment on CMODULEFLAGS above.
|
||||
CELFFLAGS += -mcmodel=large
|
||||
CXXELFFLAGS += -mcmodel=large
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@
|
|||
|
||||
/* NOTE: elf64.h and elf32.h refer EI_NIDENT defined above */
|
||||
|
||||
#ifdef CONFIG_LIBC_ARCH_ELF_64BIT
|
||||
#ifdef CONFIG_ARCH_64BIT
|
||||
# include <elf64.h>
|
||||
#else
|
||||
# include <elf32.h>
|
||||
|
|
|
|||
|
|
@ -144,11 +144,6 @@ config LIBC_ARCH_ELF
|
|||
bool
|
||||
default n
|
||||
|
||||
config LIBC_ARCH_ELF_64BIT
|
||||
bool
|
||||
default n
|
||||
depends on LIBC_ARCH_ELF
|
||||
|
||||
config LIBC_PREVENT_STRING
|
||||
bool
|
||||
default n
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@
|
|||
|
||||
set(SRCS)
|
||||
|
||||
if(CONFIG_LIBC_ARCH_ELF_64BIT)
|
||||
if(CONFIG_LIBC_ARCH_ELF)
|
||||
list(APPEND SRCS arch_elf.c)
|
||||
endif()
|
||||
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@
|
|||
#
|
||||
############################################################################
|
||||
|
||||
ifeq ($(CONFIG_LIBC_ARCH_ELF_64BIT),y)
|
||||
ifeq ($(CONFIG_LIBC_ARCH_ELF),y)
|
||||
CSRCS += arch_elf.c
|
||||
endif
|
||||
|
||||
|
|
|
|||
|
|
@ -46,11 +46,11 @@
|
|||
|
||||
/* ELF32 and ELF64 definitions */
|
||||
|
||||
#ifdef CONFIG_LIBC_ARCH_ELF_64BIT
|
||||
#ifdef CONFIG_ARCH_64BIT
|
||||
# define ARCH_ELF_TYP_STR "64"
|
||||
#else /* !CONFIG_LIBC_ARCH_ELF_64BIT */
|
||||
#else /* !CONFIG_ARCH_64BIT */
|
||||
# define ARCH_ELF_TYP_STR "32"
|
||||
#endif /* CONFIG_LIBC_ARCH_ELF_64BIT */
|
||||
#endif /* CONFIG_ARCH_64BIT */
|
||||
|
||||
/****************************************************************************
|
||||
* Private Data Types
|
||||
|
|
@ -275,7 +275,7 @@ static uintptr_t _find_hi20(void *arch_data, uintptr_t hi20_rel)
|
|||
*
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef CONFIG_LIBC_ARCH_ELF_64BIT
|
||||
#ifdef CONFIG_ARCH_64BIT
|
||||
static inline bool _valid_hi20_imm(long imm_hi)
|
||||
{
|
||||
/* 32-bit sign extend imm_hi and compare with the original value */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue