Bug 20849 - [avr][avr_tiny] Don't put .rodata in RAM.
Summary: [avr][avr_tiny] Don't put .rodata in RAM.
Status: RESOLVED FIXED
Alias: None
Product: binutils
Classification: Unclassified
Component: ld (show other bugs)
Version: 2.27
: P3 enhancement
Target Milestone: 2.28
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-11-21 13:47 UTC by Georg-Johann Lay
Modified: 2017-04-21 09:02 UTC (History)
1 user (show)

See Also:
Host:
Target: avr
Build:
Last reconfirmed:


Attachments
Untested patch (506 bytes, patch)
2016-11-21 13:52 UTC, Georg-Johann Lay
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Georg-Johann Lay 2016-11-21 13:47:50 UTC
The current linker description files for AVR_TINY like avrtiny.x et al are locating .rodata into SRAM which is quite a waste for devices with up to 128 Bytes of SRAM.

As flash is accessible by LD instructions which read from RAM (provided an offset of 0x4000 is added), a better approach is just to add 0x4000 to the VMA of .rodata objects.
Comment 1 Georg-Johann Lay 2016-11-21 13:52:27 UTC
Created attachment 9658 [details]
Untested patch

ld/
	PR target/20849
	* scripttempl/avrtiny.sc (__RODATA_PM_OFFSET__): New define.
	(.rodata): New section.
	(.data): Remove .rodata*.
Comment 2 Sourceware Commits 2017-02-27 17:07:04 UTC
The master branch has been updated by Nick Clifton <nickc@sourceware.org>:

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=fbf25dfdfdba2c057e7ccdae4e0d6a2139c66dd5

commit fbf25dfdfdba2c057e7ccdae4e0d6a2139c66dd5
Author: Georg-Johann Lay <gjl@gcc.gnu.org>
Date:   Mon Feb 27 17:05:53 2017 +0000

    Place read-only data in the text section on AVR Tiny targets.
    
    	PR target/20849
            * scripttempl/avrtiny.sc (__RODATA_PM_OFFSET__): New define.
            (.rodata): New section.
            (.data): Remove .rodata*.
Comment 3 Nick Clifton 2017-02-27 17:08:11 UTC
HI Georg-Johann,

  Patch approved and applied.

  I am really sorry about taking so long to review this patch.

Cheers
  Nick
Comment 4 Georg-Johann Lay 2017-03-03 13:46:28 UTC
Mnay thanks for taking care of this!