This is the mail archive of the newlib@sourceware.org mailing list for the newlib project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] [MSP430] Fix relocation type for _bsssize being R_MSP430X_ABS16 when large memory model is used


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: 0001-Fix-relocation-type-for-_bsssize-being-R_MSP430X_ABS.patch
Description: Binary data


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]