* Avoid endian.h include in MIPS string functions
@ 2012-04-26 19:25 Joseph S. Myers
2012-04-28 10:42 ` Joseph S. Myers
2012-05-06 5:55 ` Maciej W. Rozycki
0 siblings, 2 replies; 5+ messages in thread
From: Joseph S. Myers @ 2012-04-26 19:25 UTC (permalink / raw)
To: libc-ports
Similar to a recent SH libc change, I've applied this patch to avoid MIPS
string .S functions including <endian.h> and getting errors from C source
code from that header.
diff --git a/ChangeLog.mips b/ChangeLog.mips
index 0b4a493..3d3678b 100644
--- a/ChangeLog.mips
+++ b/ChangeLog.mips
@@ -1,5 +1,9 @@
2012-04-26 Joseph Myers <joseph@codesourcery.com>
+ * sysdeps/mips/memcpy.S: Don't include <endian.h>. Test __MIPSEB
+ instead of __BYTE_ORDER.
+ * sysdeps/mips/memset.S: Likewise.
+
* sysdeps/unix/sysv/linux/mips/kernel_rt_sigframe.h (struct
kernel_rt_sigframe): Use siginfo_t instead of struct siginfo.
diff --git a/sysdeps/mips/memcpy.S b/sysdeps/mips/memcpy.S
index ec1b98a..753f67c 100644
--- a/sysdeps/mips/memcpy.S
+++ b/sysdeps/mips/memcpy.S
@@ -1,4 +1,4 @@
-/* Copyright (C) 2002, 2003 Free Software Foundation, Inc.
+/* Copyright (C) 2002-2012 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Hartvig Ekner <hartvige@mips.com>, 2002.
@@ -17,12 +17,11 @@
<http://www.gnu.org/licenses/>. */
#include <sysdep.h>
-#include <endian.h>
/* void *memcpy(void *s1, const void *s2, size_t n); */
-#if __BYTE_ORDER == __BIG_ENDIAN
+#if __MIPSEB
# define LWHI lwl /* high part is left in big-endian */
# define SWHI swl /* high part is left in big-endian */
# define LWLO lwr /* low part is right in big-endian */
diff --git a/sysdeps/mips/memset.S b/sysdeps/mips/memset.S
index 1df7981..30a0ba4 100644
--- a/sysdeps/mips/memset.S
+++ b/sysdeps/mips/memset.S
@@ -1,4 +1,4 @@
-/* Copyright (C) 2002, 2003 Free Software Foundation, Inc.
+/* Copyright (C) 2002-2012 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Hartvig Ekner <hartvige@mips.com>, 2002.
@@ -17,12 +17,11 @@
<http://www.gnu.org/licenses/>. */
#include <sysdep.h>
-#include <endian.h>
/* void *memset(void *s, int c, size_t n). */
-#if __BYTE_ORDER == __BIG_ENDIAN
+#if __MIPSEB
# define SWHI swl /* high part is left in big-endian */
#else
# define SWHI swr /* high part is right in little-endian */
--
Joseph S. Myers
joseph@codesourcery.com
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Avoid endian.h include in MIPS string functions
2012-04-26 19:25 Avoid endian.h include in MIPS string functions Joseph S. Myers
@ 2012-04-28 10:42 ` Joseph S. Myers
2012-05-06 5:55 ` Maciej W. Rozycki
1 sibling, 0 replies; 5+ messages in thread
From: Joseph S. Myers @ 2012-04-28 10:42 UTC (permalink / raw)
To: libc-ports
I've now applied a corresponding fix to the 64-bit versions as well.
diff --git a/ChangeLog.mips b/ChangeLog.mips
index 65ff19d..7b89f08 100644
--- a/ChangeLog.mips
+++ b/ChangeLog.mips
@@ -1,3 +1,9 @@
+2012-04-28 Joseph Myers <joseph@codesourcery.com>
+
+ * sysdeps/mips/mips64/memcpy.S: Don't include <endian.h>. Test
+ __MIPSEB instead of __BYTE_ORDER.
+ * sysdeps/mips/mips64/memset.S: Likewise.
+
2012-04-27 Joseph Myers <joseph@codesourcery.com>
* sysdeps/unix/sysv/linux/mips/configure.in (arch_minimum_kernel):
diff --git a/sysdeps/mips/mips64/memcpy.S b/sysdeps/mips/mips64/memcpy.S
index ae819f6..49ef34d 100644
--- a/sysdeps/mips/mips64/memcpy.S
+++ b/sysdeps/mips/mips64/memcpy.S
@@ -1,4 +1,4 @@
-/* Copyright (C) 2002, 2003 Free Software Foundation, Inc.
+/* Copyright (C) 2002-2012 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Hartvig Ekner <hartvige@mips.com>, 2002.
Ported to mips3 n32/n64 by Alexandre Oliva <aoliva@redhat.com>
@@ -18,7 +18,6 @@
<http://www.gnu.org/licenses/>. */
#include <sysdep.h>
-#include <endian.h>
#include <sys/asm.h>
@@ -26,7 +25,7 @@
This could probably be optimized further. */
-#if __BYTE_ORDER == __BIG_ENDIAN
+#if __MIPSEB
# define LDHI ldl /* high part is left in big-endian */
# define SDHI sdl /* high part is left in big-endian */
# define LDLO ldr /* low part is right in big-endian */
diff --git a/sysdeps/mips/mips64/memset.S b/sysdeps/mips/mips64/memset.S
index 9800ed3..a2f9120 100644
--- a/sysdeps/mips/mips64/memset.S
+++ b/sysdeps/mips/mips64/memset.S
@@ -1,4 +1,4 @@
-/* Copyright (C) 2002, 2003 Free Software Foundation, Inc.
+/* Copyright (C) 2002-2012 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Hartvig Ekner <hartvige@mips.com>, 2002.
Ported to mips3 n32/n64 by Alexandre Oliva <aoliva@redhat.com>
@@ -18,7 +18,6 @@
<http://www.gnu.org/licenses/>. */
#include <sysdep.h>
-#include <endian.h>
#include <sys/asm.h>
@@ -26,7 +25,7 @@
This could probably be optimized further. */
-#if __BYTE_ORDER == __BIG_ENDIAN
+#if __MIPSEB
# define SDHI sdl /* high part is left in big-endian */
#else
# define SDHI sdr /* high part is right in little-endian */
--
Joseph S. Myers
joseph@codesourcery.com
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Avoid endian.h include in MIPS string functions
2012-04-26 19:25 Avoid endian.h include in MIPS string functions Joseph S. Myers
2012-04-28 10:42 ` Joseph S. Myers
@ 2012-05-06 5:55 ` Maciej W. Rozycki
2012-05-06 6:28 ` Mike Frysinger
1 sibling, 1 reply; 5+ messages in thread
From: Maciej W. Rozycki @ 2012-05-06 5:55 UTC (permalink / raw)
To: Joseph S. Myers; +Cc: libc-ports
On Thu, 26 Apr 2012, Joseph S. Myers wrote:
> Similar to a recent SH libc change, I've applied this patch to avoid MIPS
> string .S functions including <endian.h> and getting errors from C source
> code from that header.
Hmm, <endian.h> is a user header and I could imagine software to rely on
it even in handcoded assembly. And it used to work just fine. Are you
sure the problematic stuff in <endian.h> or pulled by it shouldn't be
wrapped into:
#ifndef __ASSEMBLER__
or suchlike instead?
Maciej
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Avoid endian.h include in MIPS string functions
2012-05-06 5:55 ` Maciej W. Rozycki
@ 2012-05-06 6:28 ` Mike Frysinger
2012-05-19 18:33 ` Maciej W. Rozycki
0 siblings, 1 reply; 5+ messages in thread
From: Mike Frysinger @ 2012-05-06 6:28 UTC (permalink / raw)
To: libc-ports; +Cc: Maciej W. Rozycki, Joseph S. Myers
[-- Attachment #1: Type: Text/Plain, Size: 719 bytes --]
On Sunday 06 May 2012 01:55:04 Maciej W. Rozycki wrote:
> On Thu, 26 Apr 2012, Joseph S. Myers wrote:
> > Similar to a recent SH libc change, I've applied this patch to avoid MIPS
> > string .S functions including <endian.h> and getting errors from C source
> > code from that header.
>
> Hmm, <endian.h> is a user header and I could imagine software to rely on
> it even in handcoded assembly. And it used to work just fine. Are you
> sure the problematic stuff in <endian.h> or pulled by it shouldn't be
> wrapped into:
>
> #ifndef __ASSEMBLER__
>
> or suchlike instead?
a patch was posted to do that, but no one responded :/
http://sourceware.org/ml/libc-alpha/2012-04/msg01141.html
-mike
[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 836 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Avoid endian.h include in MIPS string functions
2012-05-06 6:28 ` Mike Frysinger
@ 2012-05-19 18:33 ` Maciej W. Rozycki
0 siblings, 0 replies; 5+ messages in thread
From: Maciej W. Rozycki @ 2012-05-19 18:33 UTC (permalink / raw)
To: Mike Frysinger; +Cc: libc-ports, Joseph S. Myers
On Sun, 6 May 2012, Mike Frysinger wrote:
> On Sunday 06 May 2012 01:55:04 Maciej W. Rozycki wrote:
> > On Thu, 26 Apr 2012, Joseph S. Myers wrote:
> > > Similar to a recent SH libc change, I've applied this patch to avoid MIPS
> > > string .S functions including <endian.h> and getting errors from C source
> > > code from that header.
> >
> > Hmm, <endian.h> is a user header and I could imagine software to rely on
> > it even in handcoded assembly. And it used to work just fine. Are you
> > sure the problematic stuff in <endian.h> or pulled by it shouldn't be
> > wrapped into:
> >
> > #ifndef __ASSEMBLER__
> >
> > or suchlike instead?
>
> a patch was posted to do that, but no one responded :/
>
> http://sourceware.org/ml/libc-alpha/2012-04/msg01141.html
So I've had a more thorough look into it and it seems the breakage is
inherited from BSD compatibility and <endian.h> is still usable from
assembly sources unless __USE_BSD is in effect -- i.e. _BSD_SOURCE or
_GNU_SOURCE, etc. -- and we build with _GNU_SOURCE so we are hit by this
problem. I find it odd that defining _GNU_SOURCE regresses functionality,
but given the maintainers do not bother, I guess it'll have to stay.
__ASSEMBLER__ is a standard GCC's cpp macro, even documented in the cpp
manual, and I don't think our library supports any non-GCC systems these
days anymore, so I don't really get what might be wrong with using that to
guard headers.
Maciej
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2012-05-19 18:33 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-04-26 19:25 Avoid endian.h include in MIPS string functions Joseph S. Myers
2012-04-28 10:42 ` Joseph S. Myers
2012-05-06 5:55 ` Maciej W. Rozycki
2012-05-06 6:28 ` Mike Frysinger
2012-05-19 18:33 ` Maciej W. Rozycki
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).