From owner-freebsd-hackers@FreeBSD.ORG Wed Jul 13 07:00:41 2011 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 37BBE1065674; Wed, 13 Jul 2011 07:00:41 +0000 (UTC) (envelope-from rmh.aybabtu@gmail.com) Received: from mail-iw0-f182.google.com (mail-iw0-f182.google.com [209.85.214.182]) by mx1.freebsd.org (Postfix) with ESMTP id D76E98FC17; Wed, 13 Jul 2011 07:00:40 +0000 (UTC) Received: by iwr19 with SMTP id 19so6812767iwr.13 for ; Wed, 13 Jul 2011 00:00:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type; bh=kFEKmIOcwM78BGsnXC/3vBhG/KD1dXCqz40bo+tip5c=; b=UVL+XKIPoRXfG1fLrUPyskkzUKm2vcXKmGSVYisbQhqWocMupyMsMNIzN5ce8ZxrgG OG4BV3WtWoksfntHPzr7PNnDaLlvmQmdQ6a5Ywh+sScP0KtISW0Juq6BuIwFROexDqgB djuJqvWkfes6BANbyz1A8VCnYLlAEPfFd1bXE= MIME-Version: 1.0 Received: by 10.42.73.9 with SMTP id q9mr878988icj.314.1310540440145; Wed, 13 Jul 2011 00:00:40 -0700 (PDT) Sender: rmh.aybabtu@gmail.com Received: by 10.42.222.7 with HTTP; Wed, 13 Jul 2011 00:00:39 -0700 (PDT) In-Reply-To: <4E1CD3AB.3030106@freebsd.org> References: <20110712164337.07e387eb@kan.dnsalias.net> <4E1CB8C6.7090405@freebsd.org> <4E1CD3AB.3030106@freebsd.org> Date: Wed, 13 Jul 2011 09:00:39 +0200 X-Google-Sender-Auth: bJUpEHp1L_ct74nducgH8_zK4iM Message-ID: From: Robert Millan To: Nathan Whitehorn Content-Type: text/plain; charset=UTF-8 Cc: freebsd-hackers@freebsd.org, Ed Maste , Oliver Pinter Subject: Re: [PATCH] fake pre-processor macros when building on non-FreeBSD system X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 Jul 2011 07:00:41 -0000 2011/7/13 Nathan Whitehorn : > The one I meant was the third one. Linux and FreeBSD happen, though not > entirely by chance, to use almost exactly the same ABI on most platforms > (but not all!). Assuming, and requiring, interchangeability of ABIs here > thus seems like a poor choice. Once you've decided you might have a > different ABI, you need a cross-compiler, and that would simultaneously take > care of defining various platform-specific macros. > > The "isn't actually that different" comment, which wasn't a particularly > useful thing to say, was that you could conceivably claim, under very broad > definitions of what ABI means, that having __FreeBSD__ defined is in fact a > part of the system ABI, just like the calling conventions or the stack frame > layout. In either case, you would be expected to use a cross-compiler. I understand the problem you describe, but I don't see how this is related to the presence of those macros. C ABI is selected with compiler flags such as -mabi=n32 or -mregparm=3. There's no technical requirement for your kernel ABI to match your userland ABI. If it does, it is an arbitrary choice (or coincidence). In either case, when you tell me that there's something special with regard to C ABI when GCC has been compiled for FreeBSD userland, I can't make any sense of this. In first place, because none of gcc/config/i386/freebsd.h implies it. In second place, because other projects (like GRUB) also have specific ABI requirements, and never had this kind of problem. However, there's clear evidence that none of this is intended in the source code. If existing practice in the FreeBSD tree supported your claim, you'd see things like: #ifndef __FreeBSD__ #error "we can't garantee that this compiler implements the desired C ABI" #endif but none of this happens. Instead, __FreeBSD__ is used to check for tautology: #ifdef __FreeBSD__ // working code here #elif __NetBSD__ // include headers that aren't present anywhere in the kernel tree #endif I understand the purpose of this, but please don't tell me it has anything to do with C ABI. -- Robert Millan