From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Sergei Trofimovich Newsgroups: gmane.lisp.guile.devel Subject: [PATCH] Test -flto on both compiler and linker Date: Sun, 20 Feb 2022 09:39:59 +0000 Message-ID: <20220220093959.3130873-1-slyich@gmail.com> Mime-Version: 1.0 Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="18348"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Sergei Trofimovich To: guile-devel@gnu.org Original-X-From: guile-devel-bounces+guile-devel=m.gmane-mx.org@gnu.org Sun Feb 20 15:42:26 2022 Return-path: Envelope-to: guile-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nLnPu-0004bl-3a for guile-devel@m.gmane-mx.org; Sun, 20 Feb 2022 15:42:26 +0100 Original-Received: from localhost ([::1]:42858 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nLnPt-0005FO-2U for guile-devel@m.gmane-mx.org; Sun, 20 Feb 2022 09:42:25 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:53948) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nLihP-0007z9-J6 for guile-devel@gnu.org; Sun, 20 Feb 2022 04:40:11 -0500 Original-Received: from [2a00:1450:4864:20::42c] (port=40475 helo=mail-wr1-x42c.google.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nLihL-0000o2-BP for guile-devel@gnu.org; Sun, 20 Feb 2022 04:40:11 -0500 Original-Received: by mail-wr1-x42c.google.com with SMTP id f3so21764446wrh.7 for ; Sun, 20 Feb 2022 01:40:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=O2vvIfneEGBlCG4VVJrJbSizf9YkXcA0gf4bvnkoY+4=; b=m4TLuShhWP4WGorErtd0uEJFK5Kk8wXwIUv2bZSBfW+k1zf/pX6cLOBkVe6fH+6Ddb GeIEK9LLVPC/x8QZU3e9965ql5sHZ+nw1e7JoDhPkVYLd5bFQt8ytdlenDTvKyK4yoUG TZeyTkj7uwHvp5MW/EyXi9t6/wxFTj3KXDs9Aj9C0GYERizCo4iJtyi4yjo8wZO4bWOY 9j1hrj59bzO0qEWwRxK6YhfwGdMbUss7LnXsETdU/bDNk0ifOy0lz3X5DQ6XRkQNBOnZ GNx4Wq0xQjS+60RKULzXO9ZzqbKqKLX8SI0A1iRDy0n1GLxNJuQ0+DVHo6eo4XSN1cH2 Qlvw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=O2vvIfneEGBlCG4VVJrJbSizf9YkXcA0gf4bvnkoY+4=; b=ZoQV3ytsXDpOic9/nqvUSBBTy0ohl/rCJsvMra2J+/NXydKr1pwV+uh64iyp1uTRXF kqe3yegMcZTwa/it/G9PYpD0ypZcRgwmBedhsv/06mGekvyrdVof3Uj2k78F7RNs2eh7 QEXKFEO1VLm0Wah9lY4hiqpz0nFtT7H7i97jwAy0reKtn/K7m+vAceIatMxh9r2ZbRGy 2uryrVOxb1TxjNM/HOr8YNw4L14AHg+79XNfiqL3lda82XrqqpDAUZbTjbNVmI1YF4+n K3B2vyBQ62WocO+uUpIy276awvza2U4+8PLhGhYy02gEr4C1RLFXmr9AdfkXAR0wzyVg RyNQ== X-Gm-Message-State: AOAM5306GQgxeMPGf5skfuDIRHMOWZm16dqfZuIBv+gPdvP2hGQART5q hLb5bDeYZbiqaLp8IfrjG4E= X-Google-Smtp-Source: ABdhPJw71XFhLjuzLZ0nA4hAzm4iu5qn4MV3/Ra2e5KtOHLs1jl5rS/oNYV449pJleX6dj1Zym0H2g== X-Received: by 2002:a5d:648b:0:b0:1e2:181:96cb with SMTP id o11-20020a5d648b000000b001e2018196cbmr11884675wri.508.1645350005424; Sun, 20 Feb 2022 01:40:05 -0800 (PST) Original-Received: from nz.home (host81-129-87-131.range81-129.btcentralplus.com. [81.129.87.131]) by smtp.gmail.com with ESMTPSA id s7sm17063438wro.104.2022.02.20.01.40.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 20 Feb 2022 01:40:04 -0800 (PST) Original-Received: by nz.home (Postfix, from userid 1000) id 057302060B3AE; Sun, 20 Feb 2022 09:40:04 +0000 (GMT) X-Mailer: git-send-email 2.35.1 X-Host-Lookup-Failed: Reverse DNS lookup failed for 2a00:1450:4864:20::42c (failed) Received-SPF: pass client-ip=2a00:1450:4864:20::42c; envelope-from=slyich@gmail.com; helo=mail-wr1-x42c.google.com X-Spam_score_int: -6 X-Spam_score: -0.7 X-Spam_bar: / X-Spam_report: (-0.7 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, PDS_HP_HELO_NORDNS=0.659, RCVD_IN_DNSWL_NONE=-0.0001, RDNS_NONE=0.793, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=no autolearn_force=no X-Spam_action: no action X-Mailman-Approved-At: Sun, 20 Feb 2022 09:42:04 -0500 X-BeenThere: guile-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Developers list for Guile, the GNU extensibility library" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guile-devel-bounces+guile-devel=m.gmane-mx.org@gnu.org Original-Sender: "guile-devel" Xref: news.gmane.io gmane.lisp.guile.devel:21136 Archived-At: Before the change ./configure incorrectly enabled -flto on toolchains that support -flto on compiler side but don't support -flto on linker side. This caused incorrect type size detection on nixpkgs' Darwin: configure:54594: checking size of size_t configure:54600: clang -std=gnu11 -o conftest -g -O2 -flto conftest.c >&5 ld: warning: ignoring file /private/tmp/nix-build-guile-3.0.8.drv-0/conftest-00e93d.o, building for macOS-x86_64 but attempting to link with file built for unknown-unsupported file format ( 0xDE 0xC0 0x17 0x0B 0x00 0x00 0x00 0x00 0x14 0x00 0x00 0x00 0x80 0x1A 0x00 0x00 ) Undefined symbols for architecture x86_64: "_main", referenced from: implicit entry/start for main executable ld: symbol(s) not found for architecture x86_64 clang-11: error: linker command failed with exit code 1 (use -v to see invocation) Taken from https://github.com/NixOS/nixpkgs/pull/160051#issuecomment-1046105041 The change makes sure -flto support tests basic support of just for object file generation but for linker as well. * configure.ac: use AC_LINK_IFELSE instead of AC_COMPILE_IFELSE. --- configure.ac | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index 827e1c09d..4064533b3 100644 --- a/configure.ac +++ b/configure.ac @@ -69,7 +69,7 @@ AC_MSG_CHECKING([whether the compiler supports -flto]) old_CFLAGS="$CFLAGS" LTO_CFLAGS="-flto" CFLAGS="$CFLAGS $LTO_CFLAGS" -AC_COMPILE_IFELSE([AC_LANG_SOURCE([int foo;])],, [LTO_CFLAGS=]) +AC_LINK_IFELSE([AC_LANG_PROGRAM([int foo;], [])],, [LTO_CFLAGS=]) CFLAGS="$old_CFLAGS" if test -n "$LTO_CFLAGS"; then AC_MSG_RESULT([yes]) -- 2.35.1