summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWaldemar Brodkorb <wbx@openadk.org>2024-05-04 18:58:42 +0200
committerWaldemar Brodkorb <wbx@openadk.org>2024-05-04 18:59:21 +0200
commit5fa28f6a9631d6be707e99f04511dc1675eec491 (patch)
tree2120f815239d72e2bb56bed69059b29d7e0666e6
parent6f7be8c93a8ae1df7ff984d1025c043d31146fc6 (diff)
xtensa: preliminary support for upcoming FDPIC support in uClibc-ng
-rw-r--r--mk/vars.mk6
-rw-r--r--package/uclibc-ng-test/Makefile3
-rw-r--r--target/config/Config.in.abi14
-rw-r--r--target/config/Config.in.binfmt3
-rw-r--r--target/config/Config.in.binutils4
-rw-r--r--target/config/Config.in.compiler4
-rw-r--r--target/config/Config.in.cpu6
-rw-r--r--target/config/Config.in.libc1
-rw-r--r--target/linux/config/Config.in.xtensa23
-rw-r--r--target/xtensa/Makefile11
-rw-r--r--target/xtensa/kernel/qemu-xtensa3
-rw-r--r--target/xtensa/overlay/xtensa_dc233c_call0.tarbin0 -> 942080 bytes
-rw-r--r--target/xtensa/overlay/xtensa_dc233c_windowed.tar (renamed from target/xtensa/overlay/xtensa_dc233c.tar)bin808960 -> 808960 bytes
-rw-r--r--target/xtensa/uclibc-ng-nommu.config38
-rw-r--r--toolchain/binutils/Makefile5
-rw-r--r--toolchain/binutils/Makefile.inc7
-rw-r--r--toolchain/gcc/Makefile5
-rw-r--r--toolchain/gcc/Makefile.inc8
-rw-r--r--toolchain/linux-headers/Makefile5
19 files changed, 124 insertions, 22 deletions
diff --git a/mk/vars.mk b/mk/vars.mk
index 1585833c6..672f03d9f 100644
--- a/mk/vars.mk
+++ b/mk/vars.mk
@@ -311,6 +311,12 @@ TARGET_CXXFLAGS+= -marm
endif
endif
+ifeq ($(ADK_TARGET_BINFMT_FDPIC),y)
+TARGET_CFLAGS+= -mfdpic
+TARGET_CXXFLAGS+= -mfdpic
+TARGET_LDFLAGS+= -mfdpic
+endif
+
# host compiler and linker flags
HOST_CPPFLAGS:= -I$(STAGING_HOST_DIR)/usr/include
ifeq ($(OS_FOR_BUILD),Darwin)
diff --git a/package/uclibc-ng-test/Makefile b/package/uclibc-ng-test/Makefile
index 44a7e9cde..d05e57c91 100644
--- a/package/uclibc-ng-test/Makefile
+++ b/package/uclibc-ng-test/Makefile
@@ -47,9 +47,6 @@ endif
ifeq ($(ADK_TARGET_ARCH_KVX),y)
XAKE_FLAGS+= NO_TLS=1
endif
-ifeq ($(ADK_TARGET_WITH_MMU),)
-XAKE_FLAGS+= NO_NPTL=1
-endif
uclibc-ng-test-install:
${INSTALL_DIR} ${IDIR_UCLIBC_NG_TEST}/etc
diff --git a/target/config/Config.in.abi b/target/config/Config.in.abi
index 9995ba51d..db799f70e 100644
--- a/target/config/Config.in.abi
+++ b/target/config/Config.in.abi
@@ -3,6 +3,18 @@
choice
prompt "ABI"
+depends on ADK_TARGET_ARCH_XTENSA && ADK_TARGET_CPU_XTENSA_DC233C
+
+config ADK_TARGET_ABI_WINDOWED
+ bool "Windowed ABI"
+
+config ADK_TARGET_ABI_CALL0
+ bool "Call0 ABI"
+
+endchoice
+
+choice
+prompt "ABI"
depends on ADK_TARGET_ARCH_MIPS64
config ADK_TARGET_ABI_N32
@@ -62,6 +74,8 @@ config ADK_TARGET_ABI
default "x32" if ADK_TARGET_ABI_X32
default "eabihf" if ADK_TARGET_ARCH_ARM && ADK_TARGET_HARD_FLOAT
default "eabi" if ADK_TARGET_ARCH_ARM
+ default "windowed" if ADK_TARGET_ABI_WINDOWED
+ default "call0" if ADK_TARGET_ABI_CALL0
config ADK_TARGET_ABI_RISCV
depends on ADK_TARGET_ARCH_RISCV32 || ADK_TARGET_ARCH_RISCV64
diff --git a/target/config/Config.in.binfmt b/target/config/Config.in.binfmt
index 2c690724a..704ca073d 100644
--- a/target/config/Config.in.binfmt
+++ b/target/config/Config.in.binfmt
@@ -24,7 +24,8 @@ config ADK_TARGET_BINFMT_FLAT
config ADK_TARGET_BINFMT_FDPIC
bool "FDPIC"
select BUSYBOX_NOMMU
- depends on ADK_TARGET_ARCH_ARM || ADK_TARGET_ARCH_BFIN || ADK_TARGET_ARCH_FRV || ADK_TARGET_ARCH_SH
+ depends on ADK_TARGET_ARCH_ARM || ADK_TARGET_ARCH_BFIN || ADK_TARGET_ARCH_FRV || ADK_TARGET_ARCH_SH \
+ || ADK_TARGET_ARCH_XTENSA
depends on !ADK_TARGET_WITH_MMU
config ADK_TARGET_BINFMT_DSBT
diff --git a/target/config/Config.in.binutils b/target/config/Config.in.binutils
index b93eaf31d..3caf9a1d8 100644
--- a/target/config/Config.in.binutils
+++ b/target/config/Config.in.binutils
@@ -55,4 +55,8 @@ config ADK_TOOLCHAIN_BINUTILS_KVX
bool "kvx-coolidge"
depends on ADK_TARGET_ARCH_KVX
+config ADK_TOOLCHAIN_BINUTILS_XTENSA
+ bool "xtensa-fdpic-abi-spec-1.1"
+ depends on ADK_TARGET_ARCH_XTENSA
+
endchoice
diff --git a/target/config/Config.in.compiler b/target/config/Config.in.compiler
index f5ca63b75..8d7b442b5 100644
--- a/target/config/Config.in.compiler
+++ b/target/config/Config.in.compiler
@@ -111,4 +111,8 @@ config ADK_TOOLCHAIN_GCC_KVX
bool "coolidge"
depends on ADK_TARGET_ARCH_KVX
+config ADK_TOOLCHAIN_GCC_XTENSA
+ bool "xtensa-fdpic-abi-spec-1.1"
+ depends on ADK_TARGET_ARCH_XTENSA
+
endchoice
diff --git a/target/config/Config.in.cpu b/target/config/Config.in.cpu
index c06eca95b..d7984a44e 100644
--- a/target/config/Config.in.cpu
+++ b/target/config/Config.in.cpu
@@ -1830,9 +1830,9 @@ config ADK_TARGET_CPU_XTENSA_DC233C
select ADK_TARGET_SUPPORTS_THREADS
select ADK_TARGET_SUPPORTS_NPTL
select ADK_TARGET_SUPPORTS_LT
- select ADK_TARGET_KERNEL_UIMAGE
- select ADK_LINUX_KERNEL_XTENSA_VARIANT_DC233C if ADK_TARGET_OS_LINUX
- select ADK_LINUX_KERNEL_INITIALIZE_XTENSA_MMU_INSIDE_VMLINUX if ADK_TARGET_OS_LINUX
+ select ADK_TARGET_KERNEL_IMAGE
+ select ADK_LINUX_KERNEL_XTENSA_VARIANT_DC233C if ADK_TARGET_WITH_MMU
+ select ADK_LINUX_KERNEL_INITIALIZE_XTENSA_MMU_INSIDE_VMLINUX if ADK_TARGET_WITH_MMU
depends on ADK_TARGET_ARCH_XTENSA
config ADK_TARGET_CPU_XTENSA_DC232B
diff --git a/target/config/Config.in.libc b/target/config/Config.in.libc
index c05475fb5..c4b287072 100644
--- a/target/config/Config.in.libc
+++ b/target/config/Config.in.libc
@@ -220,6 +220,7 @@ config ADK_TARGET_SUFFIX
default "gnux32" if ADK_TARGET_LIB_GLIBC && ADK_TARGET_ABI_X32 && ADK_LINUX_64
default "gnuspe" if ADK_TARGET_LIB_GLIBC && ADK_TARGET_ARCH_PPC && ADK_TARGET_ARCH_PPC_WITH_SPE
default "gnu" if ADK_TARGET_LIB_GLIBC
+ default "uclibcfdpic" if ADK_TARGET_LIB_UCLIBC_NG && ADK_TARGET_ARCH_XTENSA && ADK_TARGET_BINFMT_FDPIC
default "uclinuxfdpiceabi" if ADK_TARGET_LIB_UCLIBC_NG && ADK_TARGET_ARCH_ARM && ADK_TARGET_BINFMT_FDPIC
default "uclibceabihf" if ADK_TARGET_LIB_UCLIBC_NG && ADK_TARGET_ARCH_ARM && ADK_TARGET_HARD_FLOAT
default "uclibceabi" if ADK_TARGET_LIB_UCLIBC_NG && ADK_TARGET_ARCH_ARM
diff --git a/target/linux/config/Config.in.xtensa b/target/linux/config/Config.in.xtensa
index 7a9f12120..570900e0b 100644
--- a/target/linux/config/Config.in.xtensa
+++ b/target/linux/config/Config.in.xtensa
@@ -12,11 +12,34 @@ config ADK_LINUX_KERNEL_INITIALIZE_XTENSA_MMU_INSIDE_VMLINUX
config ADK_LINUX_KERNEL_XTENSA_VARIANT_CUSTOM
bool
+ default y if ADK_TARGET_BINFMT_FDPIC
+ default y if ADK_TARGET_BINFMT_FLAT
config ADK_LINUX_KERNEL_XTENSA_VARIANT_CUSTOM_NAME
string
+ default "dc233c" if ADK_TARGET_CPU_XTENSA_DC233C
+ default "dc232b" if ADK_TARGET_CPU_XTENSA_DC232B
default "de212" if ADK_TARGET_CPU_XTENSA_DE212
config ADK_LINUX_KERNEL_BUILTIN_DTB
string
default "kc705_nommu" if ADK_TARGET_CPU_XTENSA_DE212
+
+config ADK_LINUX_KERNEL_USER_ABI_CALL0_ONLY
+ bool
+ default y if ADK_TARGET_ABI_CALL0
+
+config ADK_LINUX_KERNEL_MEMMAP_CACHEATTR
+ hex
+ default "0x2cccccc7"
+ depends on !ADK_TARGET_WITH_MMU
+
+config ADK_LINUX_KERNEL_KERNEL_LOAD_ADDRESS
+ hex
+ default "0x00003000"
+ depends on !ADK_TARGET_WITH_MMU
+
+config ADK_LINUX_KERNEL_DEFAULT_MEM_START
+ hex
+ default "0x00000000"
+ depends on !ADK_TARGET_WITH_MMU
diff --git a/target/xtensa/Makefile b/target/xtensa/Makefile
index 457783bfc..9e9e90b49 100644
--- a/target/xtensa/Makefile
+++ b/target/xtensa/Makefile
@@ -5,24 +5,21 @@ include $(ADK_TOPDIR)/rules.mk
include $(ADK_TOPDIR)/mk/kernel-build.mk
include $(ADK_TOPDIR)/mk/image.mk
-ifeq ($(ADK_TARGET_CPU_XTENSA_DE212),y)
-KERNEL:=$(LINUX_DIR)/arch/xtensa/boot/Image.elf
-else
-KERNEL:=$(LINUX_DIR)/arch/xtensa/boot/uImage
-endif
-
QEMU_ARGS:=${ADK_QEMU_ARGS}
ifeq ($(ADK_TARGET_CPU_XTENSA_DC233C),y)
-QEMU_ARGS+=-M kc705
+QEMU_ARGS+=-M lx60
QEMU_ARGS+=-cpu dc233c
+KERNEL:=$(LINUX_DIR)/arch/xtensa/boot/Image.elf
endif
ifeq ($(ADK_TARGET_CPU_XTENSA_DC232B),y)
QEMU_ARGS+=-M kc705
QEMU_ARGS+=-cpu dc232b
+KERNEL:=$(LINUX_DIR)/arch/xtensa/boot/uImage
endif
ifeq ($(ADK_TARGET_CPU_XTENSA_DE212),y)
QEMU_ARGS+=-M kc705-nommu
QEMU_ARGS+=-cpu de212 -m 256
+KERNEL:=$(LINUX_DIR)/arch/xtensa/boot/Image.elf
endif
# target helper text
diff --git a/target/xtensa/kernel/qemu-xtensa b/target/xtensa/kernel/qemu-xtensa
index 8d6bac0b9..5f50e9f61 100644
--- a/target/xtensa/kernel/qemu-xtensa
+++ b/target/xtensa/kernel/qemu-xtensa
@@ -1,5 +1,6 @@
CONFIG_XTENSA=y
+CONFIG_XTENSA_UNALIGNED_USER=y
CONFIG_XTENSA_PLATFORM_XTFPGA=y
CONFIG_CMDLINE_BOOL=y
-CONFIG_CMDLINE="console=ttyS0,38400 memmap=128M@0"
+CONFIG_CMDLINE="earlycon=uart8250,mmio32,0xfd050020,115200n8 console=ttyS0,115200n8 memmap=0x04000000@0"
CONFIG_SECTION_MISMATCH_WARN_ONLY=y
diff --git a/target/xtensa/overlay/xtensa_dc233c_call0.tar b/target/xtensa/overlay/xtensa_dc233c_call0.tar
new file mode 100644
index 000000000..c36f65cc4
--- /dev/null
+++ b/target/xtensa/overlay/xtensa_dc233c_call0.tar
Binary files differ
diff --git a/target/xtensa/overlay/xtensa_dc233c.tar b/target/xtensa/overlay/xtensa_dc233c_windowed.tar
index 56ccc5b31..56ccc5b31 100644
--- a/target/xtensa/overlay/xtensa_dc233c.tar
+++ b/target/xtensa/overlay/xtensa_dc233c_windowed.tar
Binary files differ
diff --git a/target/xtensa/uclibc-ng-nommu.config b/target/xtensa/uclibc-ng-nommu.config
index e9f9a7546..b2a2ae778 100644
--- a/target/xtensa/uclibc-ng-nommu.config
+++ b/target/xtensa/uclibc-ng-nommu.config
@@ -1,6 +1,6 @@
#
# Automatically generated file; DO NOT EDIT.
-# uClibc-ng 1.0.45 C Library Configuration
+# uClibc-ng 1.0.48 C Library Configuration
#
# TARGET_aarch64 is not set
# TARGET_alpha is not set
@@ -43,9 +43,9 @@ TARGET_ARCH_BITS=32
TARGET_ARCH="xtensa"
FORCE_OPTIONS_FOR_ARCH=y
TARGET_SUBARCH=""
-UCLIBC_FORMAT_FLAT=y
+UCLIBC_FORMAT_FDPIC_ELF=y
+# UCLIBC_FORMAT_FLAT is not set
# UCLIBC_FORMAT_FLAT_SEP_DATA is not set
-# UCLIBC_FORMAT_SHARED_FLAT is not set
ARCH_HAS_DEPRECATED_SYSCALLS=y
ARCH_ANY_ENDIAN=y
ARCH_LITTLE_ENDIAN=y
@@ -66,13 +66,31 @@ HAVE_DOT_CONFIG=y
# General Library Settings
#
DOPIC=y
-# STATIC_PIE is not set
-ARCH_HAS_NO_SHARED=y
-ARCH_HAS_NO_LDSO=y
ARCH_HAS_UCONTEXT=y
+HAVE_LDSO=y
+HAVE_SHARED=y
+# FORCE_SHAREABLE_TEXT_SEGMENTS is not set
+LDSO_LDD_SUPPORT=y
+LDSO_CACHE_SUPPORT=y
+LDSO_PRELOAD_ENV_SUPPORT=y
+# LDSO_PRELOAD_FILE_SUPPORT is not set
+LDSO_BASE_FILENAME="ld.so"
+# LDSO_STANDALONE_SUPPORT is not set
+# LDSO_PRELINK_SUPPORT is not set
+UCLIBC_STATIC_LDCONFIG=y
+LDSO_RUNPATH=y
+# LDSO_RUNPATH_OF_EXECUTABLE is not set
+LDSO_SAFE_RUNPATH=y
+LDSO_SEARCH_INTERP_PATH=y
+LDSO_LD_LIBRARY_PATH=y
UCLIBC_CTOR_DTOR=y
-HAS_NO_THREADS=y
+# LDSO_GNU_HASH_SUPPORT is not set
+# HAS_NO_THREADS is not set
# UCLIBC_HAS_LINUXTHREADS is not set
+UCLIBC_HAS_THREADS_NATIVE=y
+UCLIBC_HAS_THREADS=y
+UCLIBC_HAS_TLS=y
+# PTHREADS_DEBUG_SUPPORT is not set
PTHREADS_STACK_DEFAULT_SIZE=2097152
UCLIBC_HAS_SYSLOG=y
UCLIBC_HAS_LFS=y
@@ -151,6 +169,7 @@ UCLIBC_DNSRAND_MODE_PRNGPLUS=y
#
UCLIBC_HAS_STRING_GENERIC_OPT=y
UCLIBC_HAS_STRING_ARCH_OPT=y
+UCLIBC_HAS_STDIO_FUTEXES=y
UCLIBC_HAS_CTYPE_TABLES=y
UCLIBC_HAS_CTYPE_SIGNED=y
# UCLIBC_HAS_CTYPE_UNSAFE is not set
@@ -214,6 +233,8 @@ HARDWIRED_ABSPATH=y
# Security options
#
# UCLIBC_HAS_SSP is not set
+UCLIBC_BUILD_RELRO=y
+# UCLIBC_BUILD_NOW is not set
UCLIBC_BUILD_NOEXECSTACK=y
#
@@ -224,6 +245,9 @@ UCLIBC_EXTRA_CFLAGS=""
# DODEBUG is not set
# DOSTRIP is not set
# DOASSERTS is not set
+# SUPPORT_LD_DEBUG is not set
+# SUPPORT_LD_DEBUG_EARLY is not set
# UCLIBC_MALLOC_DEBUGGING is not set
+# UCLIBC_HAS_BACKTRACE is not set
WARNINGS="-Wall"
# EXTRA_WARNINGS is not set
diff --git a/toolchain/binutils/Makefile b/toolchain/binutils/Makefile
index 63b1080fb..5e2431165 100644
--- a/toolchain/binutils/Makefile
+++ b/toolchain/binutils/Makefile
@@ -44,8 +44,13 @@ endif
$(WRKBUILD)/.configured:
ifeq ($(ADK_TARGET_ARCH_XTENSA),y)
+ifeq ($(ADK_TARGET_ABI),)
tar xf $(ADK_TOPDIR)/target/xtensa/overlay/xtensa_$(ADK_TARGET_CPU_TYPE).tar \
--strip-components=1 -C $(WRKSRC) binutils
+else
+ tar xf $(ADK_TOPDIR)/target/xtensa/overlay/xtensa_$(ADK_TARGET_CPU_TYPE)_$(ADK_TARGET_ABI).tar \
+ --strip-components=1 -C $(WRKSRC) binutils
+endif
endif
(cd $(WRKBUILD); PATH='$(HOST_PATH)' \
MAKEINFO=true \
diff --git a/toolchain/binutils/Makefile.inc b/toolchain/binutils/Makefile.inc
index 758539cf0..15c945c2c 100644
--- a/toolchain/binutils/Makefile.inc
+++ b/toolchain/binutils/Makefile.inc
@@ -65,6 +65,13 @@ PKG_HASH:= 71d37c96451333c5c0b84b170169fdcb138bbb27397dc06281905d9717c8ed64
PKG_SITES:= ${MASTER_SITE_GNU:=binutils/}
DISTFILES:= ${PKG_NAME}-${PKG_VERSION}.tar.bz2
endif
+ifeq ($(ADK_TOOLCHAIN_BINUTILS_XTENSA),y)
+PKG_VERSION:= xtensa-fdpic-abi-spec-1.1
+PKG_GIT:= tag
+PKG_RELEASE:= 1
+PKG_SITES:= https://github.com/jcmvbkbc/binutils-gdb-xtensa.git
+DISTFILES:= ${PKG_NAME}-${PKG_VERSION}.tar.gz
+endif
ifeq ($(ADK_TOOLCHAIN_BINUTILS_GIT),y)
PKG_VERSION:= git
PKG_RELEASE:= 1
diff --git a/toolchain/gcc/Makefile b/toolchain/gcc/Makefile
index 175af8aae..2b2f7e03c 100644
--- a/toolchain/gcc/Makefile
+++ b/toolchain/gcc/Makefile
@@ -286,8 +286,13 @@ GCC_BUILD_DIR_FINAL:= $(WRKBUILD)-final
$(GCC_BUILD_DIR_INITIAL)/.configured:
ifeq ($(ADK_TARGET_ARCH_XTENSA),y)
+ifeq ($(ADK_TARGET_ABI),)
tar xf $(ADK_TOPDIR)/target/xtensa/overlay/xtensa_$(ADK_TARGET_CPU_TYPE).tar \
--strip-components=1 -C $(WRKSRC) gcc
+else
+ tar xf $(ADK_TOPDIR)/target/xtensa/overlay/xtensa_$(ADK_TARGET_CPU_TYPE)_$(ADK_TARGET_ABI).tar \
+ --strip-components=1 -C $(WRKSRC) gcc
+endif
endif
mkdir -p $(GCC_BUILD_DIR_INITIAL)
# these symlinks are very important, do not remove
diff --git a/toolchain/gcc/Makefile.inc b/toolchain/gcc/Makefile.inc
index b6c24865a..2b6132cd5 100644
--- a/toolchain/gcc/Makefile.inc
+++ b/toolchain/gcc/Makefile.inc
@@ -97,6 +97,14 @@ PKG_SITES:= https://github.com/kalray/gcc.git
PKG_RELEASE:= 1
DISTFILES:= ${PKG_NAME}-${PKG_VERSION}.tar.gz
endif
+ifeq ($(ADK_TOOLCHAIN_GCC_XTENSA),y)
+PKG_VERSION:= xtensa-fdpic-abi-spec-1.1
+PKG_GIT:= tag
+PKG_SITES:= https://github.com/jcmvbkbc/gcc-xtensa.git
+PKG_RELEASE:= 1
+DISTFILES:= ${PKG_NAME}-${PKG_VERSION}.tar.gz
+LIBSTDCXXVER:= 29
+endif
ifeq ($(ADK_TOOLCHAIN_GCC_GIT),y)
PKG_VERSION:= git
PKG_SITES:= https://github.com/gcc-mirror/gcc.git
diff --git a/toolchain/linux-headers/Makefile b/toolchain/linux-headers/Makefile
index 79fef22b9..6e9f913e9 100644
--- a/toolchain/linux-headers/Makefile
+++ b/toolchain/linux-headers/Makefile
@@ -21,8 +21,13 @@ ifeq ($(ADK_KERNEL_ROOT_NFS),y)
endif
endif
ifeq ($(ADK_TARGET_ARCH_XTENSA),y)
+ifeq ($(ADK_TARGET_ABI),)
tar xf $(ADK_TOPDIR)/target/xtensa/overlay/xtensa_$(ADK_TARGET_CPU_TYPE).tar \
--strip-components=1 -C $(WRKSRC) linux
+else
+ tar xf $(ADK_TOPDIR)/target/xtensa/overlay/xtensa_$(ADK_TARGET_CPU_TYPE)_$(ADK_TARGET_ABI).tar \
+ --strip-components=1 -C $(WRKSRC) linux
+endif
endif
ifneq ($(ADK_DISABLE_KERNEL_PATCHES),y)
$(TRACE) kernel-patch