From sa2c@sa2c.net  Tue May 29 05:52:21 2007
Return-Path: <sa2c@sa2c.net>
Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52])
	by hub.freebsd.org (Postfix) with ESMTP id 3382616A4A6
	for <FreeBSD-gnats-submit@freebsd.org>; Tue, 29 May 2007 05:52:21 +0000 (UTC)
	(envelope-from sa2c@sa2c.net)
Received: from sakura.and.or.jp (sakura.and.or.jp [59.106.20.85])
	by mx1.freebsd.org (Postfix) with ESMTP id 09C3213C44B
	for <FreeBSD-gnats-submit@freebsd.org>; Tue, 29 May 2007 05:52:20 +0000 (UTC)
	(envelope-from sa2c@sa2c.net)
Received: from sakura.and.or.jp (localhost [127.0.0.1])
	by sakura.and.or.jp (Postfix) with ESMTP id 7A03C61C41
	for <FreeBSD-gnats-submit@freebsd.org>; Tue, 29 May 2007 14:52:20 +0900 (JST)
Received: from berkeley.l.sa2c.net (berkeley.vpn.and.or.jp [10.46.49.3])
	by sakura.and.or.jp (Postfix) with ESMTP id 5DD0961C37
	for <FreeBSD-gnats-submit@freebsd.org>; Tue, 29 May 2007 14:52:20 +0900 (JST)
Received: by berkeley.l.sa2c.net (Postfix, from userid 3104)
	id 4D9A040B1; Tue, 29 May 2007 14:52:20 +0900 (JST)
Message-Id: <20070529055220.4D9A040B1@berkeley.l.sa2c.net>
Date: Tue, 29 May 2007 14:52:20 +0900 (JST)
From: NIIMI Satoshi <sa2c@sa2c.net>
Reply-To: NIIMI Satoshi <sa2c@sa2c.net>
To: FreeBSD-gnats-submit@freebsd.org
Cc:
Subject: Potentially wrong instructions will be produced for EM64T 
X-Send-Pr-Version: 3.113
X-GNATS-Notify:

>Number:         113111
>Category:       amd64
>Synopsis:       [Makefile] [patch] Potentially wrong instructions will be produced for EM64T with default CFLAGS
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    jhb
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Tue May 29 06:00:12 GMT 2007
>Closed-Date:    Thu Sep 11 19:00:35 UTC 2008
>Last-Modified:  Thu Sep 11 19:00:35 UTC 2008
>Originator:     NIIMI Satoshi
>Release:        FreeBSD 7.0-CURRENT amd64
>Organization:
>Environment:
System: FreeBSD freebsd7-64 7.0-CURRENT FreeBSD 7.0-CURRENT #1: Tue May 29 13:46:35 JST 2007 root@freebsd7-64:/usr/obj/usr/src/sys/VMWARE amd64


	
>Description:
The CFLAG -march=k8 during build of lib32 may produce 3dNOW! or
enhanced 3dNOW! instructions, which are not available on Intel's EM64T
Processors.

	
>How-To-Repeat:
	
>Fix:

	

--- k8.diff begins here ---
Index: Makefile.inc1
===================================================================
RCS file: /home/ncvs/src/Makefile.inc1,v
retrieving revision 1.582
diff -u -r1.582 Makefile.inc1
--- Makefile.inc1	26 May 2007 20:17:19 -0000	1.582
+++ Makefile.inc1	29 May 2007 04:59:34 -0000
@@ -234,11 +234,11 @@
 LIB32TMP=	${OBJTREE}${.CURDIR}/lib32
 
 .if empty(TARGET_CPUTYPE)
-LIB32CPUTYPE=	k8
+LIB32CPUFLAGS=	-march=i686 -mmmx -msse -msse2
 .else
-LIB32CPUTYPE=	${TARGET_CPUTYPE}
+LIB32CPUFLAGS=	-march=${TARGET_CPUTYPE}
 .endif
-LIB32FLAGS=	-m32 -march=${LIB32CPUTYPE} -mfancy-math-387 -DCOMPAT_32BIT \
+LIB32FLAGS=	-m32 ${LIB32CPUFLAGS} -mfancy-math-387 -DCOMPAT_32BIT \
 		-iprefix ${LIB32TMP}/usr/ \
 		-L${LIB32TMP}/usr/lib32 \
 		-B${LIB32TMP}/usr/lib32
--- k8.diff ends here ---


>Release-Note:
>Audit-Trail:
State-Changed-From-To: open->feedback 
State-Changed-By: linimon 
State-Changed-When: Tue May 29 20:52:00 UTC 2007 
State-Changed-Why:  
I'm confused, I thought "k8" was "AMD-only"? 

http://www.freebsd.org/cgi/query-pr.cgi?pr=113111 
State-Changed-From-To: feedback->open 
State-Changed-By: gavin 
State-Changed-When: Sun Sep 16 10:13:55 UTC 2007 
State-Changed-Why:  
This seems like a valid problem.  The issue is that if TARGET_CPUTYPE 
is empty, we *default* to using "k8", even though that is not guaranteed 
to work on all the architectures that the amd64 port works on. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=113111 
State-Changed-From-To: open->analyzed 
State-Changed-By: linimon 
State-Changed-When: Tue Sep 18 00:37:40 UTC 2007 
State-Changed-Why:  
It sounds as though this may be a valid problem. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=113111 
State-Changed-From-To: analyzed->patched 
State-Changed-By: jhb 
State-Changed-When: Tue Aug 19 14:23:38 UTC 2008 
State-Changed-Why:  
Committed to HEAD, will MFC in a week or so. 


Responsible-Changed-From-To: freebsd-amd64->jhb 
Responsible-Changed-By: jhb 
Responsible-Changed-When: Tue Aug 19 14:23:38 UTC 2008 
Responsible-Changed-Why:  
Committed to HEAD, will MFC in a week or so. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=113111 

From: dfilter@FreeBSD.ORG (dfilter service)
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: amd64/113111: commit references a PR
Date: Tue, 19 Aug 2008 14:27:29 +0000 (UTC)

 jhb         2008-08-19 14:23:26 UTC
 
   FreeBSD src repository
 
   Modified files:
     .                    Makefile.inc1 
   Log:
   SVN rev 181871 on 2008-08-19 14:23:26Z by jhb
   
   If a CPUTYPE isn't specified, then don't use -march=k8 when compiling
   32-bit compat libs on amd64 since -march=k8 may generate instructions
   that are not implemented on Intel EM64T processors.  Instead, use
   a simpler set of default flags that should work on all amd64-capable
   CPUs.
   
   PR:             amd64/113111
   Submitted by:   NIIMI Satoshi  sa2c of sa2c.net
   MFC after:      1 week
   
   Revision  Changes    Path
   1.610     +3 -3      src/Makefile.inc1
 _______________________________________________
 cvs-all@freebsd.org mailing list
 http://lists.freebsd.org/mailman/listinfo/cvs-all
 To unsubscribe, send any mail to "cvs-all-unsubscribe@freebsd.org"
 
State-Changed-From-To: patched->closed 
State-Changed-By: jhb 
State-Changed-When: Thu Sep 11 19:00:21 UTC 2008 
State-Changed-Why:  
Merged to 6.x and 7.x. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=113111 
>Unformatted:
