all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* [PATCH] gnu: clang-runtime: New package, propagated by clang.
@ 2015-08-17  8:48 Andy Wingo
  2015-08-24 15:51 ` Mark H Weaver
  2015-08-24 22:21 ` Mark H Weaver
  0 siblings, 2 replies; 4+ messages in thread
From: Andy Wingo @ 2015-08-17  8:48 UTC (permalink / raw)
  To: guix-devel

[-- Attachment #1: Type: text/plain, Size: 150 bytes --]

This patch lets -fsanitize=thread work.  It also lets packages build
which include the <sanitize/tsan_interface_atomic.h> and related
headers.

Andy


[-- Attachment #2: 0001-gnu-clang-runtime-New-package-propagated-by-clang.patch --]
[-- Type: text/plain, Size: 4793 bytes --]

From abca4b3b20a94c16131f521e35c63ffaf50ec45b Mon Sep 17 00:00:00 2001
From: Andy Wingo <wingo@igalia.com>
Date: Mon, 17 Aug 2015 09:21:09 +0200
Subject: [PATCH] gnu: clang-runtime: New package, propagated by clang.

* gnu/packages/llvm.scm (clang-runtime-from-llvm): New function.
  (clang-from-llvm): Add clang-runtime argument and propagate clang-runtime
  input.
  (clang-runtime, clang-runtime-3.5): New variables.
  (clang, clang-3.5): Adapt to propagate clang-runtime modules.
---
 gnu/packages/llvm.scm | 59 ++++++++++++++++++++++++++++++++++++++++++++-------
 1 file changed, 51 insertions(+), 8 deletions(-)

diff --git a/gnu/packages/llvm.scm b/gnu/packages/llvm.scm
index 2c96e9d..2f315a3 100644
--- a/gnu/packages/llvm.scm
+++ b/gnu/packages/llvm.scm
@@ -62,7 +62,34 @@ languages is in development.  The compiler infrastructure includes mirror sets
 of programming tools as well as libraries with equivalent functionality.")
     (license ncsa)))
 
-(define (clang-from-llvm llvm hash)
+(define (clang-runtime-from-llvm llvm hash)
+  (package
+    (name "clang-runtime")
+    (version (package-version llvm))
+    (source
+     (origin
+       (method url-fetch)
+       (uri (string-append "http://llvm.org/releases/"
+                           version "/compiler-rt-" version ".src.tar.xz"))
+       (sha256 (base32 hash))))
+    (build-system cmake-build-system)
+    (native-inputs (package-native-inputs llvm))
+    (inputs
+     `(("llvm" ,llvm)))
+    (arguments
+     `(;; Don't use '-g' during the build to save space.
+       #:build-type "Release"))
+
+    (home-page "http://compiler-rt.llvm.org")
+    (synopsis "Runtime library for Clang/LLVM")
+    (description
+     "The \"clang-runtime\" library provides the implementations of run-time
+functions for C and C++ programs.  It also provides header files that allow C
+and C++ source code to interface with the \"sanitization\" passes of the clang
+compiler.  In LLVM this library is called \"compiler-rt\".")
+    (license ncsa)))
+
+(define (clang-from-llvm llvm clang-runtime hash)
   (package
     (name "clang")
     (version (package-version llvm))
@@ -83,7 +110,8 @@ of programming tools as well as libraries with equivalent functionality.")
        ("gcc-lib" ,gcc "lib")
        ,@(package-inputs llvm)))
     (propagated-inputs
-     `(("llvm" ,llvm)))
+     `(("llvm" ,llvm)
+       ("clang-runtime" ,clang-runtime)))
     (arguments
      `(#:configure-flags
        (list "-DCLANG_INCLUDE_TESTS=True"
@@ -104,13 +132,18 @@ of programming tools as well as libraries with equivalent functionality.")
                   (add-after
                    'unpack 'set-glibc-file-names
                    (lambda* (#:key inputs #:allow-other-keys)
-                     (let ((libc (assoc-ref inputs "libc")))
-                       ;; Patch the 'getLinuxDynamicLinker' function to that
-                       ;; it uses the right dynamic linker file name.
+                     (let ((libc (assoc-ref inputs "libc"))
+                           (compiler-rt (assoc-ref inputs "clang-runtime")))
                        (substitute* "lib/Driver/Tools.cpp"
+                         ;; Patch the 'getLinuxDynamicLinker' function to that
+                         ;; it uses the right dynamic linker file name.
                          (("/lib64/ld-linux-x86-64.so.2")
                           (string-append libc
-                                         ,(glibc-dynamic-linker))))
+                                         ,(glibc-dynamic-linker)))
+
+                         ;; Link to libclang_rt files from clang-runtime.
+                         (("TC\\.getDriver\\(\\)\\.ResourceDir")
+                          (string-append "\"" compiler-rt "\"")))
 
                        ;; Same for libc's libdir, to allow crt1.o & co. to be
                        ;; found.
@@ -136,8 +169,13 @@ project includes the Clang front end, the Clang static analyzer, and several
 code analysis tools.")
     (license ncsa)))
 
+(define-public clang-runtime
+  (clang-runtime-from-llvm
+   llvm
+   "04bbn946jninynkrjyp337xqs8ihn4fkz5xgvmywxkddwmwznjbz"))
+
 (define-public clang
-  (clang-from-llvm llvm
+  (clang-from-llvm llvm clang-runtime
                    "0b8825mvdhfk5r9gwcwp1j2dl9kw5glgyk7pybq2dzhrh4vnj3my"))
 
 (define-public llvm-3.5
@@ -152,6 +190,11 @@ code analysis tools.")
         (base32
          "00swb43mzlvda8306arlg2jw7g6k3acwfccgf1k4c2pgd3rrkq98"))))))
 
+(define-public clang-runtime-3.5
+  (clang-runtime-from-llvm
+   llvm-3.5
+   "0dl1kbrhz96djsxqr61iw5h788s7ncfpfb7aayixky1bhdaydcx4"))
+
 (define-public clang-3.5
-  (clang-from-llvm llvm-3.5
+  (clang-from-llvm llvm-3.5 clang-runtime-3.5
                    "12yv3jwdjcbkrx7zjm8wh4jrvb59v8fdw4mnmz3zc1jb00p9k07w"))
-- 
2.4.3


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] gnu: clang-runtime: New package, propagated by clang.
  2015-08-17  8:48 [PATCH] gnu: clang-runtime: New package, propagated by clang Andy Wingo
@ 2015-08-24 15:51 ` Mark H Weaver
  2015-08-24 22:21 ` Mark H Weaver
  1 sibling, 0 replies; 4+ messages in thread
From: Mark H Weaver @ 2015-08-24 15:51 UTC (permalink / raw)
  To: Andy Wingo; +Cc: guix-devel

Andy Wingo <wingo@igalia.com> writes:

> This patch lets -fsanitize=thread work.  It also lets packages build
> which include the <sanitize/tsan_interface_atomic.h> and related
> headers.
>
> Andy
>
> From abca4b3b20a94c16131f521e35c63ffaf50ec45b Mon Sep 17 00:00:00 2001
> From: Andy Wingo <wingo@igalia.com>
> Date: Mon, 17 Aug 2015 09:21:09 +0200
> Subject: [PATCH] gnu: clang-runtime: New package, propagated by clang.

Pushed.  Thank you!

     Mark

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] gnu: clang-runtime: New package, propagated by clang.
  2015-08-17  8:48 [PATCH] gnu: clang-runtime: New package, propagated by clang Andy Wingo
  2015-08-24 15:51 ` Mark H Weaver
@ 2015-08-24 22:21 ` Mark H Weaver
  2015-08-25  7:30   ` Andy Wingo
  1 sibling, 1 reply; 4+ messages in thread
From: Mark H Weaver @ 2015-08-24 22:21 UTC (permalink / raw)
  To: Andy Wingo; +Cc: guix-devel

Andy Wingo <wingo@igalia.com> writes:

> From abca4b3b20a94c16131f521e35c63ffaf50ec45b Mon Sep 17 00:00:00 2001
> From: Andy Wingo <wingo@igalia.com>
> Date: Mon, 17 Aug 2015 09:21:09 +0200
> Subject: [PATCH] gnu: clang-runtime: New package, propagated by clang.

A bit late, since I already pushed it, but I noticed that Debian doesn't
have any "clang-runtime" package, but has an "llvm-runtime" package.  Is
that what this package should be called?

      Mark

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] gnu: clang-runtime: New package, propagated by clang.
  2015-08-24 22:21 ` Mark H Weaver
@ 2015-08-25  7:30   ` Andy Wingo
  0 siblings, 0 replies; 4+ messages in thread
From: Andy Wingo @ 2015-08-25  7:30 UTC (permalink / raw)
  To: Mark H Weaver; +Cc: guix-devel

On Tue 25 Aug 2015 00:21, Mark H Weaver <mhw@netris.org> writes:

> Andy Wingo <wingo@igalia.com> writes:
>
>> From abca4b3b20a94c16131f521e35c63ffaf50ec45b Mon Sep 17 00:00:00 2001
>> From: Andy Wingo <wingo@igalia.com>
>> Date: Mon, 17 Aug 2015 09:21:09 +0200
>> Subject: [PATCH] gnu: clang-runtime: New package, propagated by clang.
>
> A bit late, since I already pushed it, but I noticed that Debian doesn't
> have any "clang-runtime" package, but has an "llvm-runtime" package.  Is
> that what this package should be called?

I don't think so but I don't know.  Upstream the package is called
compiler-rt.  AFAICT it's really for the C/C++ front end as its job is
mostly to support "sanitizers" for C/C++ semantics, and indeed in Guix
it's used by the clang (cfe) package and not by the llvm package.  Happy
to change names of course, but it seems to me that clang-runtime is the
better name, and given that upstream doesn't give us a usable name I
think we're free to choose whatever we like.

Cheers,

Andy

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2015-08-25  7:30 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-08-17  8:48 [PATCH] gnu: clang-runtime: New package, propagated by clang Andy Wingo
2015-08-24 15:51 ` Mark H Weaver
2015-08-24 22:21 ` Mark H Weaver
2015-08-25  7:30   ` Andy Wingo

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/guix.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.