From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-oi1-x22e.google.com (mail-oi1-x22e.google.com [IPv6:2607:f8b0:4864:20::22e]) by sourceware.org (Postfix) with ESMTPS id 894093858D20 for ; Mon, 15 Jan 2024 03:05:33 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 894093858D20 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=gwmail.gwu.edu Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gwmail.gwu.edu ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 894093858D20 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2607:f8b0:4864:20::22e ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1705287935; cv=none; b=mrbD3q7jhWbPClX6HwxeQJt1O49fm8Vkjxl9Z/npSKG5GBQ/blqEkAd3+nls2zde7a02oDJ63v6YANfFuoyje3WVfMopN2GqXbZ041Ptlnfs0cxGcLprFzJbARKZDQqCfidwz6XEYsDXihZXNxSu3IDam+trh7N99D+ELGeSONE= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1705287935; c=relaxed/simple; bh=H+2NPFaCxsU9sE0HxMztJ6clS643cmzWAIItnMtulbc=; h=DKIM-Signature:MIME-Version:From:Date:Message-ID:Subject:To; b=LW36tE5OwZawemu04GUDexyo0aA6TztFFfby6LnpefBXoX4Mdt4erQVzaENRFpYwoch1rD0LuLdZIpZl69q5Mhl5EL4oKAAnXs9rUe3ZX63NQaVMhz88YWO6AefTC1Z7cQRcWiuHG/zEGHtYDEjAZlESsWoyA+XtR2rLTMbxPDQ= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-oi1-x22e.google.com with SMTP id 5614622812f47-3bd7477d7a3so374259b6e.2 for ; Sun, 14 Jan 2024 19:05:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gwmail.gwu.edu; s=google; t=1705287932; x=1705892732; darn=gcc.gnu.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=IHkIZWUbsis3hiF3hI0/xq6KKEmNP+4/Wc31uAqhgTU=; b=ddqlIB2xIBCdxo2lfYPxc+wCmbKhUUnLkATZ8aNCsvMBLzd+06wy6COIZ2Y+dIVU55 cs+9y5MMd7PzGTrAil4/derY0BrecuVnYZGs4twZNySXrOtGk0Gsdo7fXunKnEToiaUh n/6mXYjuI9XBW7Nb9+HIh8d3Tjm1snYw5/SnHnxRfdONSeju7WShvvfjyD6R0Asto6Te IMkKAhI+2W4uSRWb+toxUT6F1gfRE9kMaYDi7Qke+wI5EFJ00DaMabdbd1WthJVJJ/Gk QckeqicelIpSAd/XWHkvRhAc25z7LKJHTGtr2q9WYN5i9lJtf3tX6AxmS6IotGAzU32E ClCw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1705287932; x=1705892732; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=IHkIZWUbsis3hiF3hI0/xq6KKEmNP+4/Wc31uAqhgTU=; b=ssZMC67YNNShZlZZRI2Pun58i9K7tHJ/HxYygE/taFn+WCteUQsLW/x6F71MNso44A tsahJ1r4kR0c9z8Xxvx0aVr157hlMeCZ3uHLXafwnWBwETg9fEn+l84+iiTOCtcU0O98 5Chmu13Mn1XYe4LRfC2K+S01aifdgIafQZFfBaluctav1gItf/TkBYXvrDnQ0G1RSVBV EpMZbbfBSaZTOAr+fOJb9QPMOvmZCdugRwsRlRijFpff5NM5Bl4lMmgldSrDXyHb+2M8 76ioiEaAD7O2Aj/1J6VtJIYzobhKv7nTC9MPp2kdQt0tEUzIGNYgUi69g5PF2tiqiQJe OClA== X-Gm-Message-State: AOJu0YwACcOHL1sdwf59+Y+YjVWaOY57wm7QkprP8kU7zP9cY1AemIFj mNFbRN3HkSOu9CcnnvuxNqIhjNCZ0U+UZtKHFJPQlebT3jCf X-Google-Smtp-Source: AGHT+IEKd8mVbV8UfPflMqPh31oDyOM0AuwMNIEccrLTWqiHL0RaXj/+0LO5dmtG84/x8vPe7W/YbHJ5hAF5ZJxxihA= X-Received: by 2002:a05:6808:1248:b0:3bd:36de:f0d7 with SMTP id o8-20020a056808124800b003bd36def0d7mr3967486oiv.5.1705287932409; Sun, 14 Jan 2024 19:05:32 -0800 (PST) MIME-Version: 1.0 References: <20231230212103.973170-1-tom@tromey.com> <87edel79f6.fsf@redhat.com> In-Reply-To: <87edel79f6.fsf@redhat.com> From: Eric Gallager Date: Sun, 14 Jan 2024 22:05:21 -0500 Message-ID: Subject: Re: [PATCH] Pass GUILE down to subdirectories To: Andrew Burgess Cc: Tom Tromey , gdb-patches@sourceware.org, gcc-patches@gcc.gnu.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-7.9 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,GIT_PATCH_0,JMQ_SPF_NEUTRAL,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,TXREP,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: On Sat, Jan 13, 2024 at 6:36=E2=80=AFAM Andrew Burgess wrote: > > Tom Tromey writes: > > > When I enable cgen rebuilding in the binutils-gdb tree, the default is > > to run cgen using 'guile'. However, on my host, guile is guile 2.2, > > which doesn't work for me -- I have to use guile3.0. > > > > This patch arranges to pass "GUILE" down to subdirectories, so I can > > use 'make GUILE=3Dguile3.0'. > > > > ChangeLog > > 2023-12-30 Tom Tromey > > > > * Makefile.in: Rebuild. > > * Makefile.tpl (BASE_EXPORTS): Add GUILE. > > (GUILE): New variable. > > * Makefile.def (flags_to_pass): Add GUILE. > > --- > > ChangeLog | 7 +++++++ > > Makefile.def | 1 + > > Makefile.in | 8 ++++++-- > > Makefile.tpl | 7 +++++-- > > 4 files changed, 19 insertions(+), 4 deletions(-) > > > > diff --git a/Makefile.def b/Makefile.def > > index 662e50fdc18..792919e561c 100644 > > --- a/Makefile.def > > +++ b/Makefile.def > > @@ -310,6 +310,7 @@ flags_to_pass =3D { flag=3D GNATBIND ; }; > > flags_to_pass =3D { flag=3D GNATMAKE ; }; > > flags_to_pass =3D { flag=3D GDC ; }; > > flags_to_pass =3D { flag=3D GDCFLAGS ; }; > > +flags_to_pass =3D { flag=3D GUILE ; }; > > > > // Target tools > > flags_to_pass =3D { flag=3D AR_FOR_TARGET ; }; > > diff --git a/Makefile.in b/Makefile.in > > index 48320bb549e..9a58d5a4f20 100644 > > --- a/Makefile.in > > +++ b/Makefile.in > > @@ -3,7 +3,7 @@ > > # > > # Makefile for directory with subdirs to build. > > # Copyright (C) 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998= , > > -# 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, = 2010, 2011 > > +# 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, = 2010, 2011, 2023 > > # Free Software Foundation > > # > > # This file is free software; you can redistribute it and/or modify > > @@ -143,7 +143,8 @@ BASE_EXPORTS =3D \ > > M4=3D"$(M4)"; export M4; \ > > SED=3D"$(SED)"; export SED; \ > > AWK=3D"$(AWK)"; export AWK; \ > > - MAKEINFO=3D"$(MAKEINFO)"; export MAKEINFO; > > + MAKEINFO=3D"$(MAKEINFO)"; export MAKEINFO; \ > > + GUILE=3D"$(GUILE)"; export GUILE; > > > > # This is the list of variables to export in the environment when > > # configuring subdirectories for the build system. > > @@ -450,6 +451,8 @@ GM2FLAGS =3D $(CFLAGS) > > > > PKG_CONFIG_PATH =3D @PKG_CONFIG_PATH@ > > > > +GUILE =3D guile > > Hi Tom, > > This change is causing some problems for me. > > One of my build machines has 2 versions of guile installed. One is > guile 2.0.14 and the other is guile 2.2.21. > > When GDB configures itself the configure script figures out that it > should use 2.2.21 to compile the guile libraries that GDB uses. > > However, when we actually build the guile libraries we do use guild2.2, > but due to this 'GUILE =3D guile' line, guild2.2 uses guile 2.0.14 in > order to perform the compile (I guess, I don't know the details of how > guile compilation works). > > Unfortunately guile 2.0.14 compiles in a way which is not compatible > with how GDB then tries to load the guile library. > > Maybe better to show you what's going on: > > $ pwd > /tmp/binutils-gdb/build/gdb/data-directory/guile > $ GUILE=3Dguile /usr/bin/guild2.2 compile -Warity-mismatch -Wformat -Wu= nused-toplevel -L . -o ./gdb.go ./gdb.scm > wrote `./gdb.go' > $ file gdb.go > gdb.go: Guile Object, little endian, 64bit, bytecode v2.0 > $ GUILE=3Dguile2.2 /usr/bin/guild2.2 compile -Warity-mismatch -Wformat = -Wunused-toplevel -L . -o ./gdb.go ./gdb.scm > wrote `./gdb.go' > $ file gdb.go > gdb.go: ELF 64-bit LSB shared object, no machine, version 1 (embedded),= dynamically linked, with debug_info, not stripped > > The first compile uses GUILE=3Dguile, so I use guile 2.0.14, which result= s > in a non-ELF being generated. When I start GDB with this non-ELF in > place, I see this: > > $ ./gdb/gdb --data-directory ./gdb/data-directory/ > Exception caught while booting Guile. > Error in function "load-thunk-from-memory": > not an ELF file > ./gdb/gdb: warning: Could not complete Guile gdb module initialization = from: > /tmp/binutils-gdb/build/gdb/data-directory/guile/gdb/boot.scm. > Limited Guile support is available. > Suggest passing --data-directory=3D/path/to/gdb/data-directory. > GDB Version: 15.1 > > (gdb) > > The second compile, with GUILE=3Dguile2.2 results in an ELF being > generated, and with this in place GDB starts just fine. > > Now, clearly the obvious answer is: don't have such an old, out of date > version of guile installed. But I think there's a bigger issue here. > As guild version X will by default pick up the corresponding version of > guile, shouldn't that be the default behaviour? > > My proposal would be that we change the line 'GUILE =3D guile' to instead > be just 'GUILE =3D'. > > With this in place I can still override the choice of guile executable > with: > > make GUILE=3DguileXXXX > > but, if I don't do this then instead of forcing 'guile' as the default, > we allow the guild compiler to pick its own default, just as we did > before. > > Thoughts? > How about adding an additional configure check to configure.ac that ensures that the version of guile found works properly, and then having that be substituted into the Makefile? Then the Makefile line in question would be: GUILE =3D @GUILE@ > Thanks, > Andrew > > --- > > commit 5230132e2a49ee6603d6713796fb72c418b83e30 > Author: Andrew Burgess > Date: Sat Jan 13 11:15:13 2024 +0000 > > don't force 'guile' as the default guile executable > > After commit: > > commit d006ec41c448d9f4a84df50391e87cbf0aa8c152 > Date: Thu Dec 28 14:08:39 2023 -0700 > > Pass GUILE down to subdirectories > > I noticed a problem with GDB where 'guile' was now being used to > compile GDB's guile libraries rather than 'guile2.2'. The previous > choice of 'guile2.2' was made by the 'guild2.2' compiler as the GUILE > environment variable was not set. > > After the above commit the environment variable GUILE was being set t= o > 'guile' by default, which forced 'guild2.2' to use the 'guile' > executable, which on my system happened to be guile 2.0.14, which > creates libraries that are not compatible with how GDB expects to loa= d > the guile libraries. > > Aside: guile 2.0.14 creates files containing guile byte-code: > > $ file gdb.go > gdb.go: Guile Object, little endian, 64bit, bytecode v2.0 > > while guile 2.2.6 creates ELF files: > > $ file gdb.go > gdb.go: ELF 64-bit LSB shared object, no machine, version 1 (embedd= ed), dynamically linked, with debug_info, not stripped > > Part of the problem here is that GDB looks for a working version of > guile by checking different guile versions in this order: > > guile-3.0 > guile-2.2 > guile-2.0 > > On my system GDB finds a working guile-2.2, so links GDB against the > guile-2.2 library, and uses guild2.2, and the only outlier is the > default being forced on GDB by the top level Makefile. > > I suggest that we should not set the default to 'guile' at the top > level. Instead we should leave the default empty. With this done > 'guild' will select its appropriate default version of guile. > > We are still free to do 'make GUILE=3Dguile3.0' if we want, in which > case the empty default will be overridden. > > * Makefile.in: (GUILE): Clear default value. > * Makefile.tpl: (GUILE): Likewise. > > diff --git a/Makefile.in b/Makefile.in > index a1f64a2ab5a..c135c63dc9b 100644 > --- a/Makefile.in > +++ b/Makefile.in > @@ -452,7 +452,7 @@ GM2FLAGS =3D $(CFLAGS) > > PKG_CONFIG_PATH =3D @PKG_CONFIG_PATH@ > > -GUILE =3D guile > +GUILE =3D > > # Pass additional PGO and LTO compiler options to the PGO build. > BUILD_CFLAGS =3D $(PGO_BUILD_CFLAGS) $(PGO_BUILD_LTO_CFLAGS) > diff --git a/Makefile.tpl b/Makefile.tpl > index adbcbdd1d57..db35ee520f4 100644 > --- a/Makefile.tpl > +++ b/Makefile.tpl > @@ -455,7 +455,7 @@ GM2FLAGS =3D $(CFLAGS) > > PKG_CONFIG_PATH =3D @PKG_CONFIG_PATH@ > > -GUILE =3D guile > +GUILE =3D > > # Pass additional PGO and LTO compiler options to the PGO build. > BUILD_CFLAGS =3D $(PGO_BUILD_CFLAGS) $(PGO_BUILD_LTO_CFLAGS) >