From owner-freebsd-ppc@FreeBSD.ORG Thu Nov 21 00:43:53 2013 Return-Path: Delivered-To: powerpc@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 572469D6 for ; Thu, 21 Nov 2013 00:43:53 +0000 (UTC) Received: from mail-qe0-x235.google.com (mail-qe0-x235.google.com [IPv6:2607:f8b0:400d:c02::235]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 1CD9B2572 for ; Thu, 21 Nov 2013 00:43:53 +0000 (UTC) Received: by mail-qe0-f53.google.com with SMTP id cy11so6883364qeb.12 for ; Wed, 20 Nov 2013 16:43:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:date:message-id:subject :from:to:cc:content-type; bh=scixxt++1ALEdbQycSSV1dnuQooXV3tJXqpQ6+AbTOQ=; b=GtW6lphUlatpn9CpN7QEF6DdZjeaZM0kOTD5BzJ68TMsXVTGuStIBJEIKksOAFTjYj zar2ocoXQsxADF7ibxjuJaxjNOdZzvMvZaJ90W6yLFrwT5x8C5/bLGHJmcPYJP1W4sHC sVmfVWEzvqHtEDuGJMossItMjreDQBYtRSTBz22hf6TBoKYi+FnCh5qRo+ZE8ojXo6zO JwvfNq1IIhA7gNxizlnw8PYuWHOqcXRsteRNhzTMiW4Ow52P7eG6qvV9c3djcRtsxJxk XF4Ww/xZ8Ktyk0G7g5esNCgbaturX1TrXwBGD6Cnqd9VEPQlcpCZp6/+mTWbzw81OeFi s2xQ== MIME-Version: 1.0 X-Received: by 10.224.12.10 with SMTP id v10mr6614256qav.98.1384994632338; Wed, 20 Nov 2013 16:43:52 -0800 (PST) Sender: adrian.chadd@gmail.com Received: by 10.224.207.66 with HTTP; Wed, 20 Nov 2013 16:43:52 -0800 (PST) In-Reply-To: <3D481595-1F61-4244-838F-5C13ABCB830D@mac.com> References: <3D481595-1F61-4244-838F-5C13ABCB830D@mac.com> Date: Wed, 20 Nov 2013 16:43:52 -0800 X-Google-Sender-Auth: ecLKnjyknX07gXfbN_AGexLK8n0 Message-ID: Subject: Re: RFC: compiler options to control what gets built and how From: Adrian Chadd To: Marcel Moolenaar Content-Type: text/plain; charset=ISO-8859-1 Cc: powerpc@freebsd.org, Warner Losh X-BeenThere: freebsd-ppc@freebsd.org X-Mailman-Version: 2.1.16 Precedence: list List-Id: Porting FreeBSD to the PowerPC List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Nov 2013 00:43:53 -0000 .. kernel modules generally need opt_xxx.h in order to correctly build with things like debug flags. net80211 for example changes the calling ABI depending upon whether IEEE80211_DEBUG is enabled or not. -adrian On 20 November 2013 09:08, Marcel Moolenaar wrote: > All, > > Background: > Juniper is refocussing efforts towards PowerPC again. Primarily > what this means for Juniper is that a select set of PowerPC- > based Juniper products will migrate to the latest FreeBSD as > the base OS underneath Junos. > What this means for FreeBSD is that Juniper will be contributing > a bunch of goodies :-) > > Problem at hand: > Juniper builds kernel modules without any reference to a kernel > configuration. This works great for architectures like x86, but > for PowerPC, MIPS and ARM this isn't always that easy. The problem > as far as I can see it is that we use kernel configurations to > indicate for which CPU we're compiling. Let's call this the > build setting for arguments sake. > > Complication: > Many embedded CPU architectures have specific compiler behaviour > you may have to tell the compiler for what CPU or ABI you're > compiling. Let's call this the compiler setting. Having both a > build setting and a compiler setting is, well, complicating. > > What I'd like to change is that we use compiler settings more > than build settings, for where it's applicable of course and as > a first stab, do it for PowerPC only. If it's successful then > it should be fairly easy to apply to ARM and MIPS. > > Examples: > 1. A compiler that generates 64-bit code can be assumed to > compiler a 64-bit PowerPC kernel. There is no need to have > a build option (like machine powerpc powerpc). Testing for > __LP64__ or something like that will do just fine. > 2. The difference between AIM and Book-E is (can) be handled > by checking the appropriate compiler defines (__embedded__) > and have us do the right thing in the kernel for modules > and for user space. > > Particular use case: > 1. Cross-tools aren't necessarily helped by the magical and > automatic selection of appropriate definitions. This is not > a problem that is in search of a solution though. Our ELF > headers handle this adequately and the same scheme can work > for things like trap frames and the likes. > 2. The remote kernel debugger stub needs different register > definitions for Book-E and AIM. These register definitions > are controller by the compiler options used, yet our stub > uses build settings. This has previously resulted in an > inability to debug the kernel remotely due to a mismatch. > 3. The buildbot I setup at Juniper builds a LINT kernel for > each CPU architecture. For PowerPC this adds an avoidable > complication that we actually need to use a different LINT > kernel configuration for no other reach than that we need > "machine powerpc powerpc64" > rather than > "machine powerpc powerpc" > A distinction that is almost entirely unnecessary. > > What needs to change to make this work: > 1. Since config(8) is the tool we use to pick up source files, > and we use the abovementioned build options to select the > right source files, we need a way to inject compiler defines > into the process of configuring the kernel build. > 2. We need well-defined built-in compiler defines for building > AIM vs. Book-E and 32-bit vs 64-bit. > > What do people think of using the compiler to drive more of what > and how we built so that the right thing happens with fewer > manual setup? > > -- > Marcel Moolenaar > xcllnt@mac.com > > > > _______________________________________________ > freebsd-ppc@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/freebsd-ppc > To unsubscribe, send any mail to "freebsd-ppc-unsubscribe@freebsd.org"