From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-ed1-x52e.google.com (mail-ed1-x52e.google.com [IPv6:2a00:1450:4864:20::52e]) by sourceware.org (Postfix) with ESMTPS id 44CC93858033 for ; Thu, 28 Jul 2022 10:51:50 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 44CC93858033 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=embecosm.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=embecosm.com Received: by mail-ed1-x52e.google.com with SMTP id s9so1659468edd.8 for ; Thu, 28 Jul 2022 03:51:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=embecosm.com; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=h92q4uyqyiOgFHnUFSLHwdSvC6FXwn4QyZNXIhLIq5Q=; b=IqCuwtNm8NI1WRYCD1MZefyE1z+OiM9QIM2x4Zk9t9fwyQn3ANa387hgCfx9zrIQ16 Hg4awgKj6LG3Njky8yh9B5S3ztw9HUbasX5h7enKS4eOjUjdLnO2/LgFVkix1Ul2bGaQ yD+MJWuAGkm2YTD2LWlONA4s0wpNRcBW5kVSVtlXlnmT0xaEtrSB5cJE+TDXD3pI/tRv P/atEo5UaAQ9eYVRKnp4JJ1854nOhXVbSvnghYns2JCr8OZaJP10MqJhT3ML5v0OuNUj c674I49BU8kc4xLe3ecUfiU/KEEwZVxbSG/gMoWTmnCBHilUNk7ctZWyHNiTutJm1+NW ROTw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=h92q4uyqyiOgFHnUFSLHwdSvC6FXwn4QyZNXIhLIq5Q=; b=nWMvRZkKDHEs37NvZE4WN3iCO53FUWBk8GbbOsZHU23WxwvLAcCzEN1HdoAkIz1Fgw moIOGLLCdcyaKFFEII10v+93+YMDBSKLRGrcFzO6CkPTo6Pyo3l5J9QO4eQD3wOPRDKG +7kj9YHwB+TWiquD9w7KSupDThsxaxu2Xmmdv71kBi1yMfgo4sLL9zsurGW3K+XDuSI+ 8JEfy2hFD/RJNliL7rH52QbUWs0mXbjyk+C2wWdVLz3o6RM9eTRk27HXSsi+z82FWgkB EJ1nQnYhBzkYI9bc/FdbREu5MFrnIiv1uQ3QquwdyjKHCdSE4c6og/TtfpbCAz1iRkAA 9rDw== X-Gm-Message-State: AJIora96UkA2vRAz1RyoZbJIiMwVoUtVCNJFq4qnEFAa+vVInfjX6Cci SWw7eRceHq2PhJrZF4AUrCZSBE8Czf6cgNzTAVyHXA== X-Google-Smtp-Source: AGRyM1uDa0e0sjVi14v0gcjHxA1e4ljb8lpGmKb1UFptyjIqXVexQ2lq1tf6gMvD0qv8gvB4eaKsvjHrJ3BtUTar7eg= X-Received: by 2002:a05:6402:350b:b0:43a:e18e:dee6 with SMTP id b11-20020a056402350b00b0043ae18edee6mr27007007edd.31.1659005508875; Thu, 28 Jul 2022 03:51:48 -0700 (PDT) MIME-Version: 1.0 References: <20220727134040.843750-1-philip.herron@embecosm.com> <20220727134040.843750-3-philip.herron@embecosm.com> <878roda5f5.fsf@euler.schwinge.homeip.net> In-Reply-To: <878roda5f5.fsf@euler.schwinge.homeip.net> From: Philip Herron Date: Thu, 28 Jul 2022 11:51:37 +0100 Message-ID: Subject: Re: [PATCH Rust front-end v1 2/4] Add Rust lang TargetHooks for i386 and x86_64 To: Thomas Schwinge Cc: gcc-patches@gcc.gnu.org, Philip Herron , SimplyTheOther Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-1.1 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, KAM_NUMSUBJECT, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 28 Jul 2022 10:51:52 -0000 Hi Thomas, I think you are right here. There are parts in libstd/liballoc/libpanic which start to look for what CPU features are available iirc. Maintaining our patches here has been becoming difficult as of late, especially when it comes to libcore, which just cares about target pointer width and endienness which is more generally available as macros. It seems more clear now that maybe for this v1 set of patches, possibly this stuff doesn't really matter right now until we compile libstd which seems like a much better approach in order to review the front-end code. I think i will apply your patch and revert these changes for now since we have the git history for them we can look at this more closely when we need it. Thanks --Phil On Thu, 28 Jul 2022 at 11:38, Thomas Schwinge wro= te: > > Hi! > > On 2022-07-27T14:40:38+0100, "herron.philip--- via Gcc-patches" wrote: > > This patch introduces a new set of interfaces to define the target info= as > > expected by the rust front-end. It takes advantage of the information > > within gcc/config/target directories which gets called by the front-end > > to populate rust front-end datastructures by calling into: > > builtin_rust_info. This patch has been isolated to find if we are > > approaching this in an idiomatic way and is compilable without the > > rust-front-end code. > > I suppose the general approach may be fine, as is similarly implemented > by other languages' front ends in GCC. > > > We have received many patches here which gives us the target hook info = for > > most platforms > > But this is all so much WIP and full of TODO notes, and has no test cases > at all!, that I still don't really see much value in keeping the current > implementations of 'TARGET_RUST_CPU_INFO', 'TARGET_RUST_OS_INFO', etc. > Applying "[HACK] Disable 'TARGET_RUST_CPU_INFO', 'TARGET_RUST_OS_INFO'" > that I've attached, we're not seeing any change in 'make check-rust' > results, for example. > > In my opinion, the current implementation should be backed out from the > main development branch (would also reduce pain in merges from GCC > upstream, as mentioned before), and then be developed (quite possibly > based on the current implementation) individually for all GCC > configurations that we'd like to support (with 'sorry' otherwise), in a > coherent way, instead of trying to guess all possible target options as > done by the current implementation. And, with all relevant test cases > getting added, of course. That is, at this time, restrict outselves to > GCC configurations that we're actually supporting and testing. > > Have we even figured out which of those target options are actually > mandated for a conforming Rust programming language implementation (that > is, users would potentially rely on these)? > > As far as I can tell, 'rustc' defines target options here: > , > and you may use 'rustc --print=3Dcfg' to dump for the current > configuration? > > > but getting the normal x86 done correctly will define if > > the other patches are done correctly. > > Yes -- but I'm not sure this is it really, in its current WIPy, > un-tested, un-verified form: > > > gcc/config/ChangeLog: > > > * gnu.h: add new macro GNU_USER_TARGET_RUST_OS_INFO > > * dragonfly.h: define TARGET_RUST_OS_INFO > > * freebsd-spec.h: define FBSD_TARGET_RUST_OS_INFO > > * freebsd.h: define guard for TARGET_RUST_OS_INFO > > * fuchsia.h: define TARGET_RUST_OS_INFO > > * kfreebsd-gnu.h: define GNU_USER_TARGET_RUST_OS_INFO > > * kopensolaris-gnu.h: define GNU_USER_TARGET_RUST_OS_INFO > > * linux-android.h: define ANDROID_TARGET_RUST_OS_INFO > > * linux.h: define GNU_USER_TARGET_RUST_OS_INFO > > * netbsd.h: define NETBSD_TARGET_RUST_OS_INFO > > * openbsd.h: define OPENBSD_TARGET_RUST_OS_INFO > > * phoenix.h: define TARGET_RUST_OS_INFO > > * sol2.h: define TARGET_RUST_OS_INFO > > * vxworks.h: define VXWORKS_TARGET_RUST_OS_INFO > > * vxworksae.h: define VXWORKS_TARGET_RUST_OS_INFO > > > > gcc/config/i386/ChangeLog: > > > > * crtdll.h: define EXTRA_TARGET_RUST_OS_INFO > > * cygming.h: define TARGET_RUST_OS_INFO > > * cygwin.h: define EXTRA_TARGET_RUST_OS_INFO > > * darwin.h: define TARGET_RUST_OS_INFO > > * djgpp.h: likewise > > * gnu-user-common.h: define TARGET_RUST_OS_INFO > > * i386-protos.h: prototype for ix86_rust_target_cpu_info > > * i386-rust.cc: new file to generate the rust target host info > > * i386.h: define TARGET_RUST_CPU_INFO hook > > * linux-common.h: define hooks for target info > > * lynx.h: likewise > > * mingw32.h: likewise > > * netbsd-elf.h: likewise > > * netbsd64.h: likewise > > * nto.h: likewise > > * openbsdelf.h: likewise > > * rdos.h: likewise > > * rtemself.h: likewise > > * t-i386: add makefilke rule for i386-rust.cc > > * vxworks.h: define TARGET_RUST_OS_INFO > > > Gr=C3=BC=C3=9Fe > Thomas > > > ----------------- > Siemens Electronic Design Automation GmbH; Anschrift: Arnulfstra=C3=9Fe 2= 01, 80634 M=C3=BCnchen; Gesellschaft mit beschr=C3=A4nkter Haftung; Gesch= =C3=A4ftsf=C3=BChrer: Thomas Heurung, Frank Th=C3=BCrauf; Sitz der Gesellsc= haft: M=C3=BCnchen; Registergericht M=C3=BCnchen, HRB 106955