Browse Source

add some fixes and inrastructure for arm nommu support

Waldemar Brodkorb 9 years ago
parent
commit
aa419b2a26

+ 8 - 3
mk/vars.mk

@@ -80,11 +80,14 @@ endif
 # target tools
 TARGET_CC:=		${TARGET_COMPILER_PREFIX}gcc
 
-# use a gcc wrapper for coldfire support
+# use a gcc wrapper for coldfire/arm uclinux support
 ifeq ($(ADK_TARGET_UCLINUX),y)
 ifeq ($(ADK_TARGET_ARCH_M68K),y)
 TARGET_CC:=		adk-uclinux-gcc
 endif
+ifeq ($(ADK_TARGET_ARCH_ARM),y)
+TARGET_CC:=		adk-uclinux-gcc
+endif
 endif
 
 TARGET_CXX:=		${TARGET_COMPILER_PREFIX}g++
@@ -105,8 +108,10 @@ TARGET_LDFLAGS:=	-L$(STAGING_TARGET_DIR)/lib -L$(STAGING_TARGET_DIR)/usr/lib \
 			-Wl,-rpath-link -Wl,${STAGING_TARGET_DIR}/usr/lib
 
 ifeq ($(ADK_TARGET_BINFMT_FLAT),y)
+ifeq ($(ADK_TARGET_BINFMT_FLAT_SEP_DATA),y)
 TARGET_CFLAGS+=		-msep-data
 TARGET_CXXFLAGS+=	-msep-data
+endif
 TARGET_LDFLAGS+=	-elf2flt
 endif
 
@@ -193,8 +198,8 @@ endif
 
 ifeq ($(ADK_TARGET_ARCH_ARM),y)
 ifeq ($(ADK_TARGET_ARCH_ARM_WITH_THUMB),y)
-TARGET_CFLAGS+=		-mthumb
-TARGET_CXXFLAGS+=	-mthumb
+TARGET_CFLAGS+=		-mthumb -Wa,-mimplicit-it=thumb
+TARGET_CXXFLAGS+=	-mthumb -Wa,-mimplicit-it=thumb
 else
 TARGET_CFLAGS+=		-marm
 TARGET_CXXFLAGS+=	-marm

+ 0 - 2
scripts/help2man

@@ -1,2 +0,0 @@
-#!/usr/bin/env bash
-exit 0

+ 30 - 1
target/config/Config.in.binfmt

@@ -3,26 +3,55 @@
 
 choice
 prompt "Binary Format"
-depends on ADK_TARGET_ARCH_M68K || ADK_TARGET_ARCH_BFIN || ADK_TARGET_ARCH_C6X
+depends on ADK_TARGET_ARCH_ARM || ADK_TARGET_ARCH_M68K || ADK_TARGET_ARCH_BFIN || ADK_TARGET_ARCH_C6X
 
 config ADK_TARGET_BINFMT_ELF
 	bool "ELF"
 	depends on !ADK_TARGET_ARCH_C6X
 	depends on !ADK_TARGET_ARCH_BFIN
+	depends on !ADK_TARGET_ARCH_ARM
 
 config ADK_TARGET_BINFMT_DSBT
 	bool "DSBT"
 	depends on ADK_TARGET_ARCH_C6X
 	depends on !ADK_TARGET_ARCH_BFIN
 	depends on !ADK_TARGET_ARCH_M68K
+	depends on !ADK_TARGET_ARCH_ARM
 
 config ADK_TARGET_BINFMT_FDPIC
 	bool "FDPIC"
 	depends on ADK_TARGET_ARCH_BFIN
 	depends on !ADK_TARGET_ARCH_C6X
+	depends on !ADK_TARGET_ARCH_ARM
 
 config ADK_TARGET_BINFMT_FLAT
 	bool "FLAT"
 	depends on !ADK_TARGET_ARCH_C6X
+	depends on ADK_TARGET_ARCH_ARM && ADK_TARGET_UCLINUX
+
+endchoice
+
+# Set up flat binary type
+choice
+prompt "FLAT Binary type"
+depends on ADK_TARGET_BINFMT_FLAT
+default ADK_TARGET_BINFMT_FLAT_ONE
+
+config ADK_TARGET_BINFMT_FLAT_ONE
+        bool "One memory region"
+        help
+          All segments are linked into one memory region.
+
+config ADK_TARGET_BINFMT_FLAT_SEP_DATA
+        bool "Separate data and code region"
+        help
+          Allow for the data and text segments to be separated and placed in
+          different regions of memory.
+
+config ADK_TARGET_BINFMT_FLAT_SHARED
+        bool "Shared binary"
+        select ADK_TARGET_BINFMT_SUPPORTS_SHARED
+        help
+          Allow to load and link indiviual FLAT binaries at run time.
 
 endchoice

+ 1 - 0
target/config/Config.in.kernel

@@ -36,6 +36,7 @@ config ADK_TARGET_KERNEL_MINICONFIG
 	default "qemu-microblaze-ml605" if ADK_TARGET_QEMU_MICROBLAZE_MODEL_ML605
 	default "qemu-aarch64" if ADK_TARGET_SYSTEM_QEMU_AARCH64
 	default "qemu-arm-versatilepb" if ADK_TARGET_QEMU_ARM_MODEL_VERSATILEPB
+	default "qemu-arm-stellaris-m3" if ADK_TARGET_QEMU_ARM_MODEL_STELLARIS_M3
 	default "qemu-arm-vexpress-a9" if ADK_TARGET_QEMU_ARM_MODEL_VEXPRESS_A9
 	default "qemu-arm-spitz" if ADK_TARGET_QEMU_ARM_MODEL_SPITZ
 	default "qemu-arm-terrier" if ADK_TARGET_QEMU_ARM_MODEL_TERRIER

+ 2 - 0
target/config/Config.in.libc.default

@@ -33,6 +33,8 @@ config ADK_LIBC_VERSION
 
 config ADK_TARGET_WITH_NPTL
 	boolean
+	default n if ADK_TARGET_LIB_UCLIBC_NG && ADK_TARGET_ARCH_ARM && ADK_TARGET_UCLINUX
+	default n if ADK_TARGET_LIB_UCLIBC && ADK_TARGET_ARCH_ARM && ADK_TARGET_UCLINUX
 	default n if ADK_TARGET_LIB_UCLIBC_NG && ADK_TARGET_ARCH_AVR32
 	default n if ADK_TARGET_LIB_UCLIBC && ADK_TARGET_ARCH_AVR32
 	default n if ADK_TARGET_LIB_UCLIBC_NG && ADK_TARGET_ARCH_CRIS

+ 1 - 1
toolchain/elf2flt/Makefile

@@ -6,7 +6,7 @@ include Makefile.inc
 include ../rules.mk
 include ${ADK_TOPDIR}/mk/buildhlp.mk
 
-BINUTILS_VERSION:=	git
+BINUTILS_VERSION:=	2.24
 
 $(WRKBUILD)/.headers:
 $(WRKBUILD)/.configured:

+ 2 - 2
toolchain/elf2flt/Makefile.inc

@@ -2,7 +2,7 @@
 # material, please see the LICENCE file in the top-level directory.
 
 PKG_NAME:=		elf2flt
-PKG_VERSION:=		20140814
+PKG_VERSION:=		20150129
 PKG_RELEASE:=		1
-PKG_HASH:=		c284abd28aaaa3e95dd6ab1d08a0cf5e8586bf2989f21e696f98eb71bfc64cdf
+PKG_HASH:=		b52b0d14f13af559c0b22578853a893cdc45025ea65779f9a8d759201e5409ed
 PKG_SITES:=		http://www.openadk.org/distfiles/

+ 8 - 0
toolchain/gcc/Makefile

@@ -284,10 +284,18 @@ endif
 		ln -sf libstdc++.so.6.0.$(LIBSTDCXXVER) libstdc++.so.6
 	# cleanup unneeded docs
 	rm -rf $(TOOLCHAIN_DIR)/usr/share
+ifeq ($(ADK_TARGET_ARCH_M68K),y)
 	# create gcc wrapper for uClinux/m68k
 	echo "#!/bin/sh" > $(TOOLCHAIN_DIR)/usr/bin/adk-uclinux-gcc
 	echo "exec ${GNU_TARGET_NAME}-gcc \"\$$@\" -specs $(ADK_TOPDIR)/toolchain/gcc/m68k-uclinux-gcc.specs" >> $(TOOLCHAIN_DIR)/usr/bin/adk-uclinux-gcc
 	chmod a+x $(TOOLCHAIN_DIR)/usr/bin/adk-uclinux-gcc
+endif
+ifeq ($(ADK_TARGET_ARCH_ARM),y)
+	# create gcc wrapper for uClinux/arm
+	echo "#!/bin/sh" > $(TOOLCHAIN_DIR)/usr/bin/adk-uclinux-gcc
+	echo "exec ${GNU_TARGET_NAME}-gcc \"\$$@\" -specs $(ADK_TOPDIR)/toolchain/gcc/arm-uclinux-gcc.specs" >> $(TOOLCHAIN_DIR)/usr/bin/adk-uclinux-gcc
+	chmod a+x $(TOOLCHAIN_DIR)/usr/bin/adk-uclinux-gcc
+endif
 	touch $@
 
 include ${ADK_TOPDIR}/mk/toolchain.mk

+ 153 - 0
toolchain/gcc/arm-uclinux-gcc.specs

@@ -0,0 +1,153 @@
+*asm:
+%{mbig-endian:-EB} %{mlittle-endian:-EL} %(asm_cpu_spec) %{mapcs-*:-mapcs-%*} %(subtarget_asm_float_spec) %{mthumb-interwork:-mthumb-interwork} %{mfloat-abi=*} %{mfpu=*} %(subtarget_extra_asm_spec)
+
+*asm_debug:
+%{!g0:%{gstabs*:--gstabs}%{!gstabs*:%{g*:--gdwarf2}}} %{fdebug-prefix-map=*:--debug-prefix-map %*}
+
+*asm_final:
+%{gsplit-dwarf: 
+       objcopy --extract-dwo 	 %{c:%{o*:%*}%{!o*:%b%O}}%{!c:%U%O} 	 %{c:%{o*:%:replace-extension(%{o*:%*} .dwo)}%{!o*:%b.dwo}}%{!c:%b.dwo} 
+       objcopy --strip-dwo 	 %{c:%{o*:%*}%{!o*:%b%O}}%{!c:%U%O}     }
+
+*asm_options:
+%{-target-help:%:print-asm-header()} %{v} %{w:-W} %{I*} %a %Y %{c:%W{o*}%{!o*:-o %w%b%O}}%{!c:-o %d%w%u%O}
+
+*invoke_as:
+%{!fwpa:   %{fcompare-debug=*|fdump-final-insns=*:%:compare-debug-dump-opt()}   %{!S:-o %|.s |
+ as %(asm_options) %m.s %A }  }
+
+*cpp:
+%(subtarget_cpp_spec)					%{mfloat-abi=soft:%{mfloat-abi=hard:						%e-mfloat-abi=soft and -mfloat-abi=hard may not be used together}} %{mbig-endian:%{mlittle-endian:							%e-mbig-endian and -mlittle-endian may not be used together}}
+
+*cpp_options:
+%(cpp_unique_options) %1 %{m*} %{std*&ansi&trigraphs} %{W*&pedantic*} %{w} %{f*} %{g*:%{!g0:%{g*} %{!fno-working-directory:-fworking-directory}}} %{O*} %{undef} %{save-temps*:-fpch-preprocess}
+
+*cpp_debug_options:
+%{d*}
+
+*cpp_unique_options:
+%{!Q:-quiet} %{nostdinc*} %{C} %{CC} %{v} %{I*&F*} %{P} %I %{MD:-MD %{!o:%b.d}%{o*:%.d%*}} %{MMD:-MMD %{!o:%b.d}%{o*:%.d%*}} %{M} %{MM} %{MF*} %{MG} %{MP} %{MQ*} %{MT*} %{!E:%{!M:%{!MM:%{!MT:%{!MQ:%{MD|MMD:%{o*:-MQ %*}}}}}}} %{remap} %{g3|ggdb3|gstabs3|gcoff3|gxcoff3|gvms3:-dD} %{!iplugindir*:%{fplugin*:%:find-plugindir()}} %{H} %C %{D*&U*&A*} %{i*} %Z %i %{fmudflap:-D_MUDFLAP -include mf-runtime.h} %{fmudflapth:-D_MUDFLAP -D_MUDFLAPTH -include mf-runtime.h} %{E|M|MM:%W{o*}}
+
+*trad_capable_cpp:
+cc1 -E %{traditional|traditional-cpp:-traditional-cpp}
+
+*cc1:
+%{profile:-p}
+
+*cc1_options:
+%{pg:%{fomit-frame-pointer:%e-pg and -fomit-frame-pointer are incompatible}} %{!iplugindir*:%{fplugin*:%:find-plugindir()}} %1 %{!Q:-quiet} %{!dumpbase:-dumpbase %B} %{d*} %{m*} %{aux-info*} %{fcompare-debug-second:%:compare-debug-auxbase-opt(%b)}  %{!fcompare-debug-second:%{c|S:%{o*:-auxbase-strip %*}%{!o*:-auxbase %b}}}%{!c:%{!S:-auxbase %b}}  %{g*} %{O*} %{W*&pedantic*} %{w} %{std*&ansi&trigraphs} %{v:-version} %{pg:-p} %{p} %{f*} %{undef} %{Qn:-fno-ident} %{Qy:} %{-help:--help} %{-target-help:--target-help} %{-version:--version} %{-help=*:--help=%*} %{!fsyntax-only:%{S:%W{o*}%{!o*:-o %b.s}}} %{fsyntax-only:-o %j} %{-param*} %{fmudflap|fmudflapth:-fno-builtin -fno-merge-constants} %{coverage:-fprofile-arcs -ftest-coverage}
+
+*cc1plus:
+
+
+*link_gcc_c_sequence:
+%{static:--start-group} %G %L %{static:--end-group}%{!static:%G}
+
+*link_ssp:
+%{fstack-protector:}
+
+*endfile:
+crtend%O%s crtn%O%s
+
+*link:
+%{mbig-endian:-EB} %{mlittle-endian:-EL} %{static:-Bstatic} %{shared:-shared} %{symbolic:-Bsymbolic} -X -m armelf_linux_eabi -elf2flt --pic-veneer --target2=abs %{mcpu=arm8|mcpu=arm810|mcpu=strongarm*|march=armv4|mcpu=fa526|mcpu=fa626:--fix-v4bx} %{mbig-endian:%{march=armv7-a|mcpu=cortex-a5           |mcpu=cortex-a7                                         |mcpu=cortex-a8|mcpu=cortex-a9|mcpu=cortex-a15          |mcpu=marvell-pj4					   |mcpu=generic-armv7-a                                   |march=armv7-m|mcpu=cortex-m3                           |march=armv7e-m|mcpu=cortex-m4                          |march=armv6-m|mcpu=cortex-m0                           |march=armv8-a					   :%{!r:--be8}}}
+
+*lib:
+%{pthread:-lpthread}    %{shared:-lc}    %{!shared:%{profile:-lc_p}%{!profile:-lc}}
+
+*mfwrap:
+ %{static: %{fmudflap|fmudflapth:  --wrap=malloc --wrap=free --wrap=calloc --wrap=realloc --wrap=mmap --wrap=mmap64 --wrap=munmap --wrap=alloca} %{fmudflapth: --wrap=pthread_create}} %{fmudflap|fmudflapth: --wrap=main}
+
+*mflib:
+%{fmudflap|fmudflapth: -export-dynamic}
+
+*link_gomp:
+
+
+*libgcc:
+-lgcc
+
+*startfile:
+crt1%O%s crti%O%s crtbegin%O%s
+
+*cross_compile:
+1
+
+*version:
+4.8.4
+
+*multilib:
+. ;
+
+*multilib_defaults:
+marm mlittle-endian mfloat-abi=soft mno-thumb-interwork fno-leading-underscore
+
+*multilib_extra:
+
+
+*multilib_matches:
+
+
+*multilib_exclusions:
+
+
+*multilib_options:
+
+
+*multilib_reuse:
+
+
+*linker:
+collect2
+
+*linker_plugin_file:
+
+
+*lto_wrapper:
+
+
+*lto_gcc:
+
+
+*link_libgcc:
+%D
+
+*md_exec_prefix:
+
+
+*md_startfile_prefix:
+
+
+*md_startfile_prefix_1:
+
+
+*startfile_prefix_spec:
+
+
+*sysroot_spec:
+--sysroot=%R
+
+*sysroot_suffix_spec:
+
+
+*sysroot_hdrs_suffix_spec:
+
+
+*self_spec:
+
+
+*subtarget_cpp_spec:
+%{posix:-D_POSIX_SOURCE} %{pthread:-D_REENTRANT}
+
+*asm_cpu_spec:
+ %{mcpu=generic-*:-march=%*;   :%{mcpu=*:-mcpu=%*} %{march=*:-march=%*}}
+
+*subtarget_extra_asm_spec:
+%{mabi=apcs-gnu|mabi=atpcs:-meabi=gnu;:-meabi=5} %{mcpu=arm8|mcpu=arm810|mcpu=strongarm*|march=armv4|mcpu=fa526|mcpu=fa626:--fix-v4bx}
+
+*subtarget_asm_float_spec:
+%{mapcs-float:-mfloat}
+
+*link_command:
+%{!fsyntax-only:%{!c:%{!M:%{!MM:%{!E:%{!S:    %(linker) %{fuse-linker-plugin:    %e-fuse-linker-plugin is not supported in this configuration}%{flto|flto=*:%<fcompare-debug*}     %{flto} %{flto=*} %l %{pie:-pie} %{fuse-ld=*:-fuse-ld=%*}    %X %{o*} %{e*} %{N} %{n} %{r}    %{s} %{t} %{u*} %{z} %{Z} %{!nostdlib:%{!nostartfiles:%S}}    %{static:} %{L*} %(mfwrap) %(link_libgcc) %{!nostdlib:%{!nodefaultlibs:%{fsanitize=address:}     %{fsanitize=thread:}}} %o    %{fopenmp|ftree-parallelize-loops=*:%:include(libgomp.spec)%(link_gomp)}    %{fgnu-tm:%:include(libitm.spec)%(link_itm)}    %(mflib)  %{fsplit-stack: --wrap=pthread_create}    %{fprofile-arcs|fprofile-generate*|coverage:-lgcov} %{!nostdlib:%{!nodefaultlibs:%{fsanitize=address:%{static-libasan:-Bstatic} -lasan %{static-libasan:-Bdynamic}    %{static:%ecannot specify -static with -fsanitize=address}    %{fsanitize=thread:%e-fsanitize=address is incompatible with -fsanitize=thread}}    %{fsanitize=thread:%{static-libtsan:-Bstatic} -ltsan %{static-libtsan:-Bdynamic}    %{!pie:%{!shared:%e-fsanitize=thread linking must be done with -pie or -shared}}}}}     %{!nostdlib:%{!nodefaultlibs:%(link_ssp) %(link_gcc_c_sequence)}}    %{!nostdlib:%{!nostartfiles:%E}} %{T*} }}}}}}
+

+ 15 - 0
toolchain/uclibc-ng/Makefile

@@ -36,6 +36,21 @@ endif
 ifeq ($(ADK_TARGET_UCLINUX),y)
 	$(SED) 's/.*\(ARCH_USE_MMU\).*/# \1 is not set/' ${WRKBUILD}/.config
 endif
+ifeq ($(ADK_TARGET_WITH_NPTL),y)
+	$(SED) 's/.*\(UCLIBC_HAS_THREADS_NATIVE\).*/\1=y/' ${WRKBUILD}/.config
+	$(SED) 's/.*\(UCLIBC_HAS_THREADS\).*/\1=y/' ${WRKBUILD}/.config
+	$(SED) 's/.*\(UCLIBC_HAS_TLS\).*/\1=y/' ${WRKBUILD}/.config
+	$(SED) 's/.*\(PTHREADS_DEBUG_SUPPORT\).*/\1=y/' ${WRKBUILD}/.config
+	$(SED) 's/.*\(LINUXTHREADS_OLD\).*/# \1 is not set/' ${WRKBUILD}/.config
+	$(SED) 's/.*\(LINUXTHREADS_NEW\).*/# \1 is not set/' ${WRKBUILD}/.config
+	$(SED) 's/.*\(HAS_NO_THREADS\).*/# \1 is not set/' ${WRKBUILD}/.config
+else
+	$(SED) 's/.*\(UCLIBC_HAS_THREADS_NATIVE\).*/# \1 is not set/' ${WRKBUILD}/.config
+	$(SED) 's/.*\(UCLIBC_HAS_TLS\).*/# \1 is not set/' ${WRKBUILD}/.config
+	$(SED) 's/.*\(LINUXTHREADS_OLD\).*/\1=y/' ${WRKBUILD}/.config
+	$(SED) 's/.*\(LINUXTHREADS_NEW\).*/# \1 is not set/' ${WRKBUILD}/.config
+	$(SED) 's/.*\(HAS_NO_THREADS\).*/# \1 is not set/' ${WRKBUILD}/.config
+endif	
 ifeq ($(ADK_TARGET_USE_STATIC_LIBS)$(ADK_TARGET_BINFMT_FLAT),)
 	$(SED) 's/.*\(HAVE_SHARED\).*/\1=y/' ${WRKBUILD}/.config
 else