[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [head tinderbox] failure on mips/mips
- To: xcllnt_(_at_)_mac_(_dot_)_com
- Subject: Re: [head tinderbox] failure on mips/mips
- From: "M. Warner Losh" <imp_(_at_)_bsdimp_(_dot_)_com>
- Date: Tue, 17 Feb 2009 23:42:16 -0700 (MST)
- Cc: mips_(_at_)_FreeBSD_(_dot_)_org, tinderbox_(_at_)_FreeBSD_(_dot_)_org, current_(_at_)_FreeBSD_(_dot_)_org
In message: <4CB77F1D-4235-47D8-B654-1C4F29B6C649_(_at_)_mac_(_dot_)_com>
Marcel Moolenaar <xcllnt_(_at_)_mac_(_dot_)_com> writes:
:
: On Feb 17, 2009, at 9:21 PM, M. Warner Losh wrote:
:
: > In message: <20090217_(_dot_)_203647_(_dot_)_-1518647466_(_dot_)_imp_(_at_)_bsdimp_(_dot_)_com>
: > "M. Warner Losh" <imp_(_at_)_bsdimp_(_dot_)_com> writes:
: > : In message: <20090218023328_(_dot_)_227617302F_(_at_)_freebsd-current_(_dot_)_sentex_(_dot_)_ca>
: > : FreeBSD Tinderbox <tinderbox_(_at_)_freebsd_(_dot_)_org> writes:
: > : : /src/usr.sbin/bsnmpd/modules/snmp_mibII/../../../../contrib/
: > bsnmp/snmp_mibII/mibII.c:1016: warning: cast increases required
: > alignment of target type
: > :
: > : there's still 3 or 4 of these in the tree that I'm trying to track
: > : back to root cause. A simple (void *) fixes the problem, but I want
: > : to understand the issues before I slap that bad-boy in there...
: >
: > The first one is:
: >
: > case RTM_IFINFO:
: > ifm = (struct if_msghdr *)rtm;
: > mib_extract_addrs(ifm->ifm_addrs, (u_char *)(ifm + 1), addrs);
: > if ((ifp = mib_find_if_sys(ifm->ifm_index)) == NULL)
: > break;
: >
: > rtm is of type struct rt_msghdr. This has an alignment requirement of
: > 4 on mips, at least on 32-bit mips (the biggest data element is a
: > u_long). struct if_msghdr has an alignment requirement of 8, because
: > time_t is int64_t on MIPS, which is 8-bytes in size.
:
: Normally on 32-bit architectures, 64-bit data types have a 32-bit
: alignment requirement by virtue of needing 2 32-bit loads/stores
: to read/write them. Does 32-bit MIPS use 64-bit wide registers?
MIPS isn't normal :). MIPS really is a 64-bit architecture. The only
way to make the warning go away would be to build -mmips32r2 or
something like that. But since we're going to be supporting n32 ABI
(which really is a 64-bit ABI despite its name) and n64, the issue
won't be going away. This is desirable for the Octeon support that I
hope to commit soon.
: > One way to fix this is to add __aligned(8) to struct rt_msghdr to
: > compensate for this. Otherwise, if the time_t element is referenced
: > in ifm_data we'll core dump.
:
: A safer approach is to mark ifi_epoch as packed or put differently,
: define time_t as a 64-bit integral with 32-bit alignment. This can
: avoid a lot of unexpected internal padding as well (e.g. struct
: timeval).
Marking it as packed won't help. If the elements aren't properly
aligned, gcc won't access multi-word entities properly. It might
eliminate the warning, but it will break at runtime.
Warner
_______________________________________________
freebsd-current_(_at_)_freebsd_(_dot_)_org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to "freebsd-current-unsubscribe_(_at_)_freebsd_(_dot_)_org"
Visit your host, monkey.org