On Thu, Apr 18, 2013 at 01:34:41AM -0400, Kirill Shklovsky wrote:
> Senthil Kumar Selvaraj wrote:
> 
> > I don't see the problem when I tried compiling the below code with 4.6.2.
> > Can you paste the command line you used, with -v and -Wl,--verbose turned 
> > on?
> > It would be helpful to know what version of binutils was used, as well as 
> > the build steps.
> 
> Command used:
> 
> /usr/local/avr/bin/avr-gcc -I. \
>     -D F_CPU=20000000UL \
>     -g -mmcu=atmega328 -O1 \
>     -fpack-struct \
>     -fshort-enums \
>     -funsigned-bitfields \
>     -funsigned-char \
>     -Wall \
>     -ffunction-sections \
>     -fdata-sections \
>     -fno-exceptions \
>     -Wa,-ahlms=obj/main.lst.gcc \
>     -Wno-uninitialized \
>     -c main.cpp -o obj/main.o
> 
> Here the result with -v -Wl,--verbose:
> 
> COLLECT_GCC=/usr/local/avr/bin/avr-gcc
> Target: avr
> Configured with: ../configure --prefix=/usr/local/avr --target=avr
> --enable-languages=c,c++ --disable-nls --disable-libssp --with-dwarf2
> Thread model: single
> gcc version 4.7.3 (GCC)
> COLLECT_GCC_OPTIONS='-I' '.' '-D' 'F_CPU=20000000UL' '-g'
> '-mmcu=atmega328' '-O1' '-fpack-struct' '-fshort-enums'
> '-funsigned-bitfields' '-funsigned-char' '-Wall' '-ffunction-sections'
> '-fdata-sections' '-fno-exceptions' '-Wno-uninitialized' '-v' '-c'
> '-o' 'obj/main.o'
>  /usr/local/avr/libexec/gcc/avr/4.7.3/cc1plus.exe -quiet -v -I .
> -imultilib avr5 -D F_CPU=20000000UL main.cpp -quiet -dumpbase main.cpp
> -mmcu=atmega328 -auxbase-strip obj/main.o -g -O1 -Wall
> -Wno-uninitialized -version -fpack-struct -fshort-enums
> -funsigned-bitfields -funsigned-char -ffunction-sections
> -fdata-sections -fno-exceptions -fno-rtti -fno-enforce-eh-specs
> -fno-exceptions -o /tmp/ccFOZ1pq.s
> GNU C++ (GCC) version 4.7.3 (avr)
>         compiled by GNU C version 4.5.3, GMP version 4.3.2, MPFR
> version 3.0.1-p4, MPC version 0.8
> GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
> ignoring nonexistent directory
> "/usr/local/avr/lib/gcc/avr/4.7.3/../../../../avr/include/c++/4.7.3"
> ignoring nonexistent directory
> "/usr/local/avr/lib/gcc/avr/4.7.3/../../../../avr/include/c++/4.7.3/avr/avr5"
> ignoring nonexistent directory
> "/usr/local/avr/lib/gcc/avr/4.7.3/../../../../avr/include/c++/4.7.3/backward"
> ignoring nonexistent directory
> "/usr/local/avr/lib/gcc/avr/4.7.3/../../../../avr/sys-include"
> #include "..." search starts here:
> #include <...> search starts here:
>  .
>  /usr/local/avr/lib/gcc/avr/4.7.3/include
>  /usr/local/avr/lib/gcc/avr/4.7.3/include-fixed
>  /usr/local/avr/lib/gcc/avr/4.7.3/../../../../avr/include
> End of search list.
> GNU C++ (GCC) version 4.7.3 (avr)
>         compiled by GNU C version 4.5.3, GMP version 4.3.2, MPFR
> version 3.0.1-p4, MPC version 0.8
> GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
> Compiler executable checksum: 49d98612d3bd1e77bd63ccc498787f2f
> COLLECT_GCC_OPTIONS='-I' '.' '-D' 'F_CPU=20000000UL' '-g'
> '-mmcu=atmega328' '-O1' '-fpack-struct' '-fshort-enums'
> '-funsigned-bitfields' '-funsigned-char' '-Wall' '-ffunction-sections'
> '-fdata-sections' '-fno-exceptions' '-Wno-uninitialized' '-v' '-c'
> '-o' 'obj/main.o'
>  /usr/local/avr/lib/gcc/avr/4.7.3/../../../../avr/bin/as.exe
> -mmcu=atmega328 -mno-skip-bug -ahlms=obj/main.lst.gcc -o obj/main.o
> /tmp/ccFOZ1pq.s
> COMPILER_PATH=/usr/local/avr/libexec/gcc/avr/4.7.3/:/usr/local/avr/libexec/gcc/avr/4.7.3/:/usr/local/avr/libexec/gcc/avr/:/usr/local/avr/lib/gcc/avr/4.7.3/:/usr/local/avr/lib/gcc/avr/:/usr/local/avr/lib/gcc/avr/4.7.3/../../../../avr/bin/
> LIBRARY_PATH=/usr/local/avr/lib/gcc/avr/4.7.3/avr5/:/usr/local/avr/lib/gcc/avr/4.7.3/../../../../avr/lib/avr5/:/usr/local/avr/lib/gcc/avr/4.7.3/:/usr/local/avr/lib/gcc/avr/4.7.3/../../../../avr/lib/
> COLLECT_GCC_OPTIONS='-I' '.' '-D' 'F_CPU=20000000UL' '-g'
> '-mmcu=atmega328' '-O1' '-fpack-struct' '-fshort-enums'
> '-funsigned-bitfields' '-funsigned-char' '-Wall' '-ffunction-sections'
> '-fdata-sections' '-fno-exceptions' '-Wno-uninitialized' '-v' '-c'
> '-o' 'obj/main.o'
> 
> The build steps is the command line above for compiling + link command:
> 
> /usr/local/avr/bin/avr-gcc
> -Wl,--gc-sections,-Map,obj/testVolatile.elf.map  -mmcu=atmega328
> /usr/local/avr/avr/lib/libm.a -o obj/testVolatile.elf
> obj/main.o
> -lm
> 

Could you pass -v and -Wl,--verbose to the link command line as well and
show us the output? That'll tell us if avr-gcc passed the right VMA for
.data, and will also print the linker script used, so we can see if 
you ran into the binutils bug JW mentioned.

Regards
Senthil

_______________________________________________
AVR-GCC-list mailing list
AVR-GCC-list@nongnu.org
https://lists.nongnu.org/mailman/listinfo/avr-gcc-list

Reply via email to