public inbox for newlib@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] [MSP430] Fix relocation type for _bsssize being R_MSP430X_ABS16 when large memory model is used
@ 2017-04-19 11:59 Jozef Lawrynowicz
  2017-04-19 12:29 ` Corinna Vinschen
  0 siblings, 1 reply; 4+ messages in thread
From: Jozef Lawrynowicz @ 2017-04-19 11:59 UTC (permalink / raw)
  To: newlib

For the msp430 target, trying to link a program with .bss larger than
64K causes a few different errors to be reported.

> /usr/local/bin/../lib/gcc/msp430-elf/6.3.1/../../../../msp430-elf/bin/ld: stone-msp430 section `.bss' will not fit in region `RAM'
> /usr/local/bin/../lib/gcc/msp430-elf/6.3.1/../../../../msp430-elf/bin/ld: region `RAM' overflowed by 65906 bytes
> /usr/local/bin/../lib/gcc/msp430-elf/6.3.1/../../../../msp430-elf/lib/large/libcrt.a(crt_bss.o): In function `.Loc.75.1':
> [...]/msp430-elf/large/libgloss/msp430/../../../../../libgloss/msp430/crt0.S:73:(.crt_0100init_bss+0x8): relocation truncated to fit: R_MSP430X_ABS16 against symbol `__bsssize' defined in *ABS* section in stone-msp430

Even though BSS shouldn't be larger than 64K, the relocation trunated
to fit error still looks like a bug.
The patch below changes one of the instructions in
libgloss/msp430/crt0.S from mov.w to mov_, so that the
R_MSP430X_ABS20_A relocation type is used instead of the
R_MSP430X_ABS16 for the _bsssize variable when the large memory model
is used. I also fixed a typo in a comment.
With the patch applied, linking the program with large bss now reports
only the following errors:

> /usr/local/bin/../lib/gcc/msp430-elf/6.3.1/../../../../msp430-elf/bin/ld: stone-msp430 section `.bss' will not fit in region `RAM'
> /usr/local/bin/../lib/gcc/msp430-elf/6.3.1/../../../../msp430-elf/bin/ld: region `RAM' overflowed by 65906 bytes

I don't have write access, so if this patch is satisfactory, I would
appreciate if someone could commit it for me.


From f79b243fafb2964e4d7b73edcf79dd7c7d087ac9 Mon Sep 17 00:00:00 2001
From: Jozef Lawrynowicz <jozef.l@somniumtech.com>
Date: Wed, 19 Apr 2017 11:47:13 +0000
Subject: [PATCH] Fix relocation type for _bsssize being R_MSP430X_ABS16 when
 large memory model is used

---
 libgloss/msp430/crt0.S | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/libgloss/msp430/crt0.S b/libgloss/msp430/crt0.S
index 5c84e7c..f5ab8d3 100644
--- a/libgloss/msp430/crt0.S
+++ b/libgloss/msp430/crt0.S
@@ -72,9 +72,9 @@ START_CRT_FUNC 0100 init_bss

  mov_ #__bssstart, R12
  clr.w R13
- mov.w #__bsssize, R14
+ mov_ #__bsssize, R14
 #ifdef __MSP430X_LARGE__
- clr.w R15 ; We assume that __bsssize is never > 64M
+ clr.w R15 ; We assume that __bsssize is never > 64K
 #endif
  call_ #memset

-- 
1.8.3.1

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

* Re: [PATCH] [MSP430] Fix relocation type for _bsssize being R_MSP430X_ABS16 when large memory model is used
  2017-04-19 11:59 [PATCH] [MSP430] Fix relocation type for _bsssize being R_MSP430X_ABS16 when large memory model is used Jozef Lawrynowicz
@ 2017-04-19 12:29 ` Corinna Vinschen
  2017-04-19 12:54   ` Jozef Lawrynowicz
  0 siblings, 1 reply; 4+ messages in thread
From: Corinna Vinschen @ 2017-04-19 12:29 UTC (permalink / raw)
  To: newlib; +Cc: Jozef Lawrynowicz

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

On Apr 19 12:58, Jozef Lawrynowicz wrote:
> For the msp430 target, trying to link a program with .bss larger than
> 64K causes a few different errors to be reported.
> 
> > /usr/local/bin/../lib/gcc/msp430-elf/6.3.1/../../../../msp430-elf/bin/ld: stone-msp430 section `.bss' will not fit in region `RAM'
> > /usr/local/bin/../lib/gcc/msp430-elf/6.3.1/../../../../msp430-elf/bin/ld: region `RAM' overflowed by 65906 bytes
> > /usr/local/bin/../lib/gcc/msp430-elf/6.3.1/../../../../msp430-elf/lib/large/libcrt.a(crt_bss.o): In function `.Loc.75.1':
> > [...]/msp430-elf/large/libgloss/msp430/../../../../../libgloss/msp430/crt0.S:73:(.crt_0100init_bss+0x8): relocation truncated to fit: R_MSP430X_ABS16 against symbol `__bsssize' defined in *ABS* section in stone-msp430
> 
> Even though BSS shouldn't be larger than 64K, the relocation trunated
> to fit error still looks like a bug.
> The patch below changes one of the instructions in
> libgloss/msp430/crt0.S from mov.w to mov_, so that the
> R_MSP430X_ABS20_A relocation type is used instead of the
> R_MSP430X_ABS16 for the _bsssize variable when the large memory model
> is used. I also fixed a typo in a comment.
> With the patch applied, linking the program with large bss now reports
> only the following errors:
> 
> > /usr/local/bin/../lib/gcc/msp430-elf/6.3.1/../../../../msp430-elf/bin/ld: stone-msp430 section `.bss' will not fit in region `RAM'
> > /usr/local/bin/../lib/gcc/msp430-elf/6.3.1/../../../../msp430-elf/bin/ld: region `RAM' overflowed by 65906 bytes
> 
> I don't have write access, so if this patch is satisfactory, I would
> appreciate if someone could commit it for me.

Your patch doesn't apply cleanly.  Can you please recrate it and make
sure the whitespaces are correct?  Ideally just create an attachment with
the output of `git format-patch'.


Thanks,
Corinna

-- 
Corinna Vinschen
Cygwin Maintainer
Red Hat

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

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

* Re: [PATCH] [MSP430] Fix relocation type for _bsssize being R_MSP430X_ABS16 when large memory model is used
  2017-04-19 12:29 ` Corinna Vinschen
@ 2017-04-19 12:54   ` Jozef Lawrynowicz
  2017-04-19 13:06     ` Corinna Vinschen
  0 siblings, 1 reply; 4+ messages in thread
From: Jozef Lawrynowicz @ 2017-04-19 12:54 UTC (permalink / raw)
  To: newlib

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

On 19 April 2017 at 13:29, Corinna Vinschen <vinschen@redhat.com> wrote:
> On Apr 19 12:58, Jozef Lawrynowicz wrote:
>> For the msp430 target, trying to link a program with .bss larger than
>> 64K causes a few different errors to be reported.
>>
>> > /usr/local/bin/../lib/gcc/msp430-elf/6.3.1/../../../../msp430-elf/bin/ld: stone-msp430 section `.bss' will not fit in region `RAM'
>> > /usr/local/bin/../lib/gcc/msp430-elf/6.3.1/../../../../msp430-elf/bin/ld: region `RAM' overflowed by 65906 bytes
>> > /usr/local/bin/../lib/gcc/msp430-elf/6.3.1/../../../../msp430-elf/lib/large/libcrt.a(crt_bss.o): In function `.Loc.75.1':
>> > [...]/msp430-elf/large/libgloss/msp430/../../../../../libgloss/msp430/crt0.S:73:(.crt_0100init_bss+0x8): relocation truncated to fit: R_MSP430X_ABS16 against symbol `__bsssize' defined in *ABS* section in stone-msp430
>>
>> Even though BSS shouldn't be larger than 64K, the relocation trunated
>> to fit error still looks like a bug.
>> The patch below changes one of the instructions in
>> libgloss/msp430/crt0.S from mov.w to mov_, so that the
>> R_MSP430X_ABS20_A relocation type is used instead of the
>> R_MSP430X_ABS16 for the _bsssize variable when the large memory model
>> is used. I also fixed a typo in a comment.
>> With the patch applied, linking the program with large bss now reports
>> only the following errors:
>>
>> > /usr/local/bin/../lib/gcc/msp430-elf/6.3.1/../../../../msp430-elf/bin/ld: stone-msp430 section `.bss' will not fit in region `RAM'
>> > /usr/local/bin/../lib/gcc/msp430-elf/6.3.1/../../../../msp430-elf/bin/ld: region `RAM' overflowed by 65906 bytes
>>
>> I don't have write access, so if this patch is satisfactory, I would
>> appreciate if someone could commit it for me.
>
> Your patch doesn't apply cleanly.  Can you please recrate it and make
> sure the whitespaces are correct?  Ideally just create an attachment with
> the output of `git format-patch'.

Looks like my email client changed the tabs to spaces.

Patch is attached.

Thanks,
Jozef

[-- Attachment #2: 0001-Fix-relocation-type-for-_bsssize-being-R_MSP430X_ABS.patch --]
[-- Type: application/octet-stream, Size: 808 bytes --]

From f79b243fafb2964e4d7b73edcf79dd7c7d087ac9 Mon Sep 17 00:00:00 2001
From: Jozef Lawrynowicz <jozef.l@somniumtech.com>
Date: Wed, 19 Apr 2017 11:47:13 +0000
Subject: [PATCH] Fix relocation type for _bsssize being R_MSP430X_ABS16 when
 large memory model is used

---
 libgloss/msp430/crt0.S | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/libgloss/msp430/crt0.S b/libgloss/msp430/crt0.S
index 5c84e7c..f5ab8d3 100644
--- a/libgloss/msp430/crt0.S
+++ b/libgloss/msp430/crt0.S
@@ -72,9 +72,9 @@ START_CRT_FUNC 0100 init_bss
 
 	mov_	#__bssstart, R12
 	clr.w	R13
-	mov.w	#__bsssize, R14
+	mov_	#__bsssize, R14
 #ifdef __MSP430X_LARGE__
-	clr.w	R15		; We assume that __bsssize is never > 64M
+	clr.w	R15		; We assume that __bsssize is never > 64K
 #endif
 	call_	#memset
 
-- 
1.8.3.1


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

* Re: [PATCH] [MSP430] Fix relocation type for _bsssize being R_MSP430X_ABS16 when large memory model is used
  2017-04-19 12:54   ` Jozef Lawrynowicz
@ 2017-04-19 13:06     ` Corinna Vinschen
  0 siblings, 0 replies; 4+ messages in thread
From: Corinna Vinschen @ 2017-04-19 13:06 UTC (permalink / raw)
  To: Jozef Lawrynowicz; +Cc: newlib

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

On Apr 19 13:53, Jozef Lawrynowicz wrote:
> On 19 April 2017 at 13:29, Corinna Vinschen <vinschen@redhat.com> wrote:
> > On Apr 19 12:58, Jozef Lawrynowicz wrote:
> >> For the msp430 target, trying to link a program with .bss larger than
> >> 64K causes a few different errors to be reported.
> >>
> >> > /usr/local/bin/../lib/gcc/msp430-elf/6.3.1/../../../../msp430-elf/bin/ld: stone-msp430 section `.bss' will not fit in region `RAM'
> >> > /usr/local/bin/../lib/gcc/msp430-elf/6.3.1/../../../../msp430-elf/bin/ld: region `RAM' overflowed by 65906 bytes
> >> > /usr/local/bin/../lib/gcc/msp430-elf/6.3.1/../../../../msp430-elf/lib/large/libcrt.a(crt_bss.o): In function `.Loc.75.1':
> >> > [...]/msp430-elf/large/libgloss/msp430/../../../../../libgloss/msp430/crt0.S:73:(.crt_0100init_bss+0x8): relocation truncated to fit: R_MSP430X_ABS16 against symbol `__bsssize' defined in *ABS* section in stone-msp430
> >>
> >> Even though BSS shouldn't be larger than 64K, the relocation trunated
> >> to fit error still looks like a bug.
> >> The patch below changes one of the instructions in
> >> libgloss/msp430/crt0.S from mov.w to mov_, so that the
> >> R_MSP430X_ABS20_A relocation type is used instead of the
> >> R_MSP430X_ABS16 for the _bsssize variable when the large memory model
> >> is used. I also fixed a typo in a comment.
> >> With the patch applied, linking the program with large bss now reports
> >> only the following errors:
> >>
> >> > /usr/local/bin/../lib/gcc/msp430-elf/6.3.1/../../../../msp430-elf/bin/ld: stone-msp430 section `.bss' will not fit in region `RAM'
> >> > /usr/local/bin/../lib/gcc/msp430-elf/6.3.1/../../../../msp430-elf/bin/ld: region `RAM' overflowed by 65906 bytes
> >>
> >> I don't have write access, so if this patch is satisfactory, I would
> >> appreciate if someone could commit it for me.
> >
> > Your patch doesn't apply cleanly.  Can you please recrate it and make
> > sure the whitespaces are correct?  Ideally just create an attachment with
> > the output of `git format-patch'.
> 
> Looks like my email client changed the tabs to spaces.
> 
> Patch is attached.

Pushed.


Thanks,
Corinna

-- 
Corinna Vinschen
Cygwin Maintainer
Red Hat

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

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

end of thread, other threads:[~2017-04-19 13:06 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-04-19 11:59 [PATCH] [MSP430] Fix relocation type for _bsssize being R_MSP430X_ABS16 when large memory model is used Jozef Lawrynowicz
2017-04-19 12:29 ` Corinna Vinschen
2017-04-19 12:54   ` Jozef Lawrynowicz
2017-04-19 13:06     ` Corinna Vinschen

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).