From owner-freebsd-sparc64@FreeBSD.ORG Sun Aug 28 22:27:02 2011 Return-Path: Delivered-To: freebsd-sparc64@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 21656106566B for ; Sun, 28 Aug 2011 22:27:02 +0000 (UTC) (envelope-from marius@alchemy.franken.de) Received: from alchemy.franken.de (alchemy.franken.de [194.94.249.214]) by mx1.freebsd.org (Postfix) with ESMTP id AD91F8FC0C for ; Sun, 28 Aug 2011 22:27:01 +0000 (UTC) Received: from alchemy.franken.de (localhost [127.0.0.1]) by alchemy.franken.de (8.14.4/8.14.4/ALCHEMY.FRANKEN.DE) with ESMTP id p7SMQwNb009763; Mon, 29 Aug 2011 00:26:58 +0200 (CEST) (envelope-from marius@alchemy.franken.de) Received: (from marius@localhost) by alchemy.franken.de (8.14.4/8.14.4/Submit) id p7SMQwcg009762; Mon, 29 Aug 2011 00:26:58 +0200 (CEST) (envelope-from marius) Date: Mon, 29 Aug 2011 00:26:58 +0200 From: Marius Strobl To: Olivier Cochard-Labb? Message-ID: <20110828222658.GA9698@alchemy.franken.de> References: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.4.2.3i Cc: freebsd-sparc64@freebsd.org Subject: Re: Can't compile tools/netrate/[netblast|netsend] X-BeenThere: freebsd-sparc64@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Porting FreeBSD to the Sparc List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 28 Aug 2011 22:27:02 -0000 On Sun, Aug 28, 2011 at 09:28:37PM +0200, Olivier Cochard-Labb? wrote: > Hi all, > > I'm trying to compile netblast on my Sun Blade 150, but I can't > because there is alignement error in the code: > > [root@sparc64]/usr/src/tools/tools/netrate/netblast#make > Warning: Object directory not changed from original > /usr/src/tools/tools/netrate/netblast > cc -O2 -pipe -std=gnu99 -fstack-protector -Wsystem-headers -Werror > -Wall -Wno-format-y2k -W -Wno-unused-parameter -Wstrict-prototypes > -Wmissing-prototypes -Wpointer-arith -Wreturn-type -Wcast-qual > -Wwrite-strings -Wswitch -Wshadow -Wcast-align -Wunused-parameter > -Wno-pointer-sign -Wformat=2 -Wno-format-extra-args -Werror -c > netblast.c > cc1: warnings being treated as errors > netblast.c: In function 'blast_loop': > netblast.c:115: warning: cast increases required alignment of target type > *** Error code 1 > > Stop in /usr/src/tools/tools/netrate/netblast > > As I'm not a C coder, and googling about alignment, I've learn that > only x86 platform "hide" this problem, but I didn't find dummy patch > for fix this kind of problem. > Does anyone have a solution ? > Index: netblast.c =================================================================== --- netblast.c (revision 223862) +++ netblast.c (working copy) @@ -26,6 +26,7 @@ * $FreeBSD$ */ +#include #include #include #include @@ -108,11 +109,9 @@ blast_loop(int s, long duration, u_char *packet, u * previous send, the error will turn up the current send * operation, causing the current sequence number also to be * skipped. - * - * XXXRW: Note alignment assumption. */ if (packet_len >= 4) { - *((u_int32_t *)packet) = htonl(counter); + be32enc(packet, counter); counter++; } if (send(s, packet, packet_len, 0) < 0)