summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--meta/conf/distro/include/security_flags.inc1
-rw-r--r--meta/conf/distro/include/tcmode-default.inc2
-rw-r--r--meta/recipes-devtools/gcc/gcc-sanitizers.inc111
-rw-r--r--meta/recipes-devtools/gcc/gcc-sanitizers_4.8.bb2
-rw-r--r--meta/recipes-devtools/gcc/gcc-sanitizers_4.9.bb2
5 files changed, 118 insertions, 0 deletions
diff --git a/meta/conf/distro/include/security_flags.inc b/meta/conf/distro/include/security_flags.inc
index d6f7e9c8cc..f996184b25 100644
--- a/meta/conf/distro/include/security_flags.inc
+++ b/meta/conf/distro/include/security_flags.inc
@@ -29,6 +29,7 @@ SECURITY_CFLAGS_pn-glibc-initial = ""
29SECURITY_CFLAGS_pn-enchant = "${SECURITY_NO_PIE_CFLAGS}" 29SECURITY_CFLAGS_pn-enchant = "${SECURITY_NO_PIE_CFLAGS}"
30SECURITY_CFLAGS_pn-flac = "${SECURITY_NO_PIE_CFLAGS}" 30SECURITY_CFLAGS_pn-flac = "${SECURITY_NO_PIE_CFLAGS}"
31SECURITY_CFLAGS_pn-gcc-runtime = "${SECURITY_NO_PIE_CFLAGS}" 31SECURITY_CFLAGS_pn-gcc-runtime = "${SECURITY_NO_PIE_CFLAGS}"
32SECURITY_CFLAGS_pn-gcc-sanitizers = "${SECURITY_NO_PIE_CFLAGS}"
32SECURITY_CFLAGS_pn-gdb = "${SECURITY_NO_PIE_CFLAGS}" 33SECURITY_CFLAGS_pn-gdb = "${SECURITY_NO_PIE_CFLAGS}"
33SECURITY_CFLAGS_pn-gmp = "${SECURITY_NO_PIE_CFLAGS}" 34SECURITY_CFLAGS_pn-gmp = "${SECURITY_NO_PIE_CFLAGS}"
34SECURITY_CFLAGS_pn-gnutls = "${SECURITY_NO_PIE_CFLAGS}" 35SECURITY_CFLAGS_pn-gnutls = "${SECURITY_NO_PIE_CFLAGS}"
diff --git a/meta/conf/distro/include/tcmode-default.inc b/meta/conf/distro/include/tcmode-default.inc
index 2b4109053b..b4c3c70823 100644
--- a/meta/conf/distro/include/tcmode-default.inc
+++ b/meta/conf/distro/include/tcmode-default.inc
@@ -36,8 +36,10 @@ PREFERRED_VERSION_gcc-crosssdk-${SDK_ARCH} ?= "${SDKGCCVERSION}"
36PREFERRED_VERSION_gcc-crosssdk-initial-${SDK_ARCH} ?= "${SDKGCCVERSION}" 36PREFERRED_VERSION_gcc-crosssdk-initial-${SDK_ARCH} ?= "${SDKGCCVERSION}"
37PREFERRED_VERSION_gcc-cross-canadian-${TRANSLATED_TARGET_ARCH} ?= "${GCCVERSION}" 37PREFERRED_VERSION_gcc-cross-canadian-${TRANSLATED_TARGET_ARCH} ?= "${GCCVERSION}"
38PREFERRED_VERSION_gcc-runtime ?= "${GCCVERSION}" 38PREFERRED_VERSION_gcc-runtime ?= "${GCCVERSION}"
39PREFERRED_VERSION_gcc-sanitizers ?= "${GCCVERSION}"
39PREFERRED_VERSION_gcc-source ?= "${GCCVERSION}" 40PREFERRED_VERSION_gcc-source ?= "${GCCVERSION}"
40PREFERRED_VERSION_nativesdk-gcc-runtime ?= "${SDKGCCVERSION}" 41PREFERRED_VERSION_nativesdk-gcc-runtime ?= "${SDKGCCVERSION}"
42PREFERRED_VERSION_nativesdk-gcc-sanitizers ?= "${GCCVERSION}"
41PREFERRED_VERSION_libgcc ?= "${GCCVERSION}" 43PREFERRED_VERSION_libgcc ?= "${GCCVERSION}"
42PREFERRED_VERSION_libgcc-initial ?= "${GCCVERSION}" 44PREFERRED_VERSION_libgcc-initial ?= "${GCCVERSION}"
43PREFERRED_VERSION_nativesdk-libgcc ?= "${SDKGCCVERSION}" 45PREFERRED_VERSION_nativesdk-libgcc ?= "${SDKGCCVERSION}"
diff --git a/meta/recipes-devtools/gcc/gcc-sanitizers.inc b/meta/recipes-devtools/gcc/gcc-sanitizers.inc
new file mode 100644
index 0000000000..892dfe0476
--- /dev/null
+++ b/meta/recipes-devtools/gcc/gcc-sanitizers.inc
@@ -0,0 +1,111 @@
1require gcc-configure-common.inc
2
3EXTRA_OECONF_PATHS = "\
4 --with-sysroot=/not/exist \
5 --with-build-sysroot=${STAGING_DIR_TARGET} \
6"
7
8do_configure () {
9 mtarget=`echo ${TARGET_SYS} | sed -e s#-${SDKPKGSUFFIX}##`
10 target=`echo ${TARGET_SYS} | sed -e s#-${SDKPKGSUFFIX}##`
11 hardlinkdir ${STAGING_INCDIR_NATIVE}/gcc-build-internal-$mtarget ${B}
12
13 echo "Configuring libsanitizer"
14 rm -rf ${B}/$target/libsanitizer/
15 mkdir -p ${B}/$target/libsanitizer/
16 # This is kind of gross, but it's an easy way to make configure happy
17 # without hacking it up to use the system stdc++ instead of the one it
18 # expects to be newly built.
19 rm -rf ${B}/$target/libstdc++-v3/
20 mkdir -p ${B}/$target/libstdc++-v3/src/
21 ln -s ${STAGING_LIBDIR}/libstdc++.la ${B}/$target/libstdc++-v3/src/
22 ln -s ${STAGING_LIBDIR}/libstdc++.so ${B}/$target/libstdc++-v3/src/
23 cd ${B}/$target/libsanitizer/
24 chmod a+x ${S}/libsanitizer/configure
25 ${S}/libsanitizer/configure ${CONFIGUREOPTS} ${EXTRA_OECONF}
26 # Easiest way to stop bad RPATHs getting into the library since we have a
27 # broken libtool here
28 sed -i -e 's/hardcode_into_libs=yes/hardcode_into_libs=no/' ${B}/$target/libsanitizer/libtool
29}
30
31do_compile () {
32 target=`echo ${TARGET_SYS} | sed -e s#-${SDKPKGSUFFIX}##`
33 cd ${B}/$target/libsanitizer/
34 oe_runmake MULTIBUILDTOP=${B}/$target/libsanitizer/
35}
36
37do_install () {
38 target=`echo ${TARGET_SYS} | sed -e s#-${SDKPKGSUFFIX}##`
39 cd ${B}/$target/libsanitizer/
40 oe_runmake 'DESTDIR=${D}' MULTIBUILDTOP=${B}/$target/libsanitizer/ install
41 if [ -d ${D}${infodir} ]; then
42 rmdir --ignore-fail-on-non-empty -p ${D}${infodir}
43 fi
44 chown -R root:root ${D}
45}
46
47INHIBIT_DEFAULT_DEPS = "1"
48ALLOW_EMPTY_${PN} = "1"
49DEPENDS = "gcc-runtime"
50
51BBCLASSEXTEND = "nativesdk"
52
53PACKAGES = "${PN}"
54PACKAGES += "libasan libubsan liblsan libtsan"
55PACKAGES += "libasan-dev libubsan-dev liblsan-dev libtsan-dev"
56PACKAGES += "libasan-dbg libubsan-dbg liblsan-dbg libtsan-dbg"
57PACKAGES += "libasan-staticdev libubsan-staticdev liblsan-staticdev libtsan-staticdev"
58
59RDEPENDS_libasan += "libstdc++"
60RDEPENDS_libubsan += "libstdc++"
61RDEPENDS_liblsan += "libstdc++"
62RDEPENDS_libtsan += "libstdc++"
63RDEPENDS_libasan-dev += "${PN}"
64RDEPENDS_libubsan-dev += "${PN}"
65RDEPENDS_liblsan-dev += "${PN}"
66RDEPENDS_libtsan-dev += "${PN}"
67RRECOMMENDS_${PN} += "libasan libubsan"
68RRECOMMENDS_${PN}_append_x86-64 = " liblsan libtsan"
69RRECOMMENDS_${PN}_append_x86 = " liblsan"
70
71do_package_write_ipk[depends] += "virtual/${MLPREFIX}${TARGET_PREFIX}compilerlibs:do_packagedata"
72do_package_write_deb[depends] += "virtual/${MLPREFIX}${TARGET_PREFIX}compilerlibs:do_packagedata"
73do_package_write_rpm[depends] += "virtual/${MLPREFIX}${TARGET_PREFIX}compilerlibs:do_packagedata"
74
75# MIPS, aarch64, and SPARC are broken.
76COMPATIBLE_HOST = '(x86_64|i.86|powerpc|arm).*-linux'
77
78FILES_libasan += "${libdir}/libasan.so.*"
79FILES_libasan-dbg += "${libdir}/.debug/libasan.so.*"
80FILES_libasan-dev += "\
81 ${libdir}/libasan_preinit.o \
82 ${libdir}/libasan.so \
83 ${libdir}/libasan.la \
84"
85FILES_libasan-staticdev += "${libdir}/libasan.a"
86
87FILES_libubsan += "${libdir}/libubsan.so.*"
88FILES_libubsan-dbg += "${libdir}/.debug/libubsan.so.*"
89FILES_libubsan-dev += "\
90 ${libdir}/libubsan.so \
91 ${libdir}/libubsan.la \
92"
93FILES_libubsan-staticdev += "${libdir}/libubsan.a"
94
95FILES_liblsan += "${libdir}/liblsan.so.*"
96FILES_liblsan-dbg += "${libdir}/.debug/liblsan.so.*"
97FILES_liblsan-dev += "\
98 ${libdir}/liblsan.so \
99 ${libdir}/liblsan.la \
100"
101FILES_liblsan-staticdev += "${libdir}/liblsan.a"
102
103FILES_libtsan += "${libdir}/libtsan.so.*"
104FILES_libtsan-dbg += "${libdir}/.debug/libtsan.so.*"
105FILES_libtsan-dev += "\
106 ${libdir}/libtsan.so \
107 ${libdir}/libtsan.la \
108"
109FILES_libtsan-staticdev += "${libdir}/libtsan.a"
110
111FILES_${PN} = "${libdir}/*.spec ${libdir}/gcc/${TARGET_SYS}/${BINV}/include/sanitizer/*.h"
diff --git a/meta/recipes-devtools/gcc/gcc-sanitizers_4.8.bb b/meta/recipes-devtools/gcc/gcc-sanitizers_4.8.bb
new file mode 100644
index 0000000000..601f666023
--- /dev/null
+++ b/meta/recipes-devtools/gcc/gcc-sanitizers_4.8.bb
@@ -0,0 +1,2 @@
1require recipes-devtools/gcc/gcc-${PV}.inc
2require gcc-sanitizers.inc
diff --git a/meta/recipes-devtools/gcc/gcc-sanitizers_4.9.bb b/meta/recipes-devtools/gcc/gcc-sanitizers_4.9.bb
new file mode 100644
index 0000000000..601f666023
--- /dev/null
+++ b/meta/recipes-devtools/gcc/gcc-sanitizers_4.9.bb
@@ -0,0 +1,2 @@
1require recipes-devtools/gcc/gcc-${PV}.inc
2require gcc-sanitizers.inc