[Bug target/30417] Section .data cannot be moved with -mmcu=atmega88
e9fritte at etek dot chalmers.se
gcc-bugzilla@gcc.gnu.org
Mon Apr 21 17:21:00 GMT 2014
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30417
Andreas Fritiofson <e9fritte at etek dot chalmers.se> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|RESOLVED |UNCONFIRMED
Known to work|4.2.0 |
Host|i486-linux-gnu |x86_64-linux-gnu
Version|4.1.0 |4.8.2
Resolution|WORKSFORME |---
Build|i486-linux-gnu |x86_64-linux-gnu
Severity|normal |minor
--- Comment #5 from Andreas Fritiofson <e9fritte at etek dot chalmers.se> ---
Just updating this to note that this still/again fails, however not exactly the
same as in my original report.
Using --section-data=.data=0x800200 correctly overrides the -Tdata 0x800100
that gcc adds for some AVRs.
But the (according to ld docs) equivalent -Tdata=0x800200 is silently discarded
and the .data section remains at 0x800100, causing havoc at runtime.
Can't tell if this is a bug in binutils or if this is intended behavior and gcc
should adapt the collect2 arguments to avoid triggering it.
Minimal test cases:
$ avr-gcc -v
Using built-in specs.
COLLECT_GCC=avr-gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/avr/4.8.2/lto-wrapper
Target: avr
Configured with: ../src/configure -v --enable-languages=c,c++ --prefix=/usr/lib
--infodir=/usr/share/info --mandir=/usr/share/man --bindir=/usr/bin
--libexecdir=/usr/lib --libdir=/usr/lib --enable-shared --with-system-zlib
--enable-long-long --enable-nls --without-included-gettext --disable-libssp
--build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=avr
Thread model: single
gcc version 4.8.2 (GCC)
$ avr-ld -v
GNU ld (GNU Binutils) 2.23.1
$ echo 'int main(void) { return 0; }' > main.c
Works:
$ avr-gcc -mmcu=atmega88 -Wl,-Map,main.map,--section-start,.data=0x800200 -o
main.elf main.c && grep ^.data < main.map
.data 0x0000000000800200 0x0 load address 0x000000000000005c
Fails:
$ avr-gcc -mmcu=atmega88 -Wl,-Map,main.map,-Tdata=0x800200 -o main.elf main.c
&& grep ^.data < main.map
.data 0x0000000000800100 0x0 load address 0x000000000000005c
Works:
$ avr-gcc -mmcu=atmega8 -Wl,-Map,main.map,-Tdata=0x800200 -o main.elf main.c &&
grep ^.data < main.map
.data 0x0000000000800200 0x0 load address 0x000000000000004e
More information about the Gcc-bugs
mailing list