PowerPC EABI - prepending ecrti/crtbegin
Ian Lance Taylor
iant@google.com
Wed Mar 30 17:41:00 GMT 2011
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
More information about the Gcc-help
mailing list