Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Kim Kulak <kim@kulak.ca>
To: buildroot@busybox.net
Subject: [Buildroot] Busybox & Gcc
Date: Thu Jul 27 21:52:16 2006	[thread overview]
Message-ID: <44C989A9.5070103@kulak.ca> (raw)
In-Reply-To: <20060727184451.GA13078@reid1.localdomain>

don wrote:
> I am trying to compile busybox.  It is full of code which the newer
> gcc's don't like.  For example:
> 
> /home/don/Robots/Bot1/EPIA/buildroot/build_i486/busybox/modutils/lsmod.c: In function `lsmod_main':/home/don/Robots/Bot1/EPIA/buildroot/build_i486/busybox/modutils/lsmod.c:96:
> warning: dereferencing type-punned pointer will break strict-aliasing rules
> /home/don/Robots/Bot1/EPIA/buildroot/build_i486/busybox/modutils/lsmod.c:114:
> warning: dereferencing type-punned pointer will break strict-aliasing rules
> make[2]: *** [/home/don/Robots/Bot1/EPIA/buildroot/build_i486/busybox/modutils/lsmod.o] Error 1
> make[1]: *** [_all] Error 2
> make: *** [/home/don/Robots/Bot1/EPIA/buildroot/build_i486/busybox/busybox] Error 2

I had a problem with that too. Here are some patches:

diff -urN build_orig/busybox/modutils/insmod.c
build_i586/busybox/modutils/insmod.c
--- build_orig/busybox/modutils/insmod.c	2006-07-24 20:21:51.000000000 -0700
+++ build_i586/busybox/modutils/insmod.c	2006-07-25 19:50:45.000000000 -0700
@@ -349,7 +349,6 @@
 #ifndef MODUTILS_MODULE_H
 /* Why? static const int MODUTILS_MODULE_H = 1;*/

-#ident "$Id: insmod.c,v 1.126 2004/12/26 09:13:32 vapier Exp $"

 /*======================================================================*/
 /* For sizeof() which are related to the module platform and not to the
@@ -512,7 +511,6 @@
 #ifndef MODUTILS_OBJ_H
 /* Why? static const int MODUTILS_OBJ_H = 1; */

-#ident "$Id: insmod.c,v 1.126 2004/12/26 09:13:32 vapier Exp $"

 /* The relocatable object is manipulated using elfin types.  */

diff -urN build_orig/busybox/modutils/lsmod.c
build_i586/busybox/modutils/lsmod.c
--- build_orig/busybox/modutils/lsmod.c	2006-07-24 20:23:22.000000000 -0700
+++ build_i586/busybox/modutils/lsmod.c	2006-07-25 19:52:03.000000000 -0700
@@ -89,20 +89,25 @@
 int lsmod_main(int argc, char **argv)
 {
 	struct module_info info;
-	char *module_names, *mn, *deps, *dn;
+    union
+       {
+          char *buf;
+          void *ptr;
+       } module_names, deps;
+	char *mn, *dn;
 	size_t bufsize, depsize, nmod, count, i, j;

-	module_names = xmalloc(bufsize = 256);
-	if (my_query_module(NULL, QM_MODULES, (void **)&module_names, &bufsize,
+	module_names.buf = xmalloc(bufsize = 256);
+	if (my_query_module(NULL, QM_MODULES, (void **)&module_names.ptr,
&bufsize,
 				&nmod)) {
 		bb_perror_msg_and_die("QM_MODULES");
 	}

-	deps = xmalloc(depsize = 256);
+	deps.buf = xmalloc(depsize = 256);
 	printf("Module                  Size  Used by");
 	check_tainted();

-	for (i = 0, mn = module_names; i < nmod; mn += strlen(mn) + 1, i++) {
+	for (i = 0, mn = module_names.buf; i < nmod; mn += strlen(mn) + 1, i++) {
 		if (query_module(mn, QM_INFO, &info, sizeof(info), &count)) {
 			if (errno == ENOENT) {
 				/* The module was removed out from underneath us. */
@@ -111,7 +116,7 @@
 			/* else choke */
 			bb_perror_msg_and_die("module %s: QM_INFO", mn);
 		}
-		if (my_query_module(mn, QM_REFS, (void **)&deps, &depsize, &count)) {
+		if (my_query_module(mn, QM_REFS, (void **)&deps.ptr, &depsize, &count)) {
 			if (errno == ENOENT) {
 				/* The module was removed out from underneath us. */
 				continue;
@@ -132,7 +137,7 @@
 				printf(" (unused)");
 		}
 		if (count) printf(" [");
-		for (j = 0, dn = deps; j < count; dn += strlen(dn) + 1, j++) {
+		for (j = 0, dn = deps.buf; j < count; dn += strlen(dn) + 1, j++) {
 			printf("%s%s", dn, (j==count-1)? "":" ");
 		}
 		if (count) printf("]");
diff -urN build_orig/busybox/modutils/rmmod.c
build_i586/busybox/modutils/rmmod.c
--- build_orig/busybox/modutils/rmmod.c	2006-07-24 21:09:34.000000000 -0700
+++ build_i586/busybox/modutils/rmmod.c	2006-07-25 19:52:37.000000000 -0700
@@ -50,6 +50,7 @@
 	/* bb_common_bufsiz1 hold the module names which we ignore
 	   but must get */
 	size_t bufsize = sizeof(bb_common_bufsiz1);
+    void *bufptr = (void *)bb_common_bufsiz1;
 #endif

 	/* Parse command line. */
@@ -73,7 +74,7 @@
 			pnmod = nmod;
 #ifdef CONFIG_FEATURE_QUERY_MODULE_INTERFACE
 			/* 1 == QM_MODULES */
-			if (my_query_module(NULL, 1, &bb_common_bufsiz1, &bufsize, &nmod)) {
+			if (my_query_module(NULL, 1, &bufptr, &bufsize, &nmod)) {
 				bb_perror_msg_and_die("QM_MODULES");
 			}
 #endif
diff -urN build_orig/busybox/networking/ping.c
build_i586/busybox/networking/ping.c
--- build_orig/busybox/networking/ping.c	2006-07-24 21:28:10.000000000 -0700
+++ build_i586/busybox/networking/ping.c	2006-07-25 19:53:41.000000000 -0700
@@ -211,7 +211,7 @@
 	pkt->icmp_type = ICMP_ECHO;
 	pkt->icmp_code = 0;
 	pkt->icmp_cksum = 0;
-	pkt->icmp_seq = htons(ntransmitted++);
+	pkt->icmp_seq = htons(ntransmitted); ntransmitted += 1;
 	pkt->icmp_id = myid;
 	CLR(ntohs(pkt->icmp_seq) % MAX_DUP_CHK);


Busybox built clean after this for me with gcc 3.4.2.

Kim

  reply	other threads:[~2006-07-27 21:52 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-07-27 11:50 [Buildroot] Busybox & Gcc don
2006-07-27 21:52 ` Kim Kulak [this message]
2006-08-01  0:35   ` Rob Landley
  -- strict thread matches above, loose matches on Subject: below --
2006-07-27 12:46 Drew Cohan

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=44C989A9.5070103@kulak.ca \
    --to=kim@kulak.ca \
    --cc=buildroot@busybox.net \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox