[PATCH v2] Add i386 and x86_64 fenv support from Cygwin.

Joel Sherrill joel@rtems.org
Wed Sep 4 20:11:00 GMT 2019


Hi

I thought I was close to wrapping this up but I have run into a couple of issues
with this implementation being a single file and the stub being a collection
of files. After my most recent rebuild, I am getting linking conflicts because
the implementation doesn't override the stubs.

This means that each implementation needs to be multiple files with the
same names as the stub implementation. The riscv does this.but the x86
does not.

(1) Do you all agree that I need split the single fenv.c file into
multiple files?
Or should I provide empty versions of each file in libm/fenv so an
implementation
can be one file but just override the other files with common files. I
ask because
I suspect other architecture implementations will also be one file or inline the
implementation in sys/fenv.h. This would make it easy to merge those.

Suggestions?

(1a) If I do split, do I provide a file like fenvimpl.h for the constants at the
top of the file? And place it as a local file in libm/machine/i386 and x86_64?

(2) Independent of splitting the file, I noticed use_sse is used in multiple
methods but only set by _feinitialize(). I THINK the solution is to turn
use_sse into a method which dynamically checks the cpuid feature flag.
We can't rely on that always being called.

Thanks.

--joel

On Wed, Sep 4, 2019 at 1:03 PM Corinna Vinschen <vinschen@redhat.com> wrote:
>
> On Sep  4 12:14, Eric Blake wrote:
> > On 9/4/19 11:58 AM, Joel Sherrill wrote:
> >
> > >>>>> +++ b/newlib/libc/machine/x86_64/sys/fenv.h
> > >>>>> @@ -0,0 +1,170 @@
> > >>>>> +/*
> > >>>>> + * SPDX-License-Identifier: BSD-2-Clause
> > >>>>> + *
> > >>>>> + * Copyright (c) 2010-2019 Red Hat, Inc.
> > >>>>> + * All rights reserved.
> > >>>>> + *
> > >>>>> + * Redistribution and use in source and binary forms, with or without
> > >>>>> + * modification, are permitted provided that the following conditions
> > >>>>> + * are met:
> > >>>>> + * 1. Redistributions of source code must retain the above copyright
> > >>>>> + *    notice, this list of conditions and the following disclaimer.
> > >>>>> + * 2. Redistributions in binary form must reproduce the above copyright
> > >>>>> + *    notice, this list of conditions and the following disclaimer in the
> > >>>>> + *    documentation and/or other materials provided with the distribution.
> > >>>>> + *
> > >>>>> + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
> > >>>>> + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
> > >>>>> + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
> > >>>>> + * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
> > >>>>> + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
> > >>>>> + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
> > >>>>> + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
> > >>>>> + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
> >
> > >> I didn't actually check newlib files, but SPDX + written out license
> > >> only makes marginal sense.  So, let's start with *these* files to do it
> > >> right, please.
> > >
> > > SPDX line plus an organization copyright? Like this:
> > >
> > > /*
> > >  * SPDX-License-Identifier: BSD-2-Clause
> > >  *
> > >  * Copyright (c) 2010-2019 Red Hat, Inc.
> > >  * All rights reserved.
> > >  */
> > >
> >
> > It sounds funny to claim a license that grants rights to users, but yet
> > states "All rights reserved" that sounds like you are NOT granting
> > rights to others.  These days, it has lost all legal significance, and
> > is merely adding noise:
> > https://www.iusmentis.com/copyright/allrightsreserved/
> >
> > With BSD license, it is a historical accident of copy-and-paste; where
> > different upstream sources of the license differ on whether the phrase
> > is still part of the license:
> >
> > https://spdx.org/licenses/BSD-2-Clause.html
> > https://opensource.org/licenses/BSD-2-Clause
> >
> > Thus, I can overlook it for BSD files, but I hate seeing it on GPL
> > files, so I try to point it out whenever I notice it.
>
> I agree, skip the reserved bit, otherwise it's fine.
>
>
> Thanks,
> Corinna
>
> --
> Corinna Vinschen
> Cygwin Maintainer
> Red Hat



More information about the Newlib mailing list