[head tinderbox] failure on arm/arm
Ruslan Ermilov
ru at FreeBSD.org
Sun Nov 12 15:31:52 PST 2006
On Sun, Nov 12, 2006 at 04:05:39PM -0700, M. Warner Losh wrote:
> Yea, that's clearly bogus of it. It does this because it thinks that
> eh is going to be 4-byte aligned, which it isn't in this case. I
> think that we may need to change:
>
> /*
> * Structure of a 10Mb/s Ethernet header.
> */
> struct ether_header {
> u_char ether_dhost[ETHER_ADDR_LEN];
> u_char ether_shost[ETHER_ADDR_LEN];
> u_short ether_type;
> };
>
> to be
>
> struct ether_header {
> u_char ether_dhost[ETHER_ADDR_LEN];
> u_char ether_shost[ETHER_ADDR_LEN];
> u_short ether_type;
> } __packed;
>
> since that would fit.
>
"fit" == avoid 32-bit loads (I've similarly checked adding
__packed to "struct ar_hdr" here, and it indeed stops using
32-bit loads instructions now):
%%%
Index: ar.h
===================================================================
RCS file: /home/ncvs/src/include/ar.h,v
retrieving revision 1.1.1.1
diff -u -p -r1.1.1.1 ar.h
--- ar.h 24 May 1994 09:57:26 -0000 1.1.1.1
+++ ar.h 12 Nov 2006 23:26:38 -0000
@@ -44,6 +44,8 @@
#ifndef _AR_H_
#define _AR_H_
+#include <sys/cdefs.h>
+
/* Pre-4BSD archives had these magic numbers in them. */
#define OARMAG1 0177555
#define OARMAG2 0177545
@@ -62,6 +64,6 @@ struct ar_hdr {
char ar_size[10]; /* size in bytes */
#define ARFMAG "`\n"
char ar_fmag[2]; /* consistency check */
-};
+} __packed;
#endif /* !_AR_H_ */
%%%
> There's one caveat that I'd caution people about. NetBSD had lots of
> issues with gcc4 and packed when the struct doesn't need to be packed.
>
We don't have a lot of packed structs yet, and we should certainly
have more of them. :-)
Cheers,
--
Ruslan Ermilov
ru at FreeBSD.org
FreeBSD committer
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 187 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/freebsd-current/attachments/20061112/84bea037/attachment.pgp
More information about the freebsd-current
mailing list