From owner-freebsd-current@freebsd.org Thu Oct 5 21:21:22 2017 Return-Path: Delivered-To: freebsd-current@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 2EA30E42E5F for ; Thu, 5 Oct 2017 21:21:22 +0000 (UTC) (envelope-from asomers@gmail.com) Received: from mail-lf0-x22f.google.com (mail-lf0-x22f.google.com [IPv6:2a00:1450:4010:c07::22f]) (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 16B892C08 for ; Thu, 5 Oct 2017 21:21:21 +0000 (UTC) (envelope-from asomers@gmail.com) Received: by mail-lf0-x22f.google.com with SMTP id p184so18106084lfe.12 for ; Thu, 05 Oct 2017 14:21:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=UiEs2zaoOc2GfOL0OWQjQA1/iU3svSf69E7LSydAH98=; b=Txc8Q6V/wo/GFYHgFLJILPR9cm0QbFssQoipXDIgaRay/tecPe8Vc5zE+Ad+e5s44h 3QYYLUh6dno/CDtEuPCp7LRlWGt4TGQVkRFI4GRCYkS2OHHgtXxVyA2tKchRCi71PYta 9OsZH7yHDoDwHbinPcZTrH1aoJl27VSUMA6DJEiqM34OJ6an+OzPCfmBj5sMpiECO2FH Zm/YB7I8VVBAqGKAHrJtEtb4HJNtEbqW29/FymiTLCKNB3mf5j1slJGF7lRvtI/VXpEh XxIJZHUaLT8COeql7PPbqPtx0p1eID9paq1B/gluQtM/Lyh0wCvq7w1t4T6yxTYqmjuV 3HGg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc; bh=UiEs2zaoOc2GfOL0OWQjQA1/iU3svSf69E7LSydAH98=; b=AnTNRFN9AULX4zCPuvAjwxPM2I9d5Ar0vyK4eJkpB5Nxvd8lc8GHnymoZAa/EqZty3 43e+taJMIQvUzRxypQ5Dn29EwvLHdknlntm7DxM19a4ZTfn5BLh0Syb6kW4pAwo8kv/X M7Pf5dhGSIZ+6ayISV5OxxYvkCkhNSkHkcHhSBsHT/LlgL/5ulouj/S8jPIGBEccuQaM crw9vrJAanozrkz9MEcaVF4S/t2ssAK7GDaIvHi/Q+T2c0fjNVD+jkIs5m93gv3e3cyD sgkOkLT9sRy2EecDm9DJoRwElP7RQf/ZZgCz9GgrjkY9qWxS5GZaiCiCGNxweGOiiXVe tYhg== X-Gm-Message-State: AMCzsaUz2HAY1CHYfCkc9mxtIwJrZIZhWCF5cG0QIQK++piGAB9xeoFc 7PFRm66Dg9U7cNp8msNh31+L3z+pZG64RGimZU4= X-Google-Smtp-Source: AOwi7QCPibC48C9nFgePM/pDqM6n8Vbtm3wlVKcf/SUmR0Hn8JJbTqRQJMWmwIMFYF5IjOLZ6ZW693MK5oYcK9Yd59U= X-Received: by 10.25.23.38 with SMTP id n38mr18343lfi.104.1507238478053; Thu, 05 Oct 2017 14:21:18 -0700 (PDT) MIME-Version: 1.0 Sender: asomers@gmail.com Received: by 10.179.7.153 with HTTP; Thu, 5 Oct 2017 14:21:17 -0700 (PDT) In-Reply-To: References: From: Alan Somers Date: Thu, 5 Oct 2017 15:21:17 -0600 X-Google-Sender-Auth: WvbIelEw-wpz-hY8_2FEYZ0-DyI Message-ID: Subject: Re: C++ in jemalloc To: Warner Losh Cc: David Goldblatt , FreeBSD Current Content-Type: text/plain; charset="UTF-8" X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 05 Oct 2017 21:21:22 -0000 On Thu, Oct 5, 2017 at 3:01 PM, Warner Losh wrote: > On Thu, Oct 5, 2017 at 11:59 AM, David Goldblatt > wrote: > >> Hi all, >> >> The jemalloc developers have wanted to start using C++ for a while, to >> enable some targeted refactorings of code we have trouble maintaining due >> to brittleness or complexity (e.g. moving thousand line macro definitions >> to templates, changing the build->extract symbols->rebuild mangling scheme >> for internal symbols to one using C++ namespaces). We'd been holding off >> because we thought that FreeBSD base all had to compile on GCC 4.2, in >> order to support some esoteric architectures[1]. >> >> The other day though, I noticed that there is some C++ shipping with >> FreeBSD; /usr/bin/dtc and /sbin/devd (the former claiming in the HACKING >> document that C++11 is a minimum for FreeBSD 11). This, combined with the >> fact that ports now points to a modern gcc, makes me think we were >> incorrect, and can turn on C++ without breaking FreeBSD builds. >> >> Am I right? Will anything break if jemalloc needs a C++ compiler to build? >> We will of course not use exceptions, RTTI, global constructors, the C++ >> stdlib, or anything else that might affect C source or link compatibility. >> >> Thanks, >> David (on behalf of the jemalloc developers >> >> [1] That being said, we don't compile or test on those architectures, and >> so probably don't work there in the first place if I'm being honest. But >> we'd also like to avoid making that a permanent state of affairs that can't >> be changed. >> > > For FreeBSD 10 and earlier, this would likely break all architectures that > aren't x86. Starting in FreeBSD 11, arm and powerpc are supported by clang, > but not super well. For FreeBSD 12, we're getting close for everything > except sparc64 (whose fate has not yet been finally decided). > > So for the popular architectures, this arrangement might work. For building > with external toolchains, it might also work. Some of the less popular > architectures may be a problem. > > Does that help? It isn't completely cut and dried, but it should be helpful > for you making a decision. > > Warner To be clear, Warner is talking about C++11 code in jemalloc. C++98 will work fine on all architectures, and I think most of C++03 will too. dtc(1) is allowed to use C++11 because it only builds on architectures that support it. -Alan