diff options
Diffstat (limited to 'meta-microblaze/recipes-devtools/gcc/gcc-sanitizers.inc')
-rw-r--r-- | meta-microblaze/recipes-devtools/gcc/gcc-sanitizers.inc | 120 |
1 files changed, 120 insertions, 0 deletions
diff --git a/meta-microblaze/recipes-devtools/gcc/gcc-sanitizers.inc b/meta-microblaze/recipes-devtools/gcc/gcc-sanitizers.inc new file mode 100644 index 00000000..f6aa9c99 --- /dev/null +++ b/meta-microblaze/recipes-devtools/gcc/gcc-sanitizers.inc | |||
@@ -0,0 +1,120 @@ | |||
1 | require gcc-configure-common.inc | ||
2 | |||
3 | LICENSE = "NCSA | MIT" | ||
4 | |||
5 | LIC_FILES_CHKSUM = "\ | ||
6 | file://libsanitizer/LICENSE.TXT;md5=0249c37748936faf5b1efd5789587909 \ | ||
7 | " | ||
8 | |||
9 | EXTRA_OECONF_PATHS = "\ | ||
10 | --with-sysroot=/not/exist \ | ||
11 | --with-build-sysroot=${STAGING_DIR_TARGET} \ | ||
12 | " | ||
13 | |||
14 | do_configure () { | ||
15 | rm -rf ${B}/${TARGET_SYS}/libsanitizer/ | ||
16 | mkdir -p ${B}/${TARGET_SYS}/libsanitizer/ | ||
17 | cd ${B}/${TARGET_SYS}/libsanitizer/ | ||
18 | chmod a+x ${S}/libsanitizer/configure | ||
19 | relpath=${@os.path.relpath("${S}/libsanitizer", "${B}/${TARGET_SYS}/libsanitizer")} | ||
20 | $relpath/configure ${CONFIGUREOPTS} ${EXTRA_OECONF} | ||
21 | # Easiest way to stop bad RPATHs getting into the library since we have a | ||
22 | # broken libtool here | ||
23 | sed -i -e 's/hardcode_into_libs=yes/hardcode_into_libs=no/' ${B}/${TARGET_SYS}/libsanitizer/libtool | ||
24 | # Link to the sysroot's libstdc++ instead of one gcc thinks it just built | ||
25 | sed -i -e '/LIBSTDCXX_RAW_CXX_\(CXXFLAGS\|LDFLAGS\)\s*=/d' ${B}/${TARGET_SYS}/libsanitizer/*/Makefile | ||
26 | } | ||
27 | EXTRACONFFUNCS += "extract_stashed_builddir" | ||
28 | do_configure[depends] += "${COMPILERDEP}" | ||
29 | |||
30 | do_compile () { | ||
31 | cd ${B}/${TARGET_SYS}/libsanitizer/ | ||
32 | oe_runmake MULTIBUILDTOP=${B}/${TARGET_SYS}/libsanitizer/ | ||
33 | } | ||
34 | |||
35 | do_install () { | ||
36 | cd ${B}/${TARGET_SYS}/libsanitizer/ | ||
37 | oe_runmake 'DESTDIR=${D}' MULTIBUILDTOP=${B}/${TARGET_SYS}/libsanitizer/ install | ||
38 | if [ -d ${D}${libdir}/gcc/${TARGET_SYS}/${BINV}/include ]; then | ||
39 | install -d ${D}${libdir}/${TARGET_SYS}/${BINV}/include | ||
40 | mv ${D}${libdir}/gcc/${TARGET_SYS}/${BINV}/include/* ${D}${libdir}/${TARGET_SYS}/${BINV}/include | ||
41 | rmdir --ignore-fail-on-non-empty -p ${D}${libdir}/gcc/${TARGET_SYS}/${BINV}/include | ||
42 | fi | ||
43 | if [ -d ${D}${infodir} ]; then | ||
44 | rmdir --ignore-fail-on-non-empty -p ${D}${infodir} | ||
45 | fi | ||
46 | chown -R root:root ${D} | ||
47 | } | ||
48 | |||
49 | INHIBIT_DEFAULT_DEPS = "1" | ||
50 | ALLOW_EMPTY:${PN} = "1" | ||
51 | DEPENDS = "virtual/crypt gcc-runtime virtual/${TARGET_PREFIX}gcc" | ||
52 | |||
53 | # used to fix ../../../../../../../../../work-shared/gcc-8.3.0-r0/gcc-8.3.0/libsanitizer/libbacktrace/../../libbacktrace/elf.c:772:21: error: 'st.st_mode' may be used uninitialized in this function [-Werror=maybe-uninitialized] | ||
54 | DEBUG_OPTIMIZATION:append = " -Wno-error" | ||
55 | |||
56 | #BBCLASSEXTEND = "nativesdk" | ||
57 | |||
58 | PACKAGES = "${PN} ${PN}-dbg" | ||
59 | PACKAGES += "libasan libubsan liblsan libtsan" | ||
60 | PACKAGES += "libasan-dev libubsan-dev liblsan-dev libtsan-dev" | ||
61 | PACKAGES += "libasan-staticdev libubsan-staticdev liblsan-staticdev libtsan-staticdev" | ||
62 | |||
63 | RDEPENDS:libasan += "libstdc++" | ||
64 | RDEPENDS:libubsan += "libstdc++" | ||
65 | RDEPENDS:liblsan += "libstdc++" | ||
66 | RDEPENDS:libtsan += "libstdc++" | ||
67 | RDEPENDS:libasan-dev += "${PN}" | ||
68 | RDEPENDS:libubsan-dev += "${PN}" | ||
69 | RDEPENDS:liblsan-dev += "${PN}" | ||
70 | RDEPENDS:libtsan-dev += "${PN}" | ||
71 | RRECOMMENDS:${PN} += "libasan libubsan" | ||
72 | RRECOMMENDS:${PN}:append:x86 = " liblsan" | ||
73 | RRECOMMENDS:${PN}:append:x86-64 = " liblsan libtsan" | ||
74 | RRECOMMENDS:${PN}:append:powerpc64 = " liblsan libtsan" | ||
75 | RRECOMMENDS:${PN}:append:aarch64 = " liblsan libtsan" | ||
76 | |||
77 | do_package_write_ipk[depends] += "virtual/${MLPREFIX}${TARGET_PREFIX}compilerlibs:do_packagedata" | ||
78 | do_package_write_deb[depends] += "virtual/${MLPREFIX}${TARGET_PREFIX}compilerlibs:do_packagedata" | ||
79 | do_package_write_rpm[depends] += "virtual/${MLPREFIX}${TARGET_PREFIX}compilerlibs:do_packagedata" | ||
80 | |||
81 | # Only x86, powerpc, sparc, s390, arm, and aarch64 are supported | ||
82 | COMPATIBLE_HOST = '(x86_64|i.86|powerpc|sparc|s390|arm|aarch64).*-linux' | ||
83 | # musl is currently broken entirely | ||
84 | COMPATIBLE_HOST:libc-musl = 'null' | ||
85 | |||
86 | FILES:libasan += "${libdir}/libasan.so.* ${libdir}/libhwasan.so.*" | ||
87 | FILES:libasan-dev += "\ | ||
88 | ${libdir}/libasan_preinit.o \ | ||
89 | ${libdir}/libasan.so \ | ||
90 | ${libdir}/libhwasan.so \ | ||
91 | ${libdir}/libasan.la \ | ||
92 | " | ||
93 | FILES:libasan-staticdev += "${libdir}/libasan.a \ | ||
94 | ${libdir}/libhwasan.a \ | ||
95 | " | ||
96 | |||
97 | FILES:libubsan += "${libdir}/libubsan.so.*" | ||
98 | FILES:libubsan-dev += "\ | ||
99 | ${libdir}/libubsan.so \ | ||
100 | ${libdir}/libubsan.la \ | ||
101 | " | ||
102 | FILES:libubsan-staticdev += "${libdir}/libubsan.a" | ||
103 | |||
104 | FILES:liblsan += "${libdir}/liblsan.so.*" | ||
105 | FILES:liblsan-dev += "\ | ||
106 | ${libdir}/liblsan.so \ | ||
107 | ${libdir}/liblsan.la \ | ||
108 | ${libdir}/liblsan_preinit.o \ | ||
109 | " | ||
110 | FILES:liblsan-staticdev += "${libdir}/liblsan.a" | ||
111 | |||
112 | FILES:libtsan += "${libdir}/libtsan.so.*" | ||
113 | FILES:libtsan-dev += "\ | ||
114 | ${libdir}/libtsan.so \ | ||
115 | ${libdir}/libtsan.la \ | ||
116 | ${libdir}/libtsan_*.o \ | ||
117 | " | ||
118 | FILES:libtsan-staticdev += "${libdir}/libtsan.a" | ||
119 | |||
120 | FILES:${PN} = "${libdir}/*.spec ${libdir}/${TARGET_SYS}/${BINV}/include/sanitizer/*.h" | ||