This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: PowerPC EABI - prepending ecrti/crtbegin
- From: Ian Lance Taylor <iant at google dot com>
- To: marco dot awater at acq dot nl
- Cc: gcc-help at gcc dot gnu dot org
- Date: Wed, 30 Mar 2011 10:26:27 -0700
- Subject: Re: PowerPC EABI - prepending ecrti/crtbegin
- References: <4D930B55.90309@acq.nl>
Marco Awater <marco.awater@acq.nl> writes:
> Currently I'm working on updating our existing PowerPC EABI toolchain
> to a more recent one. We were using GCC 3.4.2, but I've now built a
> new GCC 4.5.2 toolchain. Building the toolchain went without any
> hitches, but building an application for our target yielded unexpected
> results.
>
> My platform is an embedded OS-less environment; I have my own vectors
> and bootcode. However, when building with the new GCC, ecrti.o and
> crtbegin.o get prepended to my own code thus messing up what is meant
> to be my vector table. The old compiler did not prepend these files
> and, apart from the compiler, no changes have been made to the build
> environment (the GCC flags are the same). I've done a fair bit of
> googling and digging, but I am unsure what the intended approach is
> for platforms such as mine.
>
> Supplying -nostartfiles to the linker will stop the linker from
> prepending these files, but it also means I have to supply my own EABI
> constants (_SDA_BASE_ and co.). Is this the intended way to go about
> this? Note that I don't want or need the C++
> (constructor/destructor/exception) support as provided by these extra
> files.
Why do ecrti.o and crtbegin.o cause trouble? Are you assuming that your
code is the very first in the file? If that is the problem, I would
recommend adjusting your linker script to put your vector table at the
front. I think that will be simpler than fighting against the compiler
here.
Ian