blob: caa2e2ae187397f7f9797bb6e9a93bfebad64386 [file] [log] [blame]
Andrew Geissler82c905d2020-04-13 13:39:40 -05001require glibc.inc
2require glibc-version.inc
3
William A. Kennington IIIac69b482021-06-02 12:28:27 -07004CVE_CHECK_WHITELIST += "CVE-2020-10029 CVE-2021-27645"
5
6# glibc https://web.nvd.nist.gov/view/vuln/detail?vulnId=CVE-2019-1010022
7# glibc https://web.nvd.nist.gov/view/vuln/detail?vulnId=CVE-2019-1010023
8# glibc https://web.nvd.nist.gov/view/vuln/detail?vulnId=CVE-2019-1010024
9# Upstream glibc maintainers dispute there is any issue and have no plans to address it further.
10# "this is being treated as a non-security bug and no real threat."
11CVE_CHECK_WHITELIST += "CVE-2019-1010022 CVE-2019-1010023 CVE-2019-1010024"
12
13# glibc https://web.nvd.nist.gov/view/vuln/detail?vulnId=CVE-2019-1010025
14# Allows for ASLR bypass so can bypass some hardening, not an exploit in itself, may allow
15# easier access for another. "ASLR bypass itself is not a vulnerability."
16# Potential patch at https://sourceware.org/bugzilla/show_bug.cgi?id=22853
17CVE_CHECK_WHITELIST += "CVE-2019-1010025"
Andrew Geisslerb7d28612020-07-24 16:15:54 -050018
Andrew Geissler82c905d2020-04-13 13:39:40 -050019DEPENDS += "gperf-native bison-native make-native"
20
21NATIVESDKFIXES ?= ""
22NATIVESDKFIXES_class-nativesdk = "\
23 file://0003-nativesdk-glibc-Look-for-host-system-ld.so.cache-as-.patch \
24 file://0004-nativesdk-glibc-Fix-buffer-overrun-with-a-relocated-.patch \
25 file://0005-nativesdk-glibc-Raise-the-size-of-arrays-containing-.patch \
26 file://0006-nativesdk-glibc-Allow-64-bit-atomics-for-x86.patch \
27 file://0007-nativesdk-glibc-Make-relocatable-install-for-locales.patch \
Andrew Geissler9b4d8b02021-02-19 12:26:16 -060028 file://faccessat2-perm.patch \
Andrew Geissler82c905d2020-04-13 13:39:40 -050029"
30
31SRC_URI = "${GLIBC_GIT_URI};branch=${SRCBRANCH};name=glibc \
32 file://etc/ld.so.conf \
33 file://generate-supported.mk \
34 file://makedbs.sh \
35 \
36 ${NATIVESDKFIXES} \
37 file://0008-fsl-e500-e5500-e6500-603e-fsqrt-implementation.patch \
Andrew Geissler635e0e42020-08-21 15:58:33 -050038 file://0009-ppc-sqrt-Fix-undefined-reference-to-__sqrt_finite.patch \
39 file://0010-__ieee754_sqrt-f-are-now-inline-functions-and-call-o.patch \
40 file://0011-Quote-from-bug-1443-which-explains-what-the-patch-do.patch \
41 file://0012-eglibc-run-libm-err-tab.pl-with-specific-dirs-in-S.patch \
42 file://0013-__ieee754_sqrt-f-are-now-inline-functions-and-call-o.patch \
43 file://0014-sysdeps-gnu-configure.ac-handle-correctly-libc_cv_ro.patch \
44 file://0015-yes-within-the-path-sets-wrong-config-variables.patch \
45 file://0016-timezone-re-written-tzselect-as-posix-sh.patch \
46 file://0017-Remove-bash-dependency-for-nscd-init-script.patch \
47 file://0018-eglibc-Cross-building-and-testing-instructions.patch \
48 file://0019-eglibc-Help-bootstrap-cross-toolchain.patch \
49 file://0020-eglibc-Resolve-__fpscr_values-on-SH4.patch \
50 file://0021-eglibc-Forward-port-cross-locale-generation-support.patch \
51 file://0022-Define-DUMMY_LOCALE_T-if-not-defined.patch \
52 file://0023-localedef-add-to-archive-uses-a-hard-coded-locale-pa.patch \
53 file://0024-elf-dl-deps.c-Make-_dl_build_local_scope-breadth-fir.patch \
54 file://0025-intl-Emit-no-lines-in-bison-generated-files.patch \
Andrew Geissler635e0e42020-08-21 15:58:33 -050055 file://0027-locale-prevent-maybe-uninitialized-errors-with-Os-BZ.patch \
56 file://0028-readlib-Add-OECORE_KNOWN_INTERPRETER_NAMES-to-known-.patch \
57 file://0029-wordsize.h-Unify-the-header-between-arm-and-aarch64.patch \
58 file://0030-powerpc-Do-not-ask-compiler-for-finding-arch.patch \
Andrew Geissler82c905d2020-04-13 13:39:40 -050059 "
60S = "${WORKDIR}/git"
61B = "${WORKDIR}/build-${TARGET_SYS}"
62
63PACKAGES_DYNAMIC = ""
64
65# the -isystem in bitbake.conf screws up glibc do_stage
66BUILD_CPPFLAGS = "-I${STAGING_INCDIR_NATIVE}"
67TARGET_CPPFLAGS = "-I${STAGING_DIR_TARGET}${includedir}"
68
69GLIBC_BROKEN_LOCALES = ""
70
71GLIBCPIE ??= ""
72
73EXTRA_OECONF = "--enable-kernel=${OLDEST_KERNEL} \
74 --disable-profile \
75 --disable-debug --without-gd \
76 --enable-clocale=gnu \
77 --with-headers=${STAGING_INCDIR} \
78 --without-selinux \
79 --enable-tunables \
80 --enable-bind-now \
81 --enable-stack-protector=strong \
82 --enable-stackguard-randomization \
83 --disable-crypt \
84 --with-default-link \
Andrew Geissler82c905d2020-04-13 13:39:40 -050085 ${@bb.utils.contains_any('SELECTED_OPTIMIZATION', '-O0 -Og', '--disable-werror', '', d)} \
86 ${GLIBCPIE} \
87 ${GLIBC_EXTRA_OECONF}"
88
89EXTRA_OECONF += "${@get_libc_fpu_setting(bb, d)}"
90
Andrew Geisslerd1e89492021-02-12 15:35:20 -060091EXTRA_OECONF_append_x86 = " --enable-cet"
92EXTRA_OECONF_append_x86-64 = " --enable-cet"
93
Andrew Geisslerc3d88e42020-10-02 09:45:00 -050094PACKAGECONFIG ??= "nscd"
95PACKAGECONFIG[nscd] = "--enable-nscd,--disable-nscd"
Andrew Geissler09036742021-06-25 14:25:14 -050096PACKAGECONFIG[memory-tagging] = "--enable-memory-tagging,--disable-memory-tagging"
Andrew Geisslerc3d88e42020-10-02 09:45:00 -050097
Andrew Geissler82c905d2020-04-13 13:39:40 -050098do_patch_append() {
99 bb.build.exec_func('do_fix_readlib_c', d)
100}
101
102do_fix_readlib_c () {
103 sed -i -e 's#OECORE_KNOWN_INTERPRETER_NAMES#${EGLIBC_KNOWN_INTERPRETER_NAMES}#' ${S}/elf/readlib.c
104}
105
106do_configure () {
107# override this function to avoid the autoconf/automake/aclocal/autoheader
108# calls for now
109# don't pass CPPFLAGS into configure, since it upsets the kernel-headers
110# version check and doesn't really help with anything
111 (cd ${S} && gnu-configize) || die "failure in running gnu-configize"
112 find ${S} -name "configure" | xargs touch
113 CPPFLAGS="" oe_runconf
114}
115
116LDFLAGS += "-fuse-ld=bfd"
117do_compile () {
118 base_do_compile
119 echo "Adjust ldd script"
120 if [ -n "${RTLDLIST}" ]
121 then
122 prevrtld=`cat ${B}/elf/ldd | grep "^RTLDLIST=" | sed 's#^RTLDLIST="\?\([^"]*\)"\?$#\1#'`
123 # remove duplicate entries
124 newrtld=`echo $(printf '%s\n' ${prevrtld} ${RTLDLIST} | LC_ALL=C sort -u)`
125 echo "ldd \"${prevrtld} ${RTLDLIST}\" -> \"${newrtld}\""
126 sed -i ${B}/elf/ldd -e "s#^RTLDLIST=.*\$#RTLDLIST=\"${newrtld}\"#"
127 fi
128}
129
130require glibc-package.inc
131
132BBCLASSEXTEND = "nativesdk"