diff options
Diffstat (limited to 'meta/recipes-devtools')
| -rw-r--r-- | meta/recipes-devtools/gcc/gcc-11.2.inc | 1 | ||||
| -rw-r--r-- | meta/recipes-devtools/gcc/gcc-runtime.inc | 8 | ||||
| -rw-r--r-- | meta/recipes-devtools/gcc/gcc/0005-optional-libstdc.patch | 118 |
3 files changed, 6 insertions, 121 deletions
diff --git a/meta/recipes-devtools/gcc/gcc-11.2.inc b/meta/recipes-devtools/gcc/gcc-11.2.inc index f07a5be507..a62f272d3c 100644 --- a/meta/recipes-devtools/gcc/gcc-11.2.inc +++ b/meta/recipes-devtools/gcc/gcc-11.2.inc | |||
| @@ -33,7 +33,6 @@ SRC_URI = "\ | |||
| 33 | file://0001-gcc-4.3.1-ARCH_FLAGS_FOR_TARGET.patch \ | 33 | file://0001-gcc-4.3.1-ARCH_FLAGS_FOR_TARGET.patch \ |
| 34 | file://0002-gcc-poison-system-directories.patch \ | 34 | file://0002-gcc-poison-system-directories.patch \ |
| 35 | file://0004-64-bit-multilib-hack.patch \ | 35 | file://0004-64-bit-multilib-hack.patch \ |
| 36 | file://0005-optional-libstdc.patch \ | ||
| 37 | file://0007-Use-the-defaults.h-in-B-instead-of-S-and-t-oe-in-B.patch \ | 36 | file://0007-Use-the-defaults.h-in-B-instead-of-S-and-t-oe-in-B.patch \ |
| 38 | file://0009-cpp-honor-sysroot.patch \ | 37 | file://0009-cpp-honor-sysroot.patch \ |
| 39 | file://0011-Define-GLIBC_DYNAMIC_LINKER-and-UCLIBC_DYNAMIC_LINKE.patch \ | 38 | file://0011-Define-GLIBC_DYNAMIC_LINKER-and-UCLIBC_DYNAMIC_LINKE.patch \ |
diff --git a/meta/recipes-devtools/gcc/gcc-runtime.inc b/meta/recipes-devtools/gcc/gcc-runtime.inc index 4839a6687a..c39a0caf8a 100644 --- a/meta/recipes-devtools/gcc/gcc-runtime.inc +++ b/meta/recipes-devtools/gcc/gcc-runtime.inc | |||
| @@ -64,7 +64,11 @@ DEBUG_PREFIX_MAP:class-target = " \ | |||
| 64 | " | 64 | " |
| 65 | 65 | ||
| 66 | do_configure () { | 66 | do_configure () { |
| 67 | export CXX="${CXX} -nostdinc++ -nostdlib++" | 67 | export CXX="${CXX} -nostdinc++ -L${WORKDIR}/dummylib" |
| 68 | # libstdc++ isn't built yet so CXX would error not able to find it which breaks stdc++'s configure | ||
| 69 | # tests. Create a dummy empty lib for the purposes of configure. | ||
| 70 | mkdir -p ${WORKDIR}/dummylib | ||
| 71 | touch ${WORKDIR}/dummylib/libstdc++.so | ||
| 68 | for d in libgcc ${RUNTIMETARGET}; do | 72 | for d in libgcc ${RUNTIMETARGET}; do |
| 69 | echo "Configuring $d" | 73 | echo "Configuring $d" |
| 70 | rm -rf ${B}/${TARGET_SYS}/$d/ | 74 | rm -rf ${B}/${TARGET_SYS}/$d/ |
| @@ -302,7 +306,7 @@ do_check() { | |||
| 302 | export DEJAGNU="${WORKDIR}/dejagnu/site.exp" | 306 | export DEJAGNU="${WORKDIR}/dejagnu/site.exp" |
| 303 | 307 | ||
| 304 | # HACK: this works around the configure setting CXX with -nostd* args | 308 | # HACK: this works around the configure setting CXX with -nostd* args |
| 305 | sed -i 's/-nostdinc++ -nostdlib++//g' $(find ${B} -name testsuite_flags | head -1) | 309 | sed -i 's#-nostdinc++ -L${WORKDIR}/dummylib##g' $(find ${B} -name testsuite_flags | head -1) |
| 306 | 310 | ||
| 307 | if [ "${TOOLCHAIN_TEST_TARGET}" = "user" ]; then | 311 | if [ "${TOOLCHAIN_TEST_TARGET}" = "user" ]; then |
| 308 | # qemu user has issues allocating large amounts of memory | 312 | # qemu user has issues allocating large amounts of memory |
diff --git a/meta/recipes-devtools/gcc/gcc/0005-optional-libstdc.patch b/meta/recipes-devtools/gcc/gcc/0005-optional-libstdc.patch deleted file mode 100644 index b856c5dea3..0000000000 --- a/meta/recipes-devtools/gcc/gcc/0005-optional-libstdc.patch +++ /dev/null | |||
| @@ -1,118 +0,0 @@ | |||
| 1 | From: Richard Purdie <richard.purdie@linuxfoundation.org> | ||
| 2 | Subject: [PATCH 3/5] gcc: Add --nostdlib++ option | ||
| 3 | |||
| 4 | [gcc-runtime builds libstdc++ separately from gcc-cross-*. Its configure tests using g++ | ||
| 5 | will not run correctly since by default the linker will try to link against libstdc++ | ||
| 6 | which shouldn't exist yet. We need an option to disable -lstdc++ | ||
| 7 | option whilst leaving -lc, -lgcc and other automatic library dependencies added by gcc | ||
| 8 | driver. This patch adds such an option which only disables the -lstdc++.] | ||
| 9 | |||
| 10 | [A "standard" gcc build uses xgcc and hence avoids this. We should ask upstream how to | ||
| 11 | do this officially, the likely answer is don't build libstdc++ separately.] | ||
| 12 | |||
| 13 | OpenEmbedded/Yocto Project builds libgcc and the other gcc runtime libraries | ||
| 14 | separately from the compiler and slightly differently to the standard gcc build. | ||
| 15 | |||
| 16 | In general this works well but in trying to build them separately we run into | ||
| 17 | an issue since we're using our gcc, not xgcc and there is no way to tell configure | ||
| 18 | to use libgcc but not look for libstdc++. | ||
| 19 | |||
| 20 | This adds such an option allowing such configurations to work. | ||
| 21 | |||
| 22 | 2021-10-26 Richard Purdie <richard.purdie@linuxfoundation.org> | ||
| 23 | |||
| 24 | gcc/c-family/ChangeLog: | ||
| 25 | |||
| 26 | * c.opt: Add --nostdlib++ option | ||
| 27 | |||
| 28 | gcc/cp/ChangeLog: | ||
| 29 | |||
| 30 | * g++spec.c (lang_specific_driver): Add --nostdlib++ option | ||
| 31 | |||
| 32 | gcc/ChangeLog: | ||
| 33 | |||
| 34 | * doc/invoke.texi: Document --nostdlib++ option | ||
| 35 | * gcc.c: Add --nostdlib++ option | ||
| 36 | |||
| 37 | Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org> | ||
| 38 | |||
| 39 | Upstream-Status: Submitted [https://gcc.gnu.org/pipermail/gcc-patches/2021-October/582724.html] | ||
| 40 | --- | ||
| 41 | gcc/c-family/c.opt | 4 ++++ | ||
| 42 | gcc/cp/g++spec.c | 1 + | ||
| 43 | gcc/doc/invoke.texi | 8 +++++++- | ||
| 44 | gcc/gcc.c | 1 + | ||
| 45 | 4 files changed, 13 insertions(+), 1 deletion(-) | ||
| 46 | |||
| 47 | Index: gcc-11.2.0/gcc/c-family/c.opt | ||
| 48 | =================================================================== | ||
| 49 | --- gcc-11.2.0.orig/gcc/c-family/c.opt | ||
| 50 | +++ gcc-11.2.0/gcc/c-family/c.opt | ||
| 51 | @@ -2153,6 +2153,10 @@ nostdinc++ | ||
| 52 | C++ ObjC++ | ||
| 53 | Do not search standard system include directories for C++. | ||
| 54 | |||
| 55 | +nostdlib++ | ||
| 56 | +Driver | ||
| 57 | +Do not link standard C++ runtime library | ||
| 58 | + | ||
| 59 | o | ||
| 60 | C ObjC C++ ObjC++ Joined Separate | ||
| 61 | ; Documented in common.opt | ||
| 62 | Index: gcc-11.2.0/gcc/cp/g++spec.c | ||
| 63 | =================================================================== | ||
| 64 | --- gcc-11.2.0.orig/gcc/cp/g++spec.c | ||
| 65 | +++ gcc-11.2.0/gcc/cp/g++spec.c | ||
| 66 | @@ -159,6 +159,7 @@ lang_specific_driver (struct cl_decoded_ | ||
| 67 | switch (decoded_options[i].opt_index) | ||
| 68 | { | ||
| 69 | case OPT_nostdlib: | ||
| 70 | + case OPT_nostdlib__: | ||
| 71 | case OPT_nodefaultlibs: | ||
| 72 | library = -1; | ||
| 73 | break; | ||
| 74 | Index: gcc-11.2.0/gcc/doc/invoke.texi | ||
| 75 | =================================================================== | ||
| 76 | --- gcc-11.2.0.orig/gcc/doc/invoke.texi | ||
| 77 | +++ gcc-11.2.0/gcc/doc/invoke.texi | ||
| 78 | @@ -239,6 +239,7 @@ in the following sections. | ||
| 79 | -fno-weak -nostdinc++ @gol | ||
| 80 | -fvisibility-inlines-hidden @gol | ||
| 81 | -fvisibility-ms-compat @gol | ||
| 82 | +-nostdlib++ @gol | ||
| 83 | -fext-numeric-literals @gol | ||
| 84 | -flang-info-include-translate@r{[}=@var{header}@r{]} @gol | ||
| 85 | -flang-info-include-translate-not @gol | ||
| 86 | @@ -632,7 +633,7 @@ Objective-C and Objective-C++ Dialects}. | ||
| 87 | -pie -pthread -r -rdynamic @gol | ||
| 88 | -s -static -static-pie -static-libgcc -static-libstdc++ @gol | ||
| 89 | -static-libasan -static-libtsan -static-liblsan -static-libubsan @gol | ||
| 90 | --shared -shared-libgcc -symbolic @gol | ||
| 91 | +-shared -shared-libgcc -symbolic -nostdlib++ @gol | ||
| 92 | -T @var{script} -Wl,@var{option} -Xlinker @var{option} @gol | ||
| 93 | -u @var{symbol} -z @var{keyword}} | ||
| 94 | |||
| 95 | @@ -15721,6 +15722,11 @@ Specify that the program entry point is | ||
| 96 | interpreted by the linker; the GNU linker accepts either a symbol name | ||
| 97 | or an address. | ||
| 98 | |||
| 99 | +@item -nostdlib++ | ||
| 100 | +@opindex nostdlib++ | ||
| 101 | +Do not use the standard system C++ runtime libraries when linking. | ||
| 102 | +Only the libraries you specify will be passed to the linker. | ||
| 103 | + | ||
| 104 | @item -pie | ||
| 105 | @opindex pie | ||
| 106 | Produce a dynamically linked position independent executable on targets | ||
| 107 | Index: gcc-11.2.0/gcc/gcc.c | ||
| 108 | =================================================================== | ||
| 109 | --- gcc-11.2.0.orig/gcc/gcc.c | ||
| 110 | +++ gcc-11.2.0/gcc/gcc.c | ||
| 111 | @@ -1162,6 +1162,7 @@ proper position among the other output f | ||
| 112 | %(mflib) " STACK_SPLIT_SPEC "\ | ||
| 113 | %{fprofile-arcs|fprofile-generate*|coverage:-lgcov} " SANITIZER_SPEC " \ | ||
| 114 | %{!nostdlib:%{!r:%{!nodefaultlibs:%(link_ssp) %(link_gcc_c_sequence)}}}\ | ||
| 115 | + %{!nostdlib++:}\ | ||
| 116 | %{!nostdlib:%{!r:%{!nostartfiles:%E}}} %{T*} \n%(post_link) }}}}}}" | ||
| 117 | #endif | ||
| 118 | |||
