* [PATCH] Fix some i386 vs. x86_64 -m32 glibc header differences
@ 2004-11-01 14:06 Jakub Jelinek
2004-11-04 23:47 ` Roland McGrath
0 siblings, 1 reply; 2+ messages in thread
From: Jakub Jelinek @ 2004-11-01 14:06 UTC (permalink / raw)
To: Ulrich Drepper; +Cc: Glibc hackers
Hi!
Other differences than the ones fixed here are e.g.:
1) missing sys/elf.h on x86_64 - it is a deprecated header, so probably not
a big deal, though not hard to add
2) missing sys/vm86.h on x86_64 - vm86 doesn't work on x86-64 64-bit kernel
even for 32-bit programs AFAIK, so again not a big deal
3) gnu/lib-names.h, gnu/stubs.h - hard to fix
4) bits/wchar.h - not sure why __WCHAR_M{IN,AX} on i386 are long constants
and int elsewhere, doesn't match what arches have unsigned long wchar_t
and which have unsigned int wchar_t
5) bits/mathinline.h, bits/string.h
6) bits/byteswap.h - no support for !__GNUC__ compilers on x86_64 -m32
2004-11-01 Jakub Jelinek <jakub@redhat.com>
* sysdeps/unix/sysv/linux/x86_64/sys/procfs.h [__WORDSIZE == 32]
(elf_fpxregset_t): New type.
(struct elf_prpsinfo): If __WORDSIZE == 32, change pr_[ug]id type
to unsigned short int.
* sysdeps/unix/sysv/linux/x86_64/sys/user.h
(struct user_fpregs_struct): Fix comment.
* sysdeps/i386/fpu/bits/mathdef.h (float_t, double_t): If
__FLOAT_EVAL_METHOD__ is defined and 0, typedef to float resp. double.
* sysdeps/x86_64/fpu/bits/mathdef.h: Include bits/wordsize.h.
(float_t, double_t): If -m32 and not -mfpmath=sse, typedef to
long double.
* sysdeps/x86_64/fpu/bits/fenv.h: Include bits/wordsize.h.
(fenv_t): Remove __mxcsr field for -m32.
--- libc/sysdeps/unix/sysv/linux/x86_64/sys/procfs.h.jj 2001-09-19 12:30:49.000000000 +0200
+++ libc/sysdeps/unix/sysv/linux/x86_64/sys/procfs.h 2004-11-01 14:19:31.658005034 +0100
@@ -1,4 +1,4 @@
-/* Copyright (C) 2001 Free Software Foundation, Inc.
+/* Copyright (C) 2001, 2004 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -45,10 +45,20 @@ typedef unsigned long elf_greg_t;
#define ELF_NGREG (sizeof (struct user_regs_struct) / sizeof(elf_greg_t))
typedef elf_greg_t elf_gregset_t[ELF_NGREG];
+#if __WORDSIZE == 32
+/* Register set for the floating-point registers. */
+typedef struct user_fpregs_struct elf_fpregset_t;
+
+/* Register set for the extended floating-point registers. Includes
+ the Pentium III SSE registers in addition to the classic
+ floating-point stuff. */
+typedef struct user_fpxregs_struct elf_fpxregset_t;
+#else
/* Register set for the extended floating-point registers. Includes
the Pentium III SSE registers in addition to the classic
floating-point stuff. */
typedef struct user_fpregs_struct elf_fpregset_t;
+#endif
/* Signal info. */
struct elf_siginfo
@@ -94,8 +104,13 @@ struct elf_prpsinfo
char pr_zomb; /* Zombie. */
char pr_nice; /* Nice val. */
unsigned long int pr_flag; /* Flags. */
+#if __WORDSIZE == 32
+ unsigned short int pr_uid;
+ unsigned short int pr_gid;
+#else
unsigned int pr_uid;
unsigned int pr_gid;
+#endif
int pr_pid, pr_ppid, pr_pgrp, pr_sid;
/* Lots missing */
char pr_fname[16]; /* Filename of executable. */
--- libc/sysdeps/unix/sysv/linux/x86_64/sys/user.h.jj 2002-03-22 13:16:57.000000000 +0100
+++ libc/sysdeps/unix/sysv/linux/x86_64/sys/user.h 2004-11-01 14:22:35.650336103 +0100
@@ -1,4 +1,4 @@
-/* Copyright (C) 2001, 2002 Free Software Foundation, Inc.
+/* Copyright (C) 2001, 2002, 2004 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -38,7 +38,7 @@ struct user_fpregs_struct
__uint32_t mxcsr;
__uint32_t mxcr_mask;
__uint32_t st_space[32]; /* 8*16 bytes for each FP-reg = 128 bytes */
- __uint32_t xmm_space[64]; /* 16*16 bytes for each XMM-reg = 128 bytes */
+ __uint32_t xmm_space[64]; /* 16*16 bytes for each XMM-reg = 256 bytes */
__uint32_t padding[24];
};
--- libc/sysdeps/i386/fpu/bits/mathdef.h.jj 2004-03-16 13:30:07.000000000 +0100
+++ libc/sysdeps/i386/fpu/bits/mathdef.h 2004-11-01 14:04:50.063530247 +0100
@@ -23,6 +23,13 @@
#if defined __USE_ISOC99 && defined _MATH_H && !defined _MATH_H_MATHDEF
# define _MATH_H_MATHDEF 1
+# if defined __FLT_EVAL_METHOD__ && __FLT_EVAL_METHOD__ == 0
+/* When using -mfpmath=sse, values are computed with the precission of the
+ used type. */
+typedef float float_t; /* `float' expressions are evaluated as `float'. */
+typedef double double_t; /* `double' expressions are evaluated as
+ `double'. */
+# else
/* The ix87 FPUs evaluate all values in the 80 bit floating-point format
which is also available for the user as `long double'. Therefore we
define: */
@@ -30,6 +37,7 @@ typedef long double float_t; /* `float'
`long double'. */
typedef long double double_t; /* `double' expressions are evaluated as
`long double'. */
+# endif
/* The values returned by `ilogb' for 0 and NaN respectively. */
# define FP_ILOGB0 (-2147483647 - 1)
--- libc/sysdeps/x86_64/fpu/bits/fenv.h.jj 2001-09-19 12:22:08.000000000 +0200
+++ libc/sysdeps/x86_64/fpu/bits/fenv.h 2004-11-01 13:53:25.033232033 +0100
@@ -1,4 +1,4 @@
-/* Copyright (C) 1997,1998,1999,2000,2001 Free Software Foundation, Inc.
+/* Copyright (C) 1997,1998,1999,2000,2001,2004 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -20,6 +20,8 @@
# error "Never use <bits/fenv.h> directly; include <fenv.h> instead."
#endif
+#include <bits/wordsize.h>
+
/* Define bits representing the exception. We use the bit positions
of the appropriate bits in the FPU control word. */
@@ -80,7 +82,9 @@ typedef struct
unsigned int __data_offset;
unsigned short int __data_selector;
unsigned short int __unused5;
+#if __WORDSIZE == 64
unsigned int __mxcsr;
+#endif
}
fenv_t;
--- libc/sysdeps/x86_64/fpu/bits/mathdef.h.jj 2004-03-16 13:30:16.000000000 +0100
+++ libc/sysdeps/x86_64/fpu/bits/mathdef.h 2004-11-01 14:05:49.467976050 +0100
@@ -23,11 +23,23 @@
#if defined __USE_ISOC99 && defined _MATH_H && !defined _MATH_H_MATHDEF
# define _MATH_H_MATHDEF 1
+# include <bits/wordsize.h>
+
+# if __WORDSIZE == 64 || (defined __FLT_EVAL_METHOD__ && __FLT_EVAL_METHOD__ == 0)
/* The x86-64 architecture computes values with the precission of the
- used type. */
+ used type. Similarly for -m32 -mfpmath=sse. */
typedef float float_t; /* `float' expressions are evaluated as `float'. */
typedef double double_t; /* `double' expressions are evaluated
as `double'. */
+# else
+/* The ix87 FPUs evaluate all values in the 80 bit floating-point format
+ which is also available for the user as `long double'. Therefore we
+ define: */
+typedef long double float_t; /* `float' expressions are evaluated as
+ `long double'. */
+typedef long double double_t; /* `double' expressions are evaluated as
+ `long double'. */
+# endif
/* The values returned by `ilogb' for 0 and NaN respectively. */
# define FP_ILOGB0 (-2147483647 - 1)
Jakub
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] Fix some i386 vs. x86_64 -m32 glibc header differences
2004-11-01 14:06 [PATCH] Fix some i386 vs. x86_64 -m32 glibc header differences Jakub Jelinek
@ 2004-11-04 23:47 ` Roland McGrath
0 siblings, 0 replies; 2+ messages in thread
From: Roland McGrath @ 2004-11-04 23:47 UTC (permalink / raw)
To: Jakub Jelinek; +Cc: Ulrich Drepper, Glibc hackers
> 2004-11-01 Jakub Jelinek <jakub@redhat.com>
>
> * sysdeps/unix/sysv/linux/x86_64/sys/procfs.h [__WORDSIZE == 32]
> (elf_fpxregset_t): New type.
> (struct elf_prpsinfo): If __WORDSIZE == 32, change pr_[ug]id type
> to unsigned short int.
> * sysdeps/unix/sysv/linux/x86_64/sys/user.h
> (struct user_fpregs_struct): Fix comment.
> * sysdeps/i386/fpu/bits/mathdef.h (float_t, double_t): If
> __FLOAT_EVAL_METHOD__ is defined and 0, typedef to float resp. double.
> * sysdeps/x86_64/fpu/bits/mathdef.h: Include bits/wordsize.h.
> (float_t, double_t): If -m32 and not -mfpmath=sse, typedef to
> long double.
> * sysdeps/x86_64/fpu/bits/fenv.h: Include bits/wordsize.h.
> (fenv_t): Remove __mxcsr field for -m32.
I've put these in.
> 1) missing sys/elf.h on x86_64 - it is a deprecated header, so probably not
> a big deal, though not hard to add
If anyone actually uses this despite the #warning, then it probably ought
to just move up to linux/ and be installed for compatibility on all machines.
OTOH, forcing people to use sys/procfs.h instead is not a bad thing.
> 2) missing sys/vm86.h on x86_64 - vm86 doesn't work on x86-64 64-bit kernel
> even for 32-bit programs AFAIK, so again not a big deal
Perhaps programs would prefer to diagnose this at runtime than be uncompilable.
But let's wait for a complaint.
> 3) gnu/lib-names.h, gnu/stubs.h - hard to fix
gnu/stubs.h is pretty hard to fix. What are the differences?
gnu/lib-names.h is less hard. I can make it dtrt if it's worth the trouble.
> 4) bits/wchar.h - not sure why __WCHAR_M{IN,AX} on i386 are long constants
> and int elsewhere, doesn't match what arches have unsigned long wchar_t
> and which have unsigned int wchar_t
> 5) bits/mathinline.h, bits/string.h
Are these unusable in -m32, or just differ? These already differ for other
ABI-compatible differing configurations (i386 vs i486, etc). So if these
under -m32 just define the versions that work in 32-bit mode but are
optimized for AMD64 or EM64T processors, this is fine as is.
> 6) bits/byteswap.h - no support for !__GNUC__ compilers on x86_64 -m32
We don't care about non-GCC. But I would put in a patch if one were sent.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2004-11-04 23:47 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-11-01 14:06 [PATCH] Fix some i386 vs. x86_64 -m32 glibc header differences Jakub Jelinek
2004-11-04 23:47 ` Roland McGrath
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).