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] SPU use a 16 byte fpos_t


Patrick Mansfield wrote:
On Thu, Sep 06, 2007 at 05:20:59PM -0400, Jeff Johnston wrote:
Patrick Mansfield wrote:
fpos_t is 12 bytes for 32 bit ppc glibc, and 16 bytes for 64 bit.

Currently SPU newlib uses 4 bytes for fpos_t. This is always a problem
with 64 bit ppc, since the fgetpos() assist call writes 8 bytes back for
the offset, and is a potential problem with 32 bit ppc.

So for SPU always use 16 bytes for fpos_t and also make currently unused
(in SPU) _fpos64_t 16 bytes.

Patrick,

This needs to be cleaned up. Not your fault, but I don't want cpu checks in sys/reent.h and I don't think that _fpos_t should be magically defined in sys/reent.h. The following proposal makes this change and others easy for you to do. It is pretty straightforward.

So, this is what I propose:

  1. copy machine/_types.h to machine/_default_types.h
  2. make machine/_types.h simply include machine/_default_types.h
  3. have sys/_types.h include machine/_types.h
  4. have sys/_types.h look for flags before defining _ types.  For
     example, #ifndef _OFF_T_DEFINED).  You need to add
     _fpos_t and  _fpos64_t default defs which weren't there previously
  5. create an machine/spu/machine/_types.h which defines all of these
     to your liking...also set the flags on so sys/_types.h won't try
     and define them
  6. remove _fpos_t and _fpos64_t defs from sys/reent.h

  This will be clean and allow other platforms to do tweaking as
desired without cluttering up the common headers.

Comments?

I'm trying this, but machine/spu/machine/_types.h is not being used - at least it is not installed, full path is newlib/libc/include/machine/spu/machine/_types.h.

Do I need a configuration change too, or did you mean a different path?

And machine/spu/machine/_types.h would replace (and so has to supply
everything included by) machine/_types.h ?

-- Patrick Mansfield
I meant libc/machine/spu/machine/_types.h (i.e. not in the libc/include directory). There is code in Makefile.am that will take header files from libc/machine/xxxx/machine and put them in the include/machine directory. This is how platforms override whatever headers they want to.

Regarding the override: The reason I had you create a _default_types.h file is so any machine-specific _types.h could start with #include <machine/_default_types.h> and so there is no need to copy the current file over.

-- Jeff J.


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