This is the mail archive of the
ecos-discuss@sourceware.org
mailing list for the eCos project.
Pure trick for _inpure_ptr and modern toolchains
- From: Sergei Gavrikov <w3sg at SoftHome dot net>
- To: eCos discuss list <ecos-discuss at ecos dot sourceware dot org>
- Date: Fri, 19 Oct 2007 00:34:08 +0300
- Subject: [ECOS] Pure trick for _inpure_ptr and modern toolchains
Hi,
Last days I built a few a bit modern toolchains for eCos and played with
them. The stuff was binutils-1.16, newlib-1.14, gcc-*-3.4.4. And I found
that for such test builds you can easy resolve the '_impure_ptr issue'
in a bloodless manner just using the <target>-ar. Well, I had disliked to
mess up the toolchain or eCos sources to keep the peace.
SYNOPSIS
Build eCos "as is" using modern toolchain
ecosconfig new pid
ecosconfig tree
make -s
headers finished
build finished
make -s tests TESTS=tests/cxxsup -C infra/current
/gnutools/arm-elf/lib/gcc/arm-elf/3.4.4/../../../../arm-elf/lib/libsupc++.a(vterminate.o): In function `__gnu_cxx::__verbose_terminate_handler()':
/test/src/gcc-3.4.4/libstdc++-v3/libsupc++/vterminate.cc:94: undefined reference to `_impure_ptr'
collect2: ld returned 1 exit status
make: *** [/tmp/build/install/tests/infra/current/tests/cxxsupp] Error 1
"Tricked" eCos build (use extra commands <target>-gcc, <target>-ar)
ecosconfig new pid
ecosconfig tree
make -s
headers finished
build finished
cat <<_EOF >impure.c
void *_impure_ptr;
_EOF
arm-elf-gcc -c impure.c
arm-elf-ar q install/lib/libtarget.a impure.o
make -s tests TESTS=tests/cxxsup -C infra/current
Silent GCC... Yep, I like it!
For pedants, that "impure.c" can be like the below.
--------------------------------------------------------------->8
#include <sys/reent.h>
#include <stdio.h>
static struct _reent __impure_data = _REENT_INIT (__impure_data);
struct _reent *_impure_ptr = &__impure_data;
--------------------------------------------------------------->8
Note: <target>-gcc knows where to find newlib headers.
Playing a bit with GCC-3.4.4 (arm-elf, i386-elf, powerpc-eabi) I found
what it doesn't know more about -mno-short-load-words flag. It seems,
you can quite replace that by -mno-alignment-traps flag.
And when I tried to make all eCos tests with new GCC-3.4.4 I got the
warnings "inlining failed" at <include/cyg/libc/signals/signal.inl>. I
have got no warnings using stable eCos compiler (GCC-3.2.1). But, the
medicine was just to specify '--param inline-unit-growth=150'. It was
strange, because man page arm-elf-gcc.1 from GCC-3.4.4 suite said: The
default value is 150.
If this is interesting for community, I can attach new patches and
simple bash script to get the same toolchains.
One note: I won't be able to manage your experiences and success. Host
system to build the toolchains was just a "home" Linux distro -- Ubuntu
Feisty Fawn.
Between you and me, it would seem what eCos official guide how to build
own toolchain (http://ecos.sourceware.org/build-toolchain.html) is an
obsolete document. No, it isn't. I was guided this HOWTO only.
--
Sergei
--
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss