File: hardening.patch

package info (click to toggle)
libclc 0.2.0%2Bgit20160907-4
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 2,540 kB
  • ctags: 968
  • sloc: lisp: 7,842; ansic: 1,787; python: 623; cpp: 74; makefile: 10; pascal: 7; sh: 1
file content (42 lines) | stat: -rw-r--r-- 1,636 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
description: enable build hardening flags
author: Michael Gilbert <mgilbert@debian.org>

--- a/configure.py
+++ b/configure.py
@@ -81,6 +81,13 @@ llvm_core_libs = llvm_config(['--libs',
 llvm_cxxflags = llvm_config(['--cxxflags']) + ' -fno-exceptions -fno-rtti'
 llvm_libdir = llvm_config(['--libdir'])
 
+# add in debian buildflags
+proc_ldflags = Popen(("dpkg-buildflags","--get","LDFLAGS"), stdout=PIPE)
+proc_cxxflags = Popen(("dpkg-buildflags","--get","CXXFLAGS"), stdout=PIPE)
+llvm_core_libs += " " + proc_ldflags.communicate()[0].strip("\n")
+llvm_cxxflags = llvm_cxxflags.replace(" -fPIC","")
+llvm_cxxflags += " " + proc_cxxflags.communicate()[0].strip("\n")
+
 llvm_clang = os.path.join(llvm_bindir, 'clang')
 llvm_link = os.path.join(llvm_bindir, 'llvm-link')
 llvm_opt = os.path.join(llvm_bindir, 'opt')
@@ -187,6 +194,11 @@ for target in targets:
                      "-emit-llvm" % (target, clang_cl_includes)
     if device['gpu'] != '':
       clang_bc_flags += ' -mcpu=' + device['gpu']
+
+    # add in debian build flags
+    proc_cflags = Popen(("dpkg-buildflags","--get","CFLAGS"), stdout=PIPE)
+    clang_bc_flags += " " + proc_cflags.communicate()[0].strip("\n")
+
     clang_bc_rule = "CLANG_CL_BC_" + target + "_" + device['gpu']
     c_compiler_rule(b, clang_bc_rule, "LLVM-CC", llvm_clang, clang_bc_flags)
 
--- a/build/metabuild.py
+++ b/build/metabuild.py
@@ -48,7 +48,7 @@ endif
 
     r = self.rules[rule]
     command = subst(r['command'])
-    if r['description']:
+    if False:
       desc = subst(r['description'])
       self.output.write('\t@echo %s\n\t$(Verb) %s\n' % (desc, command))
     else: