From owner-freebsd-sparc64@FreeBSD.ORG Mon Aug 29 17:40:14 2011 Return-Path: Delivered-To: freebsd-sparc64@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id F3868106566C for ; Mon, 29 Aug 2011 17:40:13 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by mx1.freebsd.org (Postfix) with ESMTP id D06DC8FC18 for ; Mon, 29 Aug 2011 17:40:13 +0000 (UTC) Received: from freefall.freebsd.org (localhost [127.0.0.1]) by freefall.freebsd.org (8.14.4/8.14.4) with ESMTP id p7THeDAo054053 for ; Mon, 29 Aug 2011 17:40:13 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.4/8.14.4/Submit) id p7THeDhA054052; Mon, 29 Aug 2011 17:40:13 GMT (envelope-from gnats) Resent-Date: Mon, 29 Aug 2011 17:40:13 GMT Resent-Message-Id: <201108291740.p7THeDhA054052@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-sparc64@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, Olivier Cochard-Labbe Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id AE7A4106566C for ; Mon, 29 Aug 2011 17:36:02 +0000 (UTC) (envelope-from nobody@FreeBSD.org) Received: from red.freebsd.org (red.freebsd.org [IPv6:2001:4f8:fff6::22]) by mx1.freebsd.org (Postfix) with ESMTP id 93C978FC15 for ; Mon, 29 Aug 2011 17:36:02 +0000 (UTC) Received: from red.freebsd.org (localhost [127.0.0.1]) by red.freebsd.org (8.14.4/8.14.4) with ESMTP id p7THa2JF076514 for ; Mon, 29 Aug 2011 17:36:02 GMT (envelope-from nobody@red.freebsd.org) Received: (from nobody@localhost) by red.freebsd.org (8.14.4/8.14.4/Submit) id p7THa2as076513; Mon, 29 Aug 2011 17:36:02 GMT (envelope-from nobody) Message-Id: <201108291736.p7THa2as076513@red.freebsd.org> Date: Mon, 29 Aug 2011 17:36:02 GMT From: Olivier Cochard-Labbe To: freebsd-gnats-submit@FreeBSD.org X-Send-Pr-Version: www-3.1 Cc: Subject: sparc64/160289: Patch for compile tools/netrate/[netblast|netsend] on sparc64 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: Mon, 29 Aug 2011 17:40:14 -0000 >Number: 160289 >Category: sparc64 >Synopsis: Patch for compile tools/netrate/[netblast|netsend] on sparc64 >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-sparc64 >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Mon Aug 29 17:40:13 UTC 2011 >Closed-Date: >Last-Modified: >Originator: Olivier Cochard-Labbe >Release: 8.2-RELEASE >Organization: >Environment: FreeBSD sparc64.bsdrp.net 8.2-RELEASE FreeBSD 8.2-RELEASE #0: Sun Mar 6 17:26:52 CET 2011 root@sparc64.bsdrp.net:/usr/obj/usr/src/sys/GENERIC sparc64 >Description: 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 >How-To-Repeat: On a sparc64 machine: /usr/src/tools/tools/netrate/netblast;make or: /usr/src/tools/tools/netrate/netsend;make >Fix: With the help of Marius Strobl (marius@alchemy.franken.de) from the freebsd-sparc64 mailing-list, here is the patch for fixing theses problems. Patch attached with submission follows: diff -ruN netrate.orig/netblast/netblast.c netrate/netblast/netblast.c --- netrate.orig/netblast/netblast.c 2011-08-29 19:20:21.000000000 +0200 +++ netrate/netblast/netblast.c 2011-08-29 19:19:38.000000000 +0200 @@ -26,6 +26,7 @@ * $FreeBSD: src/tools/tools/netrate/netblast/netblast.c,v 1.3.10.1.6.1 2010/12/21 17:09:25 kensmith Exp $ */ +#include #include #include #include @@ -108,11 +109,9 @@ * 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) diff -ruN netrate.orig/netsend/netsend.c netrate/netsend/netsend.c --- netrate.orig/netsend/netsend.c 2011-08-29 19:20:21.000000000 +0200 +++ netrate/netsend/netsend.c 2011-08-29 19:22:16.000000000 +0200 @@ -26,6 +26,7 @@ * $FreeBSD: src/tools/tools/netrate/netsend/netsend.c,v 1.9.10.1.6.1 2010/12/21 17:09:25 kensmith Exp $ */ +#include #include #include #include @@ -164,11 +165,9 @@ * 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) >Release-Note: >Audit-Trail: >Unformatted: