[Xorp-hackers] Alignment problem in xrl_args.cc on xScale
Pavlin Radoslavov
pavlin at ICSI.Berkeley.EDU
Mon Oct 27 09:41:18 PDT 2008
Bruce M Simpson <bms at incunabulum.net> wrote:
> These two patches work for me to get libxipc built.
Both fixes seem the right thing to do, so please commit them.
What OS and gcc cross-compiler are you using?
I wonder why our periodic tinderbox cross-compilation for XScale
(and few other) didn't catch it (for XScale we are using
gcc-3.4.5).
Thanks,
Pavlin
> However, there's still an alignment problem with ArpHeader in packet.cc.
>
> Perhaps we should add a means of selectively disabling the alignment warnings
> (we use -Werror by default) until we can find and fix them where relevant.
> --- ./libxipc/xrl_args.cc.orig 2008-10-27 11:40:07.000000000 +0000
> +++ ./libxipc/xrl_args.cc 2008-10-27 11:41:22.000000000 +0000
> @@ -27,6 +27,8 @@
> #include "libxorp/xlog.h"
> #include "libxorp/debug.h"
>
> +#include "libproto/packet.hh"
> +
> #include <functional>
> #include <stdexcept>
>
> @@ -773,8 +775,7 @@
> if (len < 4)
> return 0;
>
> - uint32_t header = *(reinterpret_cast<const uint32_t*>(in));
> - header = ntohl(header);
> + uint32_t header = extract_32(in);
>
> // Check header sanity
> if ((header >> 24) != PACKING_CHECK_CODE)
>
> --- ./libxipc/xrl_atom.cc.orig 2008-10-27 11:41:32.000000000 +0000
> +++ ./libxipc/xrl_atom.cc 2008-10-27 11:42:10.000000000 +0000
> @@ -28,6 +28,8 @@
> #include "libxorp/c_format.hh"
> #include "libxorp/xlog.h"
>
> +#include "libproto/packet.hh"
> +
> #include <map>
> #include <string>
>
> @@ -1062,8 +1064,7 @@
> if (len < sizeof(tl))
> return 0;
>
> - tl = *(reinterpret_cast<const uint32_t*>(buf));
> - tl = ntohl(tl);
> + tl = extract_32(buf);
>
> buf += sizeof(tl);
> len -= sizeof(tl);
>
> _______________________________________________
> Xorp-hackers mailing list
> Xorp-hackers at icir.org
> http://mailman.ICSI.Berkeley.EDU/mailman/listinfo/xorp-hackers
More information about the Xorp-hackers
mailing list