From 4ac095c78bc643e43e63822ac5162dbd99134791 Mon Sep 17 00:00:00 2001 From: Xi Ruoyao Date: Wed, 7 Feb 2024 05:26:00 +0800 Subject: [PATCH] loongarch: gcc: Apply an upstream change to prevent the linker from generating illegal instructions I've proposed a backport of the change to GCC 13.3 but no response yet. But even if the proposal is rejected I'd still have no choice but backporting downstream. So just do it. --- chapter05/gcc-pass1.xml | 8 ++++++++ chapter06/gcc-pass2.xml | 9 +++++++++ chapter08/gcc.xml | 9 +++++++++ 3 files changed, 26 insertions(+) diff --git a/chapter05/gcc-pass1.xml b/chapter05/gcc-pass1.xml index 47ca6d1b4..31280ad18 100644 --- a/chapter05/gcc-pass1.xml +++ b/chapter05/gcc-pass1.xml @@ -43,6 +43,14 @@ Installation of Cross GCC + + At first, fix an issue producing illegal instructions in linked + executables and shared libraries with GCC &gcc-version; and + Binutils-2.42: + + sed -e '/ASM_OUTPUT_ALIGN_WITH_NOP/,+1d' \ + -i gcc/config/loongarch/loongarch.h + GCC requires the GMP, MPFR and MPC packages. As these packages may not be included in your host distribution, they will be built with GCC. Unpack each package into the GCC source directory and rename the diff --git a/chapter06/gcc-pass2.xml b/chapter06/gcc-pass2.xml index e8ed0d1c1..991f9195b 100644 --- a/chapter06/gcc-pass2.xml +++ b/chapter06/gcc-pass2.xml @@ -47,6 +47,15 @@ patch -Np1 -i ../&gcc-upstream-fixes-patch; --> + + + Again, fix an issue producing illegal instructions in linked + executables and shared libraries with GCC &gcc-version; and + Binutils-2.42: + + sed -e '/ASM_OUTPUT_ALIGN_WITH_NOP/,+1d' \ + -i gcc/config/loongarch/loongarch.h + As in the first build of GCC, the GMP, MPFR, and MPC packages are required. Unpack the tarballs and move them into the required directories: diff --git a/chapter08/gcc.xml b/chapter08/gcc.xml index 7f60d3cd5..ed9a7cac9 100644 --- a/chapter08/gcc.xml +++ b/chapter08/gcc.xml @@ -54,6 +54,15 @@ patch -Np1 -i ../&gcc-upstream-fixes-patch; --> + + + Again, fix an issue producing illegal instructions in linked + executables and shared libraries with GCC &gcc-version; and + Binutils-2.42: + + sed -e '/ASM_OUTPUT_ALIGN_WITH_NOP/,+1d' \ + -i gcc/config/loongarch/loongarch.h + Set the default directory name for 64-bit libraries to lib: