This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Re: other/7249: -Wl, and -Xlinker options to arm-aout-gcc
- From: rearnsha at gcc dot gnu dot org
- To: betoes at igbt dot sel dot eesc dot sc dot usp dot br, gcc-bugs at gcc dot gnu dot org, gcc-prs at gcc dot gnu dot org, nobody at gcc dot gnu dot org, pzn at igbt dot sel dot eesc dot sc dot usp dot br
- Date: 30 Sep 2002 12:39:13 -0000
- Subject: Re: other/7249: -Wl, and -Xlinker options to arm-aout-gcc
- Reply-to: rearnsha at gcc dot gnu dot org, betoes at igbt dot sel dot eesc dot sc dot usp dot br, gcc-bugs at gcc dot gnu dot org, gcc-prs at gcc dot gnu dot org, nobody at gcc dot gnu dot org, pzn at igbt dot sel dot eesc dot sc dot usp dot br, gcc-gnats at gcc dot gnu dot org
Synopsis: -Wl, and -Xlinker options to arm-aout-gcc
State-Changed-From-To: open->feedback
State-Changed-By: rearnsha
State-Changed-When: Mon Sep 30 05:39:11 2002
State-Changed-Why:
I don't think there is anything here that is specific to the ARM, it think it's due to the way the driver programs for gcc have been changed.
Gcc uses a program called collect2 as part of its link process. Collect2 (to a simple approximation) does the link in three steps: it first links all the objects specified together; then it scans the image for certain symbols, such as C++ constructors, destructors or exception tables, etc; and finally it links in some extra code to ensure that the above information is correctly initialized at the start of execution. The problem, I think, is that collect2 doesn't understand the -oformat option.
However, even if we taught collect2 about it, I'm not sure it would help much. collect2 needs to be able to run tools such as nm on the partially linked image, and it can't do that if its been written out in ihex format.
So I really think you need to split your link step into two commands. In the first produce an executable a.out image using the linker, and in the second use objcopy to translate your final image into ihex format. Ie,
arm-aout-gcc -nostdlib -o foo.aout foo.c
arm-aout-objcopy -O ihex -o foo foo.aout
This gives you all the flexibility of using gcc to link your image but you still end up with an ihex format file.
Are you happy if I close this PR?
http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=7249