[patch] ARM EABI support routine
Jeff Johnston
jjohnstn@redhat.com
Wed Aug 31 20:02:00 GMT 2005
Paul Brook wrote:
> On Wednesday 24 August 2005 18:27, Jeff Johnston wrote:
>
>>This actually opens a small can of worms due to the fact that
>>libc/sys/arm should not exist as it does today. To solve the problem
>>with board packages, newlib added the configuration setting:
>>--disable-newlib-supplied-syscalls. At the moment, this removes the
>>entire sys/arm directory from building so your file won't get built.
>>The irony is that the file you are adding is actually what belongs in
>>libc/sys/arm.
>>
>>So, a change is needed in the configuration files in libc/sys/arm to
>>allow only this one file to build in the case of
>>--disable-newlib-supplied-syscalls.
>>
>>There is also the problem with crt0.o. Currently, the configuration
>>checks to see if sys_dir is defined and if yes, expects crt0.o. This
>>could easily be changed by adding a new variable to configure.host which
>>specifies no crt0.o regardless.
>
>
> Something like this?
>
> Paul
>
Yes, just what I was looking for. There are a couple settings of
have_crt0 to yes when "may_supply_syscalls" is no (thumb,xscale). I
assume these are just typos and I'll fix them up when I apply the patch.
Thanks,
-- Jeff J.
> 2005-08-24 Paul Brook <paul@codesourcery.com>
>
> * configure.host: Set have_crt0 to no for Arm targts when not
> providing syscalls. Set sys_dir=arm unconditionally.
> Default have_crt0 based on sys_dir.
> * configure.in: Use have_crt0.
> * libc/configure.in: Ditto.
> * libc/sys/configure.in: Ditto.
> * configure: Regenerate.
> * libc/configure: Regenerate.
> * libc/sys/configure: Regenerate.
> * libc/sys/arm/Makefile.am (lib_a_SOURCES): Add aeabi_atexit.c.
> Only build other files when providing syscalls.
> * libc/sys/arm/Makefile.in: Regenerate.
> * libc/sys/arm/aeabi_atexit.c: New file.
>
>
>
> ------------------------------------------------------------------------
>
> Index: newlib/configure.host
> ===================================================================
> RCS file: /var/cvsroot/src-cvs/src/newlib/configure.host,v
> retrieving revision 1.75
> diff -u -p -r1.75 configure.host
> --- newlib/configure.host 10 Aug 2005 20:35:13 -0000 1.75
> +++ newlib/configure.host 31 Aug 2005 19:33:37 -0000
> @@ -42,6 +42,8 @@
> # oext object file extension - needed for libtool support
> # crt1 name of crt1 object if one is provided
> # crt1_dir directory where crt1 object is found
> +# have_crt0 "yes"/"no" if crt0 is/isn't provided.
> +# "" if crt0 is provided when sys_dir is set
>
> newlib_cflags=
> libm_machine_dir=
> @@ -55,6 +57,7 @@ unix_dir=
> mach_add_setjmp=
> crt1=
> crt1_dir=
> +have_crt0=
> use_libtool=no
> have_sys_mach_dir=no
> default_newlib_io_long_long=no
> @@ -318,8 +321,9 @@ case "${host}" in
> sys_dir=arc
> ;;
> arm-*-*)
> - if [ "x${newlib_may_supply_syscalls}" = "xyes" ] ; then
> - sys_dir=arm
> + sys_dir=arm
> + if [ "x${newlib_may_supply_syscalls}" = "xno" ] ; then
> + have_crt0="no"
> fi
> ;;
> crx*)
> @@ -332,8 +336,9 @@ case "${host}" in
> sys_dir=
> ;;
> ep9312-*-*)
> - if [ "x${newlib_may_supply_syscalls}" = "xyes" ] ; then
> - sys_dir=arm
> + sys_dir=arm
> + if [ "x${newlib_may_supply_syscalls}" = "xno" ] ; then
> + have_crt0="no"
> fi
> ;;
> frv*)
> @@ -413,13 +418,15 @@ case "${host}" in
> unix_dir=unix
> ;;
> strongarm-*-*)
> - if [ "x${newlib_may_supply_syscalls}" = "xyes" ] ; then
> - sys_dir=arm
> + sys_dir=arm
> + if [ "x${newlib_may_supply_syscalls}" = "xno" ] ; then
> + have_crt0="no"
> fi
> ;;
> thumb-*-*)
> - if [ "x${newlib_may_supply_syscalls}" = "xyes" ] ; then
> - sys_dir=arm
> + sys_dir=arm
> + if [ "x${newlib_may_supply_syscalls}" = "xno" ] ; then
> + have_crt0="yes"
> fi
> ;;
> tic80*)
> @@ -444,8 +451,9 @@ case "${host}" in
> sys_dir=w65
> ;;
> xscale-*-*)
> - if [ "x${newlib_may_supply_syscalls}" = "xyes" ] ; then
> - sys_dir=arm
> + sys_dir=arm
> + if [ "x${newlib_may_supply_syscalls}" = "xno" ] ; then
> + have_crt0="yes"
> fi
> ;;
> z8k-*-coff)
> @@ -725,3 +733,7 @@ if [ "x${newlib_io_pos_args}" = "x" ]; t
> newlib_io_pos_args="yes";
> fi
> fi
> +
> +if test -z "${have_crt0}" && test -n "${sys_dir}"; then
> + have_crt0="yes"
> +fi
> Index: newlib/configure.in
> ===================================================================
> RCS file: /var/cvsroot/src-cvs/src/newlib/configure.in,v
> retrieving revision 1.27
> diff -u -p -r1.27 configure.in
> --- newlib/configure.in 17 Mar 2005 20:11:17 -0000 1.27
> +++ newlib/configure.in 31 Aug 2005 18:48:14 -0000
> @@ -139,7 +139,7 @@ AC_CONFIG_SUBDIRS(${configdirs})
>
> CRT0=
> CRT0_DIR=
> -if test -n "${sys_dir}"; then
> +if test "x${have_crt0}" = "xyes"; then
> CRT0=crt0.o
> CRT0_DIR=libc/
> fi
> Index: newlib/libc/configure.in
> ===================================================================
> RCS file: /var/cvsroot/src-cvs/src/newlib/libc/configure.in,v
> retrieving revision 1.11
> diff -u -p -r1.11 configure.in
> --- newlib/libc/configure.in 15 Sep 2004 20:50:07 -0000 1.11
> +++ newlib/libc/configure.in 31 Aug 2005 18:50:08 -0000
> @@ -30,7 +30,7 @@ fi
> AC_CONFIG_SUBDIRS(machine sys)
>
> CRT0=
> -if test -n "${sys_dir}"; then
> +if test "x${have_crt0}" = "xyes"; then
> CRT0=crt0.o
> fi
> AC_SUBST(CRT0)
> Index: newlib/libc/sys/configure.in
> ===================================================================
> RCS file: /var/cvsroot/src-cvs/src/newlib/libc/sys/configure.in,v
> retrieving revision 1.4
> diff -u -p -r1.4 configure.in
> --- newlib/libc/sys/configure.in 15 Sep 2004 20:50:07 -0000 1.4
> +++ newlib/libc/sys/configure.in 31 Aug 2005 18:50:22 -0000
> @@ -22,7 +22,7 @@ if test -n "${sys_dir}"; then
> fi
>
> CRT0=
> -if test -n "${sys_dir}"; then
> +if test "x${have_crt0}" = "xyes"; then
> CRT0=crt0.o
> fi
> AC_SUBST(CRT0)
> Index: newlib/libc/sys/arm/Makefile.am
> ===================================================================
> RCS file: /var/cvsroot/src-cvs/src/newlib/libc/sys/arm/Makefile.am,v
> retrieving revision 1.4
> diff -u -p -r1.4 Makefile.am
> --- newlib/libc/sys/arm/Makefile.am 9 Jun 2004 19:05:09 -0000 1.4
> +++ newlib/libc/sys/arm/Makefile.am 31 Aug 2005 18:44:14 -0000
> @@ -7,16 +7,18 @@ INCLUDES = $(NEWLIB_CFLAGS) $(CROSS_CFLA
> noinst_LIBRARIES = lib.a
>
> if MAY_SUPPLY_SYSCALLS
> -extra_objs = syscalls.o
> +extra_objs = libcfunc.o trap.o syscalls.o
> else
> extra_objs =
> endif
>
> -lib_a_SOURCES = libcfunc.c trap.S
> +lib_a_SOURCES = aeabi_atexit.c
> lib_a_LIBADD = $(extra_objs)
> lib_a_DEPENDENCIES = $(extra_objs)
>
> +if MAY_SUPPLY_SYSCALLS
> all: crt0.o
> +endif
>
> ACLOCAL_AMFLAGS = -I ../../..
> CONFIG_STATUS_DEPENDENCIES = $(newlib_basedir)/configure.host
> Index: newlib/libc/sys/arm/aeabi_atexit.c
> ===================================================================
> RCS file: newlib/libc/sys/arm/aeabi_atexit.c
> diff -N newlib/libc/sys/arm/aeabi_atexit.c
> --- /dev/null 1 Jan 1970 00:00:00 -0000
> +++ newlib/libc/sys/arm/aeabi_atexit.c 24 Aug 2005 14:21:57 -0000
> @@ -0,0 +1,10 @@
> +#include <stdlib.h>
> +
> +/* Register a function to be called by exit or when a shared library
> + is unloaded. This routine is like __cxa_atexit, but uses the
> + calling sequence required by the ARM EABI. */
> +int
> +__aeabi_atexit (void *arg, void (*func) (void *), void *d)
> +{
> + return __cxa_atexit (func, arg, d);
> +}
More information about the Newlib
mailing list