From owner-freebsd-hackers@freebsd.org Thu Jun 16 14:34:56 2016 Return-Path: Delivered-To: freebsd-hackers@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E36A6A7217D for ; Thu, 16 Jun 2016 14:34:56 +0000 (UTC) (envelope-from asomers@gmail.com) Received: from mail-oi0-x236.google.com (mail-oi0-x236.google.com [IPv6:2607:f8b0:4003:c06::236]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id B259A1187 for ; Thu, 16 Jun 2016 14:34:56 +0000 (UTC) (envelope-from asomers@gmail.com) Received: by mail-oi0-x236.google.com with SMTP id w5so72074783oib.2 for ; Thu, 16 Jun 2016 07:34:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=UMGU2tIQu86HGwKhD7YQjQg7AOCwhr9at6fJQVE4K1k=; b=Hb+p0dzOqeRf/I27dJq1efaBzs0ZFFx+xW4dORrgJwHrW9aZ6fOLMF9B6NnHEdWt9t jAA3/GZ23oBc7eSeHjogHbNfkQkiyp6ufaAiv9uIDD6B++4UFj4Bcozo98qsaYdYtLMX yJSl/EC8bfu5C30ANK4oVSrmq9fL/0D4J/qUXIouj1N4+9072C6+KiwcAs3f4zEl7cWo I4tO73or4sdaAJfISI958aZMX+6ZQR6JYTnihn50RfQ0U9/eUEzWbitOvzjBinmigI8f SZaVeJ7Ei1GuiBS6Nsv558jeKeiRZ8Y9AWgMixxD/LEwUd5+c+J59vVW4fIawUGCuPRE cJnw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc; bh=UMGU2tIQu86HGwKhD7YQjQg7AOCwhr9at6fJQVE4K1k=; b=XpNrS04vjIGgQwZECqZ/QlugXqe7+9ffTb+B2zO1+OFLgATBhu4PURtGl4yaZ8QlEP PT6JNQz+6BzECbYTv+cnDlHLTt/n9HV+I5sLZAfrR2KqbutsZQsDVMCp9msnJ634C6Do 9xOGs1uthoQ8LxfnoRcFEfwEGdd373uKLy81GrXUn7gYkqV8/wkGssM9WBO071bldXR9 20zz60EPPWFxUMehIiakNWG0j3CNKaGTtGkoHFImWxtDibKOMYe4z1+8ELyJrUFtBImd p6/omHrG1trfvce2k5DxiroXRfRmfjR4IRPOkYBbj5yB0LF4SWOAoiOcrjVCe8omuOqJ bb8A== X-Gm-Message-State: ALyK8tLDBHKExU+m8E4aBEU6V7Mj7sUjVsEUP7kqOBIoXDcGmC7917QtfENsYyyqAVkmt/+CTaMOIKU9pzO9GA== X-Received: by 10.202.106.194 with SMTP id f185mr406542oic.80.1466087695827; Thu, 16 Jun 2016 07:34:55 -0700 (PDT) MIME-Version: 1.0 Sender: asomers@gmail.com Received: by 10.202.102.206 with HTTP; Thu, 16 Jun 2016 07:34:55 -0700 (PDT) In-Reply-To: <2fa5c2cb-81eb-d44a-3011-db27035e7965@herveybayaustralia.com.au> References: <2fa5c2cb-81eb-d44a-3011-db27035e7965@herveybayaustralia.com.au> From: Alan Somers Date: Thu, 16 Jun 2016 08:34:55 -0600 X-Google-Sender-Auth: tAhsYe3DY2tmSsBxVI6oBl8mV1w Message-ID: Subject: Re: enabling cpu "features" in custom kernel To: Da Rock Cc: "freebsd-hackers@freebsd.org" Content-Type: text/plain; charset=UTF-8 X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 16 Jun 2016 14:34:57 -0000 On Thu, Jun 16, 2016 at 6:35 AM, Da Rock wrote: > I'm just trying to get my head around kernel building and clang. > > If I want to enable certain features available on my cpu which are available > by clang, how do I enable them? As I understand it using ccflags is a no no > (ie /etc/make.conf), so how do I go about enabling them? I seem to be > missing something in my research here... > > One thing I did consider was that there might be some "include" or "option" > somewhere that I missed, but I still can't find it. There must be something > in the mk files or such, and I'm guessing that its due to the ability to > build the freebsd with various workarounds for different systems - but how > would I get around that so I can try testing something out? > > Cheers What features are you talking about? Instruction set extensions like AES-NI and AVX2 are already enabled in all the most important places. If you want to enable them everywhere, you can add "-march=native" to your CFLAGS. You can set that in either /etc/make.conf or /etc/src.conf. The latter only affects the FreeBSD base system. The former also affects ports. The problem with using "-march" is that your builds no longer become portable. You won't be able to run them on any system older than the one where they were built. -Alan