Skip to content

Commit

Permalink
Merge branch 'git-for-windows:main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
chirpnot authored Mar 10, 2022
2 parents d3507f2 + 9f15ca2 commit 34ecb7c
Show file tree
Hide file tree
Showing 26 changed files with 1,583 additions and 977 deletions.
11 changes: 11 additions & 0 deletions newlib/libc/posix/posix_spawn.c
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,17 @@ typedef struct __posix_spawn_file_actions_entry {
* Spawn routines
*/

#if defined (__CYGWIN__) && defined (__i386__)
extern int getgid32 (void);
extern int getuid32 (void);
extern int setegid32 (gid_t egid);
extern int seteuid32 (uid_t euid);
#define setegid setegid32
#define seteuid seteuid32
#define getgid getgid32
#define getuid getuid32
#endif

static int
process_spawnattr(const posix_spawnattr_t sa)
{
Expand Down
54 changes: 42 additions & 12 deletions newlib/libm/common/frexpl.c
Original file line number Diff line number Diff line change
Expand Up @@ -33,16 +33,42 @@ POSSIBILITY OF SUCH DAMAGE.
#include "local.h"

/* On platforms where long double is as wide as double. */
#if defined(_LDBL_EQ_DBL) || (LDBL_MANT_DIG == 53 && LDBL_MAX_EXP == 1024)
#if defined(_LDBL_EQ_DBL)
long double
frexpl (long double x, int *eptr)
{
return frexp(x, eptr);
}
#endif
#else /* !_DBL_EQ_DBL */
# if (LDBL_MANT_DIG == 53) /* 64-bit long double */
static const double scale = 0x1p54;

union ldbl {
long double x;
struct {
# ifdef __IEEE_LITTLE_ENDIAN /* for Intel CPU */
__uint32_t fracl;
__uint32_t frach:20;
__uint32_t exp:11;
__uint32_t sign:1;
# endif
# ifdef __IEEE_BIG_ENDIAN
__uint32_t sign:1;
__uint32_t exp:11;
__uint32_t frach:20;
# ifndef ___IEEE_BYTES_LITTLE_ENDIAN
# else /* ARMEL without __VFP_FP__ */
__uint32_t frach:20;
__uint32_t exp:11;
__uint32_t sign:1;
# endif
__uint32_t fracl;
# endif
} u32;
};
# elif (LDBL_MANT_DIG == 64) /* 80-bit long double */
static const double scale = 0x1p65;

#if (LDBL_MANT_DIG == 64 || LDBL_MANT_DIG == 113) && LDBL_MAX_EXP == 16384
# if (LDBL_MANT_DIG == 64) /* 80-bit long double */
union ldbl {
long double x;
struct {
Expand All @@ -68,7 +94,9 @@ union ldbl {
# endif
} u32;
};
# else /* LDBL_MANT_DIG == 113, 128-bit long double */
# elif (LDBL_MANT_DIG == 113) /* 128-bit long double */
static const double scale = 0x1p114;

union ldbl {
long double x;
struct {
Expand Down Expand Up @@ -96,9 +124,11 @@ union ldbl {
# endif
} u32;
};
# else
# error Unsupported long double format.
# endif

static const double two114 = 0x1p114;
static const int scale_exp = LDBL_MANT_DIG + 1;

long double
frexpl (long double x, int *eptr)
Expand All @@ -107,16 +137,16 @@ frexpl (long double x, int *eptr)
u.x = x;
int e = u.u32.exp;
*eptr = 0;
if (e == 0x7fff || x == 0)
if (e == (LDBL_MAX_EXP*2 - 1) || x == 0)
return x; /* inf,nan,0 */
if (e == 0) /* subnormal */
{
u.x *= two114;
u.x *= scale;
e = u.u32.exp;
*eptr -= 114;
*eptr -= scale_exp;
}
*eptr += e - 16382;
u.u32.exp = 0x3ffe; /* 0 */
*eptr += e - (LDBL_MAX_EXP - 2);
u.u32.exp = LDBL_MAX_EXP - 2; /* -1 */
return u.x;
}
#endif /* End of 80-bit or 128-bit long double */
#endif /* !_LDBL_EQ_DBL */
4 changes: 3 additions & 1 deletion winsup/cygwin/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,7 @@ DLL_FILES= \
fhandler_console.cc \
fhandler_cygdrive.cc \
fhandler_dev.cc \
fhandler_dev_fd.cc \
fhandler_disk_file.cc \
fhandler_dsp.cc \
fhandler_fifo.cc \
Expand Down Expand Up @@ -624,7 +625,8 @@ $(LDSCRIPT): $(LDSCRIPT).in
$(CC) -E - -P < $^ -o $@

# msys-2.0 dll
$(TEST_DLL_NAME): $(LDSCRIPT) dllfixdbg libdll.a $(VERSION_OFILES) $(LIBSERVER)
$(TEST_DLL_NAME): $(LDSCRIPT) dllfixdbg libdll.a $(VERSION_OFILES) $(LIBSERVER)\
$(newlib_build)/libm/libm.a $(newlib_build)/libc/libc.a
$(CXX) $(CXXFLAGS) \
-mno-use-libstdc-wrappers \
-Wl,--gc-sections -nostdlib -Wl,-T$(LDSCRIPT) -static \
Expand Down
Loading

0 comments on commit 34ecb7c

Please sign in to comment.