From: Keith M Wesolowski <wesolows@foobazco.org>
To: ralf@linux-mips.org
Cc: linux-mips@linux-mips.org
Subject: PATCH: avoid glibc conflict
Date: Wed, 27 Aug 2003 21:31:12 -0700 [thread overview]
Message-ID: <20030828043112.GA11094@foobazco.org> (raw)
This is needed to avoid a conflict with glibc on bigendian platforms
when -O or higher is specified. It's already in 2.6, and I'm not sure
why it hasn't been seen in 2.4. The symptom is that this program will
not compile with -O2:
#include <asm/byteorder.h>
#include <netinet/in.h>
int main () { }
Here's the patch.
--- linux/include/linux/byteorder/generic.h.orig 2003-08-10 18:15:07.000000000 -0700
+++ linux/include/linux/byteorder/generic.h 2003-08-10 18:16:36.000000000 -0700
@@ -122,7 +122,7 @@
#define be16_to_cpus __be16_to_cpus
#endif
-
+#if defined(__KERNEL__)
/*
* Handle ntohl and suches. These have various compatibility
* issues - like we want to give the prototype even though we
@@ -146,35 +146,26 @@
* Do the prototypes. Somebody might want to take the
* address or some such sick thing..
*/
-#if defined(__KERNEL__) || (defined (__GLIBC__) && __GLIBC__ >= 2)
extern __u32 ntohl(__u32);
extern __u32 htonl(__u32);
-#else
-extern unsigned long int ntohl(unsigned long int);
-extern unsigned long int htonl(unsigned long int);
-#endif
extern unsigned short int ntohs(unsigned short int);
extern unsigned short int htons(unsigned short int);
-
-#if defined(__GNUC__) && (__GNUC__ >= 2) && defined(__OPTIMIZE__) && !defined(__STRICT_ANSI__)
+#if defined(__GNUC__) && defined(__OPTIMIZE__)
#define ___htonl(x) __cpu_to_be32(x)
#define ___htons(x) __cpu_to_be16(x)
#define ___ntohl(x) __be32_to_cpu(x)
#define ___ntohs(x) __be16_to_cpu(x)
-#if defined(__KERNEL__) || (defined (__GLIBC__) && __GLIBC__ >= 2)
#define htonl(x) ___htonl(x)
#define ntohl(x) ___ntohl(x)
-#else
-#define htonl(x) ((unsigned long)___htonl(x))
-#define ntohl(x) ((unsigned long)___ntohl(x))
-#endif
#define htons(x) ___htons(x)
#define ntohs(x) ___ntohs(x)
#endif /* OPTIMIZE */
+#endif /* KERNEL */
+
#endif /* _LINUX_BYTEORDER_GENERIC_H */
--
Keith M Wesolowski <wesolows@foobazco.org> http://foobazco.org/~wesolows
------(( Project Foobazco Coordinator and Network Administrator ))------
"May Buddha bless all stubborn people!"
-- Uliassutai Karakorum Blake
next reply other threads:[~2003-08-28 4:31 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-08-28 4:31 Keith M Wesolowski [this message]
2003-09-09 11:30 ` PATCH: avoid glibc conflict Ralf Baechle
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20030828043112.GA11094@foobazco.org \
--to=wesolows@foobazco.org \
--cc=linux-mips@linux-mips.org \
--cc=ralf@linux-mips.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.