public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* [patch,avr] PR31177: Let region text start at __TEXT_REGION_ORIGIN___
@ 2023-12-17 18:20 Georg-Johann Lay
  2023-12-18 10:11 ` [patch, avr] " Nick Clifton
  0 siblings, 1 reply; 2+ messages in thread
From: Georg-Johann Lay @ 2023-12-17 18:20 UTC (permalink / raw)
  To: binutils

[-- Attachment #1: Type: text/plain, Size: 615 bytes --]

The start of MEMORY region text currently starts hard-coded at 0.

The linker can produce more exact diagnostics when it knows the exact 
placements of the memory regions.

For some old devices, program memory starts at 0x8000, so allow to 
specify program memory start at __TEXT_REGION_ORIGIN__ similar to how 
the data region is described.

If ok, please apply to master.
This one is also fine to back-port.

Johann

--

AVR: Use __TEXT_REGION_ORIGIN__ as start for MEMORY region text.

ld/
	PR 31177
	* scripttempl/avr.sc (__TEXT_REGION_ORIGIN__): New symbol.
	(MEMORY): Use as start address for the text region.

[-- Attachment #2: pr31177-text-origin.diff --]
[-- Type: text/x-patch, Size: 1208 bytes --]

diff --git a/ld/scripttempl/avr.sc b/ld/scripttempl/avr.sc
index a44eba5c9e9..00ff49aacf4 100644
--- a/ld/scripttempl/avr.sc
+++ b/ld/scripttempl/avr.sc
@@ -92,6 +92,7 @@ OUTPUT_ARCH(${ARCH})
 EOF
 
 test -n "${RELOCATING}" && cat <<EOF
+__TEXT_REGION_ORIGIN__ = DEFINED(__TEXT_REGION_ORIGIN__) ? __TEXT_REGION_ORIGIN__ : 0;
 __TEXT_REGION_LENGTH__ = DEFINED(__TEXT_REGION_LENGTH__) ? __TEXT_REGION_LENGTH__ : $TEXT_LENGTH;
 __DATA_REGION_ORIGIN__ = DEFINED(__DATA_REGION_ORIGIN__) ? __DATA_REGION_ORIGIN__ : $DATA_ORIGIN;
 __DATA_REGION_LENGTH__ = DEFINED(__DATA_REGION_LENGTH__) ? __DATA_REGION_LENGTH__ : $DATA_LENGTH;
@@ -108,7 +109,7 @@ ${HAVE_FLMAP+__RODATA_REGION_LENGTH__ = DEFINED(__RODATA_REGION_LENGTH__) ? __RO
 ${HAVE_FLMAP+__RODATA_ORIGIN__ = __RODATA_VMA__ + __RODATA_LDS_OFFSET__;}
 MEMORY
 {
-  text   (rx)   : ORIGIN = 0, LENGTH = __TEXT_REGION_LENGTH__
+  text   (rx)   : ORIGIN = __TEXT_REGION_ORIGIN__, LENGTH = __TEXT_REGION_LENGTH__
   data   (rw!x) : ORIGIN = __DATA_REGION_ORIGIN__, LENGTH = __DATA_REGION_LENGTH__
 ${EEPROM_LENGTH+  eeprom (rw!x) : ORIGIN = 0x810000, LENGTH = __EEPROM_REGION_LENGTH__}
   $FUSE_NAME      (rw!x) : ORIGIN = 0x820000, LENGTH = __FUSE_REGION_LENGTH__

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [patch, avr] PR31177: Let region text start at __TEXT_REGION_ORIGIN___
  2023-12-17 18:20 [patch,avr] PR31177: Let region text start at __TEXT_REGION_ORIGIN___ Georg-Johann Lay
@ 2023-12-18 10:11 ` Nick Clifton
  0 siblings, 0 replies; 2+ messages in thread
From: Nick Clifton @ 2023-12-18 10:11 UTC (permalink / raw)
  To: Georg-Johann Lay, binutils

Hi Johann,

> The start of MEMORY region text currently starts hard-coded at 0.
> 
> The linker can produce more exact diagnostics when it knows the exact placements of the memory regions.
> 
> For some old devices, program memory starts at 0x8000, so allow to specify program memory start at __TEXT_REGION_ORIGIN__ similar to how the data region is described.

Approved and applied.

Cheers
   Nick


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2023-12-18 10:11 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-12-17 18:20 [patch,avr] PR31177: Let region text start at __TEXT_REGION_ORIGIN___ Georg-Johann Lay
2023-12-18 10:11 ` [patch, avr] " Nick Clifton

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).