GNU bug report logs - #64129
[PATCH] gnu: clang-runtime-15: Fix address sanitizer support

Previous Next

Package: guix-patches;

Reported by: Tobias Kortkamp <tobias.kortkamp <at> gmail.com>

Date: Sat, 17 Jun 2023 13:33:02 UTC

Severity: normal

Tags: patch

Done: Ludovic Courtès <ludovic.courtes <at> inria.fr>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: help-debbugs <at> gnu.org (GNU bug Tracking System)
To: Ludovic Courtès <ludovic.courtes <at> inria.fr>
Cc: tracker <at> debbugs.gnu.org
Subject: bug#64129: closed ([PATCH] gnu: clang-runtime-15: Fix address
 sanitizer support)
Date: Thu, 13 Jul 2023 16:03:01 +0000
[Message part 1 (text/plain, inline)]
Your message dated Thu, 13 Jul 2023 18:02:41 +0200
with message-id <87sf9ryf32.fsf_-_ <at> gnu.org>
and subject line Re: bug#64129: [PATCH] gnu: clang-runtime-15: Fix address sanitizer support
has caused the debbugs.gnu.org bug report #64129,
regarding [PATCH] gnu: clang-runtime-15: Fix address sanitizer support
to be marked as done.

(If you believe you have received this mail in error, please contact
help-debbugs <at> gnu.org.)


-- 
64129: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=64129
GNU Bug Tracking System
Contact help-debbugs <at> gnu.org with problems
[Message part 2 (message/rfc822, inline)]
From: Tobias Kortkamp <tobias.kortkamp <at> gmail.com>
To: guix-patches <at> gnu.org
Cc: Tobias Kortkamp <tobias.kortkamp <at> gmail.com>
Subject: [PATCH] gnu: clang-runtime-15: Fix address sanitizer support
Date: Sat, 17 Jun 2023 15:31:56 +0200
$ guix shell clang-toolchain <at> 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 <at> 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 <at> 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(-)

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

base-commit: 52f2980fa3feaf6e59b9e5144391faf8feb52a87
-- 
2.40.1



[Message part 3 (message/rfc822, inline)]
From: Ludovic Courtès <ludovic.courtes <at> inria.fr>
To: Philippe Virouleau <philippe.virouleau <at> inria.fr>, Tobias Kortkamp
 <tobias.kortkamp <at> gmail.com>
Cc: 64129-done <at> debbugs.gnu.org
Subject: Re: bug#64129: [PATCH] gnu: clang-runtime-15: Fix address sanitizer
 support
Date: Thu, 13 Jul 2023 18:02:41 +0200
Hi Tobias & Philippe,

I was reluctant about keeping all those .a files due to the extra size,
but based on your analysis, we have no choice but to keep them.

So pushed as commit ae92d98b9375e1d753bd9ab495ed5c7dcd3f1af5.

Thank you!

Ludo’.


This bug report was last modified 1 year and 313 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.