From patchwork Sat Jun 17 13:31:56 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tobias Kortkamp X-Patchwork-Id: 50999 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id 409EB27BBEA; Sat, 17 Jun 2023 14:33:25 +0100 (BST) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-2.7 required=5.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_INVALID,DKIM_SIGNED,FREEMAIL_FROM,MAILING_LIST_MULTI, SPF_HELO_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id EF1F927BBE2 for ; Sat, 17 Jun 2023 14:33:23 +0100 (BST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qAW37-0000Ax-OI; Sat, 17 Jun 2023 09:33:05 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qAW35-0000Aj-3Y for guix-patches@gnu.org; Sat, 17 Jun 2023 09:33:03 -0400 Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qAW34-0004n7-RG for guix-patches@gnu.org; Sat, 17 Jun 2023 09:33:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1qAW34-000350-KK for guix-patches@gnu.org; Sat, 17 Jun 2023 09:33:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#64129] [PATCH] gnu: clang-runtime-15: Fix address sanitizer support Resent-From: Tobias Kortkamp Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Sat, 17 Jun 2023 13:33:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 64129 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 64129@debbugs.gnu.org Cc: Tobias Kortkamp X-Debbugs-Original-To: guix-patches@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.168700877211815 (code B ref -1); Sat, 17 Jun 2023 13:33:02 +0000 Received: (at submit) by debbugs.gnu.org; 17 Jun 2023 13:32:52 +0000 Received: from localhost ([127.0.0.1]:51066 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qAW2u-00034U-0R for submit@debbugs.gnu.org; Sat, 17 Jun 2023 09:32:52 -0400 Received: from lists.gnu.org ([209.51.188.17]:56458) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qAW2s-00034L-6U for submit@debbugs.gnu.org; Sat, 17 Jun 2023 09:32:51 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qAW2r-0000A1-T9 for guix-patches@gnu.org; Sat, 17 Jun 2023 09:32:49 -0400 Received: from mail-ed1-x529.google.com ([2a00:1450:4864:20::529]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qAW2p-0004mF-NL for guix-patches@gnu.org; Sat, 17 Jun 2023 09:32:49 -0400 Received: by mail-ed1-x529.google.com with SMTP id 4fb4d7f45d1cf-5164c5bd369so445814a12.1 for ; Sat, 17 Jun 2023 06:32:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1687008765; x=1689600765; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=31BpmyyZ4aBBgJpyOFd40SsAlrk/pC7HTZH6ooUO5xU=; b=eTmnFC1pZdlBh/wx9ohdI/arDB0KIlXQRyrRytic+QPGYUsBCPzqMmafY2FpeexV0m cgqfK9be8rWM/ay0yLJcqYXjtmTvW2MOUtwb2oZb+NED+qBCCgiEWjLueQdtTyj5kEow 496g7C9iWipPgRPRlb4fuK4mvfC8+VYDSD5u8KSf5aPNVdS+atcLyQS/nY6IpQKXyGRO ZcCCfY8+M+4TDAmAy8Wm/vjr4qLtZYy38NftgDo8RCPHvRT2j8Ij6hdRbSQi9s2MlXhK xQfa6zrbNGbBTs4cgupAv9pSPjwi4uwEOyRvQWGOA4jVN6hlj776Iz756i4f61uuFQr0 Uu5w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687008765; x=1689600765; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=31BpmyyZ4aBBgJpyOFd40SsAlrk/pC7HTZH6ooUO5xU=; b=RNfnZmkV6QdoZNwxuZ752AAiOsJb0XU3GcapQys9qyF05oekn3UZrZBHamczg7WqZE /ELS7jXwJRTAZug8ImQ7sctyDv/G5zlTc+kvYgYSuam/h8qDxXfdAI3MPUdntKTtf8xV A+AyWgV4bqSwrZ5lHHR0zNX1aLCBhx8mYmTXB7vdhE6Y1dyR1mQmQMtclwKLRwqq2O7k Wrz1nzPJ/R/jfdm9UDXf1pbx4bXHTVcQhZJ5XSPI4gcDp5lo4f0fFRL7k/tYJM1Sog8o e7slmgZOJvwBGD/sDY8GIvuw09jpprW5zjx3PRZbb5chj2H5v3vi8IGtbOjeZLAuL6+3 ZCPQ== X-Gm-Message-State: AC+VfDzKI9Wwom6NjtW8EHRPuvX3Tsq76cZSNaCJcLCbadxmPiRa2b/g 6w0ButBr4lxZoknhYChQn9iUpFoClj0= X-Google-Smtp-Source: ACHHUZ4JfO8rstp5WE7QQqgjxmaOqXx14X4YtZ7heRVrkW86UYMgeHo113vQh84ff1obkbrRS70f4g== X-Received: by 2002:a17:906:5354:b0:986:7872:a7bc with SMTP id j20-20020a170906535400b009867872a7bcmr3155046ejo.3.1687008764776; Sat, 17 Jun 2023 06:32:44 -0700 (PDT) Received: from anubis.kortkamp.xyz (p200300ff7f008500873e7d05b0b76269.dip0.t-ipconnect.de. [2003:ff:7f00:8500:873e:7d05:b0b7:6269]) by smtp.gmail.com with ESMTPSA id e24-20020a170906081800b009786c8249d6sm12266367ejd.175.2023.06.17.06.32.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 17 Jun 2023 06:32:44 -0700 (PDT) From: Tobias Kortkamp Date: Sat, 17 Jun 2023 15:31:56 +0200 Message-Id: <5c775384d6459219465668b778bcb9ddf1c803d1.1687008629.git.tobias.kortkamp@gmail.com> X-Mailer: git-send-email 2.40.1 MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::529; envelope-from=tobias.kortkamp@gmail.com; helo=mail-ed1-x529.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 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, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org X-getmail-retrieved-from-mailbox: Patches $ guix shell clang-toolchain@15 -- clang -o test -fsanitize=address test.c ld: cannot find /gnu/store/i429h17s15g48ir9vl1bzp3cv39l5pib-clang-runtime-15.0.7/lib/linux/libclang_rt.asan_static-x86_64.a: No such file or directory ld: cannot find /gnu/store/i429h17s15g48ir9vl1bzp3cv39l5pib-clang-runtime-15.0.7/lib/linux/libclang_rt.asan-x86_64.a: No such file or directory clang-15: error: linker command failed with exit code 1 (use -v to see invocation) * gnu/packages/llvm.scm (clang-runtime-15): Fix address sanitizer support by bringing back the static libraries. --- Hi, I'm unable to compile programs with -fsanitize=address with clang-toolchain@15: #+name test.c #+begin_src c int main() { return 0; } #+end_src #+begin_quote $ guix describe Generation 46 Jun 12 2023 09:12:12 (current) guix dffaf42 repository URL: https://git.savannah.gnu.org/git/guix.git branch: master commit: dffaf42e5eac3822bd6b44e9749fc8e5f48fb99c $ guix shell clang-toolchain -- clang -o test -fsanitize=address test.c ld: cannot find /gnu/store/i429h17s15g48ir9vl1bzp3cv39l5pib-clang-runtime-15.0.7/lib/linux/libclang_rt.asan_static-x86_64.a: No such file or directory ld: cannot find /gnu/store/i429h17s15g48ir9vl1bzp3cv39l5pib-clang-runtime-15.0.7/lib/linux/libclang_rt.asan-x86_64.a: No such file or directory clang-15: error: linker command failed with exit code 1 (use -v to see invocation) #+end_quote Similar with -shared-libsan: #+begin_quote $ guix shell clang-toolchain -- clang -o test -shared-libsan -fsanitize=address test.c ld: cannot find /gnu/store/i429h17s15g48ir9vl1bzp3cv39l5pib-clang-runtime-15.0.7/lib/linux/libclang_rt.asan-preinit-x86_64.a: No such file or directory ld: cannot find /gnu/store/i429h17s15g48ir9vl1bzp3cv39l5pib-clang-runtime-15.0.7/lib/linux/libclang_rt.asan_static-x86_64.a: No such file or directory clang-15: error: linker command failed with exit code 1 (use -v to see invocation) #+end_quote With clang-toolchain@14 everything works fine. Unless I'm missing some magic flag in the clang command, I'm guessing that the reason for this is the following bad phase in the clang-runtime-15 package which is missing in clang-runtime-14: #+begin_src scheme (add-after 'install 'delete-static-libraries ;; Reduce size from 33 MiB to 7.4 MiB. (lambda _ (for-each delete-file (find-files #$output "\\.a(\\.syms)?$")))) #+end_src If I remove it then the toolchain works fine again. The phase needs to removed or fixed to not outright delete all static libraries. The patch just removes it since that's easiest. Best regards, Tobias gnu/packages/llvm.scm | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) base-commit: 52f2980fa3feaf6e59b9e5144391faf8feb52a87 diff --git a/gnu/packages/llvm.scm b/gnu/packages/llvm.scm index f59c8e9592..9764552a62 100644 --- a/gnu/packages/llvm.scm +++ b/gnu/packages/llvm.scm @@ -699,12 +699,7 @@ (define-public clang-runtime-15 #~(modify-phases #$phases (add-after 'unpack 'change-directory (lambda _ - (chdir "compiler-rt"))) - (add-after 'install 'delete-static-libraries - ;; Reduce size from 33 MiB to 7.4 MiB. - (lambda _ - (for-each delete-file - (find-files #$output "\\.a(\\.syms)?$")))))))) + (chdir "compiler-rt"))))))) (native-inputs (modify-inputs (package-native-inputs template) (prepend gcc-12))) ;libfuzzer fails to build with GCC 11