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: PowerPC EABI issues with newlib


> The first problem is that specifying 
> "--target=powerpc-unknown-eabi" ends up building with flag 
> "-mno-eabi", although the opposite ("-meabi") is normally 
> what one wants. The problem lies in newlib/configure.host , 
> this is the code:
> 
>   powerpc*-*-eabi* | \
>   powerpc*-*-elf* | \
>   powerpc*-*-linux* | \
>   powerpc*-*-rtem* | \
>   powerpc*-*-sysv* | \
>   powerpc*-*-solaris*)
> 	default_newlib_io_long_long="yes"
> 	newlib_cflags="${newlib_cflags} -mrelocatable-lib 
> -mno-eabi -mstrict-align -DMISSING_SYSCALL_NAMES"
> 	;;
> 
> 
> The second problem is that newlib fails to build with switch 
> "-msdata=eabi" . There are 2 related error messages:

> 
> When using "-msdata=eabi", const variables should land in 
> .sdata2, and not in .sdata . While variable _impure_ptr is 
> not const, _global_impure_ptr is const and should not be 
> placed in .sdata .
> 
> I'm not sure about the best way to fix this issue. Here is a 
> question about it I posted to the GCC e-mail list and the 
> answer to it:
> 
>   http://gcc.gnu.org/ml/gcc-help/2011-07/msg00073.html
>   http://gcc.gnu.org/ml/gcc-help/2011-07/msg00079.html
> 
> In case those links break, the e-mail title was "How to check 
> at compilation time whether -msdata is set to eabi for 
> PowerPC embedded targets".

Hi,

I know I have had similar problems with regards to .sdata vs. .sdata2; I think
I ultimately gave up.

Note that .sdata2 does not necessarily lie in ROM (Flash).
PowerPC EABI, Version 1.0, Chapter 4, Section "Sections" (pg 11), has this to say:

The special section .sdata2 is intended to hold initialized read-only small data that contribute to
the program memory image. The section can, however, be used to hold writable data. The special
section .sbss2 is intended to hold writable small data that contribute to the program memory image
and whose initial values are 0.

Also, note that the e500 ABI renames sections .sdata[02] and .sbss[02] to .PPC.EMB.s(data|bss)[02].
The E500 ABI suggests the following order of sections:

.rodata
.PPC.EMB.sdata2
.PPC.EMB.sbss2
.data
.got
.sdata
.sbss
.plt
.bss

GNU ld linker file would need to be written such as to move .PPC.EMB.sdata2 into ROM
area if read-only, otherwise into RAM, which is possible with the ONLY_IF_RO and ONLY_IF_RW keywords.

Konrad Schwarz


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