
On 10/25/06, Wolfgang Denk wd@denx.de wrote:
In message 1defaf580610251315l7a3ef385x73628d836daa2238@mail.gmail.com you wrote:
Yes, "gcc -g" should always work. However, in Matthew's example, the command line also included "-Wa,-g", which injects the -g option
"-Wa,-g" is only set in AFLAGS_DEBUG.
Yes, and it breaks only for assembly files, as shown by Matthew's example:
powerpc-unknown-linux-gnu-gcc -g -Os -fPIC -ffixed-r14 -meabi -D__KERNEL__ -DTEXT_BASE=0xfff80000 -I/temp/u-boot.work/u-boot/include -fno-builtin -ffreestanding -nostdinc -isystem /_TOOLS_/.dist0/gnu-gcc-3.4.3-binutils-2.15-powerpc-unknown-linux-gnu/i686-pc-linux2.4/bin/../lib/gcc/powerpc-unknown-linux-gnu/3.4.3/include -pipe -DCONFIG_PPC -D__powerpc__ -DCONFIG_MPC85xx -DCONFIG_E500 -ffixed-r2 -ffixed-r29 -Wa,-me500 -msoft-float -mno-string -DCONFIG_MPC85xx=1 -DCONFIG_MPC8540=1 -DCONFIG_E500=1 -Wall -Wstrict-prototypes -c -o sched.o sched.c
this one compiles just fine...
powerpc-unknown-linux-gnu-gcc -Wa,-g -D__ASSEMBLY__ -g -Os -fPIC -ffixed-r14 -meabi -D__KERNEL__ -DTEXT_BASE=0xfff80000 -I/temp/u-boot.work/u-boot/include -fno-builtin -ffreestanding -nostdinc -isystem /_TOOLS_/.dist0/gnu-gcc-3.4.3-binutils-2.15-powerpc-unknown-linux-gnu/i686-pc-linux2.4/bin/../lib/gcc/powerpc-unknown-linux-gnu/3.4.3/include -pipe -DCONFIG_PPC -D__powerpc__ -DCONFIG_MPC85xx -DCONFIG_E500 -ffixed-r2 -ffixed-r29 -Wa,-me500 -msoft-float -mno-string -DCONFIG_MPC85xx=1 -DCONFIG_MPC8540=1 -DCONFIG_E500=1 -c -o ppc_longjmp.o ppc_longjmp.S /_TOOLS_/.dist0/gnu-gcc-3.4.3-binutils-2.15-powerpc-unknown-linux-gnu/i686-pc-linux2.4/bin/../lib/gcc/powerpc-unknown-linux-gnu/3.4.3/../../../../powerpc-unknown-linux-gnu/bin/as: option `-g' is ambiguous
...but this one fails because of the -Wa,-g option.
directly into the command line for the assembler, and that seems to work only for 2.16 and later (or maybe not even that in case of ARM.)
But we've been using this for a long, long time. It's been working fine with ELDK 3.x (GCC-3.3.3 / binutils 2.14) on ARM, MIPS and PPC.
Yes, -gstabs has probably been supported a lot longer.
I wonder if gcc will automatically pass the correct -g<whatever> option to gas when it's given the -g option? If that's the case, I suppose we could simply remove -Wa,-g and everyone will be happy...
/opt/eldk-4.0-2006-02-19/usr/bin/../lib/gcc/arm-linux/4.0.0/../../../../arm-linux/bin/as --gdwarf2 -mcpu=arm9 -mfpu=softvfp -o foo.o foo.s
See the "--gdwarf2" passed to as.
Indeed. I can send you a new patch tomorrow which simply removes -Wa,-g for all targets (the -g option should still be there.) Unfortunately, it will be more difficult to spot breakage with such a patch as the assembler will just silently not generate any debug information if you're using a version of gcc which does not pass any -g<whatever> option on to the assembler.
On the other hand, such breakage won't be that critical since things will still build and run properly. I'm not the right person to decide, as there is nothing older than gcc 4.0 and binutils 2.16 available for AVR32. I just need to get rid of the -gstabs option, as the avr32 toolchain only supports dwarf2...
Haavard