ansible: Disable multilib for gcc 4.8 powerpc64le
authorKienan Stewart <kstewart@efficios.com>
Tue, 22 Aug 2023 20:39:52 +0000 (16:39 -0400)
committerKienan Stewart <kstewart@efficios.com>
Wed, 23 Aug 2023 18:06:49 +0000 (14:06 -0400)
This enables the support for '-m32' which is required when compiling
powerpc64le kernels

Change-Id: I61ec67220aa677e3339f6c10278b905347ea1cf7

automation/ansible/roles/cross-compilers/files/script.sh

index 47b04a07e07d49048af440ee40f26cbfca4b7883..e6fec0b9ab428cc4404af7ab86753b468d11a724 100755 (executable)
@@ -4,9 +4,10 @@ SRC_DIR="${SRC_DIR:-/src/gcc-releases-gcc-4.8.5}"
 PATCH_DIR="${PATCH_DIR:-/src/patches}"
 TARGET="${TARGET:-aarch64-linux-gnu}"
 HOST="${HOST:-x86_64-linux-gnu}"
-CONFIGURE_ARGS="${CONFIGURE_ARGS:-}"
-MAKE_ARGS="${MAKE_ARGS:-}"
-MAKE_INSTALL_ARGS="${MAKE_INSTALL_ARGS:-}"
+CONFIGURE_ARGS=(${CONFIGURE_ARGS:-})
+MAKE_ARGS=(${MAKE_ARGS:-})
+MAKE_INSTALL_ARGS=(${MAKE_INSTALL_ARGS:-})
+DEBUG="${DEBUG:-}"
 
 OWD="$(pwd)"
 cd "${SRC_DIR}" || exit 1
@@ -18,9 +19,12 @@ while read -r line ; do
     fi
     patch -p"${PATCH_LEVEL}" < "${line}"
 done < <(find "${PATCH_DIR}" -type f)
-cd "${OWD}"
+cd "${OWD}" || exit 1
 
 TARGET_ARGS=()
+CFLAGS=(-std=gnu99)
+CXXFLAGS=(-std=gnu++98)
+# apt-get install -y gcc-"${TARGET}"
 case "${TARGET}" in
     aarch64-linux-gnu)
         TARGET_ARGS+=(
@@ -42,8 +46,13 @@ case "${TARGET}" in
         )
         ;;
     powerpc64le-linux-gnu)
+        # Disable multilib so that ppc64el kernel can be built, since
+        # legacy Makefiles compile vdso in 32bits unconditionally.
+        # @see https://bugzilla.redhat.com/show_bug.cgi?id=1237363
+        # @see https://bugzilla.redhat.com/show_bug.cgi?id=1205236
+        # @see https://bugs.launchpad.net/ubuntu/trusty/+source/linux/+bug/1433809/
         TARGET_ARGS+=(
-            --enable-secureplt
+            --disable-multilib
             --enable-targets=powerpcle-linux
             --with-cpu=power8
             --with-long-double-128
@@ -74,6 +83,7 @@ case "${TARGET}" in
         ;;
 esac
 
+START=$(date +%s)
 "${SRC_DIR}/configure" --build="${HOST}" --host="${HOST}" --enable-languages=c,c++ \
             --program-prefix="${TARGET}-" --target="${TARGET}" --program-suffix=-4.8 \
             --prefix=/usr/ --with-system-zlib \
@@ -81,14 +91,20 @@ esac
             --disable-nls --disable-shared --enable-host-shared \
             --disable-bootstrap --enable-threads=posix --enable-default-pie \
             --with-sysroot=/ --includedir=/usr/"${TARGET}"/include \
-            --without-target-system-zlib --enable-multiarch
-            ${TARGET_ARGS[@]} ${CONFIGURE_ARGS} \
-            CFLAGS='-std=gnu99' CXXFLAGS='-std=gnu++98'
+            --without-target-system-zlib --enable-multiarch \
+            "${TARGET_ARGS[@]}" "${CONFIGURE_ARGS[@]}" \
+            CFLAGS="${CFLAGS[*]}" CXXFLAGS="${CXXFLAGS[*]}"
+
+NPROC="${NPROC:=$(nproc)}"
+make -j"${NPROC}" "${MAKE_ARGS[@]}" CFLAGS="${CFLAGS[*]}" CXXFLAGS="${CXXFLAGS[*]}"
+# Do not use -jN with make install, it often breaks.
+make install "${MAKE_INSTALL_ARGS[@]}"
+
+mkdir -p "/output/usr/lib/gcc-cross/${TARGET}" /output/usr/bin/
 
-make -j"${NPROC:-$(nproc)}" ${MAKE_ARGS} \
-      CFLAGS='-std=gnu99' CXXFLAGS='-std=gnu++98'
+if [ -n "${DEBUG}" ] ; then
+    echo $(($(date +%s) - START)) > "/output/${TARGET}.time"
+fi
 
-make install ${MAKE_INSTALL_ARGS}
-mkdir -p /output/usr/lib/ /output/usr/bin/
-cp -r /usr/lib/gcc-cross /output/usr/lib/
+cp -r /usr/lib/gcc-cross/"${TARGET}"/4* "/output/usr/lib/gcc-cross/${TARGET}/"
 cp /usr/bin/*-4.8 /output/usr/bin/
This page took 0.024629 seconds and 4 git commands to generate.