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]

PowerPC EABI issues with newlib


Hi there:

I am building a GCC 4.5.3 cross-compiler for an embedded PowerPC target, together with binutils-2.21 and newlib 1.19.0 . I've had two issues with newlib and I wanted to share the solutions with other newlib users.

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:

1) newlib-1.19.0/newlib/libc/reent/impure.c:28:48: error: _global_impure_ptr causes a section type conflict

2) /tmp/ccteCPAo.s:2630: Warning: setting incorrect section attributes for .sdata2

The problem lies in file newlib/libc/include/sys/config.h , this is the code:

/* For the PowerPC eabi, force the _impure_ptr to be in .sdata */
#if defined(__PPC__)
#if defined(_CALL_SYSV)
#define __ATTRIBUTE_IMPURE_PTR__ __attribute__((__section__(".sdata")))
#endif

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

Regards,
  R. Diez


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