Commit 3e32c591 authored by Matt Devillier's avatar Matt Devillier
Browse files

util/crossgcc: updates through 48da7769



Update toolchain to commit 48da77692ad5325c702fb07445f0e5c6dfc10f16
to fix compilation issues with coreinfo

Change-Id: I50d65aa7f32e29f00880a5d36943b8e5c44964bd
Signed-off-by: Matt Devillier's avatarMatt DeVillier <matt.devillier@puri.sm>
parent 0fcf454c
......@@ -132,7 +132,7 @@ ifeq ($(strip $(HAVE_DOTCONFIG)),)
NOCOMPILE:=1
endif
ifneq ($(MAKECMDGOALS),)
ifneq ($(filter %config %clean cross% clang iasl gnumake lint% help% what-jenkins-does,$(MAKECMDGOALS)),)
ifneq ($(filter %config %clean cross% clang iasl lint% help% what-jenkins-does,$(MAKECMDGOALS)),)
NOCOMPILE:=1
endif
ifneq ($(filter %clean lint% help% what-jenkins-does,$(MAKECMDGOALS)),)
......
......@@ -10,12 +10,12 @@ DEST ?= $(CURDIR)/xgcc
all all_with_gdb:
$(MAKE) build-i386 build-x64 build-arm \
build-riscv build-aarch64 build-ppc64 build-nds32le \
build_clang build_iasl build_make build_nasm
build_clang build_iasl build_nasm
all_without_gdb:
$(MAKE) SKIP_GDB=1 build-i386 build-x64 build-arm \
build-riscv build-aarch64 build-ppc64 build-nds32le \
build_clang build_iasl build_make build_nasm
build_clang build_iasl build_nasm
build_tools: build_gcc build_gdb
......
......@@ -9,7 +9,6 @@ help_toolchain help::
@echo ' crossgcc-clean - Remove all built coreboot cross-compilers'
@echo ' iasl - Build coreboot IASL compiler (built by all cross targets)'
@echo ' clang - Build coreboot clang compiler'
@echo ' gnumake - Build coreboot make'
@echo ' nasm - Build coreboot nasm'
@echo ' test-toolchain - Reports if toolchain components are out of date'
@echo ' crossgcc-ARCH - Build cross-compiler for specific architecture'
......@@ -29,7 +28,7 @@ crossgcc: clean-for-update
crossgcc-riscv crossgcc-power8 crossgcc-clean iasl \
clang crosstools-i386 crosstools-x64 crosstools-arm \
crosstools-aarch64 crosstools-riscv crosstools-power8 \
jenkins-build-toolchain gnumake nasm
jenkins-build-toolchain nasm
$(foreach arch,$(TOOLCHAIN_ARCHES),crossgcc-$(arch)): clean-for-update
$(MAKE) -C util/crossgcc $(patsubst crossgcc-%,build-%,$@) build_iasl SKIP_GDB=1
......@@ -43,9 +42,6 @@ iasl: clean-for-update
clang: clean-for-update
$(MAKE) -C util/crossgcc build_clang
gnumake: clean-for-update
$(MAKE) -C util/crossgcc build_make
nasm: clean-for-update
$(MAKE) -C util/crossgcc build_nasm
......
......@@ -33,21 +33,20 @@ BOOTSTRAP=0
THREADS=1
# GCC toolchain version numbers
GMP_VERSION=6.1.2
MPFR_VERSION=4.0.2
MPC_VERSION=1.1.0
GMP_VERSION=6.2.0
MPFR_VERSION=4.1.0
MPC_VERSION=1.2.0
GCC_VERSION=8.3.0
GCC_AUTOCONF_VERSION=2.69
BINUTILS_VERSION=2.33.1
GDB_VERSION=8.3.1
IASL_VERSION=20200110
PYTHON_VERSION=3.8.1
BINUTILS_VERSION=2.35
GDB_VERSION=9.2
IASL_VERSION=20200717
PYTHON_VERSION=3.8.5
EXPAT_VERSION=2.2.9
# CLANG version number
CLANG_VERSION=9.0.0
MAKE_VERSION=4.2.1
CMAKE_VERSION=3.16.2
NASM_VERSION=2.14.02
CLANG_VERSION=10.0.1
CMAKE_VERSION=3.18.1
NASM_VERSION=2.15.03
# GCC toolchain archive locations
# These are sanitized by the jenkins toolchain test builder, so if
......@@ -63,19 +62,17 @@ IASL_ARCHIVE="https://acpica.org/sites/acpica/files/acpica-unix2-${IASL_VERSION}
PYTHON_ARCHIVE="https://www.python.org/ftp/python/${PYTHON_VERSION}/Python-${PYTHON_VERSION}.tar.xz"
EXPAT_ARCHIVE="https://downloads.sourceforge.net/sourceforge/expat/expat-${EXPAT_VERSION}.tar.bz2"
# CLANG toolchain archive locations
LLVM_ARCHIVE="https://releases.llvm.org/${CLANG_VERSION}/llvm-${CLANG_VERSION}.src.tar.xz"
CFE_ARCHIVE="https://releases.llvm.org/${CLANG_VERSION}/cfe-${CLANG_VERSION}.src.tar.xz"
CRT_ARCHIVE="https://releases.llvm.org/${CLANG_VERSION}/compiler-rt-${CLANG_VERSION}.src.tar.xz"
CTE_ARCHIVE="https://releases.llvm.org/${CLANG_VERSION}/clang-tools-extra-${CLANG_VERSION}.src.tar.xz"
MAKE_ARCHIVE="https://ftpmirror.gnu.org/make/make-${MAKE_VERSION}.tar.bz2"
CMAKE_ARCHIVE="https://cmake.org/files/v3.16/cmake-${CMAKE_VERSION}.tar.gz"
LLVM_ARCHIVE="https://github.com/llvm/llvm-project/releases/download/llvmorg-${CLANG_VERSION}/llvm-${CLANG_VERSION}.src.tar.xz"
CLANG_ARCHIVE="https://github.com/llvm/llvm-project/releases/download/llvmorg-${CLANG_VERSION}/clang-${CLANG_VERSION}.src.tar.xz"
CRT_ARCHIVE="https://github.com/llvm/llvm-project/releases/download/llvmorg-${CLANG_VERSION}/compiler-rt-${CLANG_VERSION}.src.tar.xz"
CTE_ARCHIVE="https://github.com/llvm/llvm-project/releases/download/llvmorg-${CLANG_VERSION}/clang-tools-extra-${CLANG_VERSION}.src.tar.xz"
CMAKE_ARCHIVE="https://cmake.org/files/v3.18/cmake-${CMAKE_VERSION}.tar.gz"
NASM_ARCHIVE="https://www.nasm.us/pub/nasm/releasebuilds/${NASM_VERSION}/nasm-${NASM_VERSION}.tar.bz2"
ALL_ARCHIVES="$GMP_ARCHIVE $MPFR_ARCHIVE $MPC_ARCHIVE \
$GCC_ARCHIVE $BINUTILS_ARCHIVE $GDB_ARCHIVE $IASL_ARCHIVE \
$PYTHON_ARCHIVE $EXPAT_ARCHIVE $LLVM_ARCHIVE $CFE_ARCHIVE \
$CRT_ARCHIVE $CTE_ARCHIVE $MAKE_ARCHIVE $CMAKE_ARCHIVE \
$NASM_ARCHIVE"
$PYTHON_ARCHIVE $EXPAT_ARCHIVE $LLVM_ARCHIVE $CLANG_ARCHIVE \
$CRT_ARCHIVE $CTE_ARCHIVE $CMAKE_ARCHIVE $NASM_ARCHIVE"
# GCC toolchain directories
GMP_DIR="gmp-${GMP_VERSION}"
......@@ -91,10 +88,9 @@ PYTHON_DIR="Python-${PYTHON_VERSION}"
EXPAT_DIR="expat-${EXPAT_VERSION}"
# CLANG toolchain directories
LLVM_DIR="llvm-${CLANG_VERSION}.src"
CFE_DIR="cfe-${CLANG_VERSION}.src"
CLANG_DIR="clang-${CLANG_VERSION}.src"
CRT_DIR="compiler-rt-${CLANG_VERSION}.src"
CTE_DIR="clang-tools-extra-${CLANG_VERSION}.src"
MAKE_DIR="make-${MAKE_VERSION}"
CMAKE_DIR="cmake-${CMAKE_VERSION}"
NASM_DIR="nasm-${NASM_VERSION}"
......@@ -847,15 +843,15 @@ build_IASL() {
test "$UNAME" = "Cygwin" && HOST="_CYGWIN"
HOST="$HOST" CFLAGS="$CFLAGS" \
OPT_CFLAGS="-O -D_FORTIFY_SOURCE=2 -D COREBOOT_TOOLCHAIN_VERSION='\"coreboot toolchain v$CROSSGCC_VERSION $CROSSGCC_DATE\"' " \
$MAKE $JOBS CC="$(hostcc host)" iasl acpibin acpidump acpiexec acpihelp acpinames acpisrc acpixtract
rm -f "$DESTDIR$TARGETDIR/bin/{iasl,acpibin,acpidump,acpiexec,acpihelp,acpinames,acpisrc,acpixtract}" || touch "$RDIR/.failed"
cp bin/{iasl,acpibin,acpidump,acpiexec,acpihelp,acpinames,acpisrc,acpixtract} "$DESTDIR$TARGETDIR/bin" || touch "$RDIR/.failed"
$MAKE $JOBS CC="$(hostcc host)" iasl acpibin acpidump acpiexec acpihelp acpisrc acpixtract
rm -f "$DESTDIR$TARGETDIR/bin/{iasl,acpibin,acpidump,acpiexec,acpihelp,acpisrc,acpixtract}" || touch "$RDIR/.failed"
cp bin/{iasl,acpibin,acpidump,acpiexec,acpihelp,acpisrc,acpixtract} "$DESTDIR$TARGETDIR/bin" || touch "$RDIR/.failed"
}
build_LLVM() {
cd .. || exit 1
ln -sf "$PWD/$CFE_DIR" "$LLVM_DIR/tools/clang"
ln -sf "$PWD/$CLANG_DIR" "$LLVM_DIR/tools/clang"
ln -sf "$PWD/$CTE_DIR" "$LLVM_DIR/tools/clang/tools/extra"
ln -sf "$PWD/$CRT_DIR" "$LLVM_DIR/projects/compiler-rt"
cd - || exit 1
......@@ -867,8 +863,8 @@ build_LLVM() {
$MAKE $JOBS || touch .failed
$MAKE install || touch .failed
cp -a ../$CFE_DIR/tools/scan-build/* "$DESTDIR$TARGETDIR/bin"
cp -a ../$CFE_DIR/tools/scan-view/* "$DESTDIR$TARGETDIR/bin"
cp -a ../$CLANG_DIR/tools/scan-build/* "$DESTDIR$TARGETDIR/bin"
cp -a ../$CLANG_DIR/tools/scan-view/* "$DESTDIR$TARGETDIR/bin"
# create symlinks to work around broken --print-librt-file-name
# when used with -target.
......@@ -878,19 +874,6 @@ build_LLVM() {
done
}
build_MAKE() {
( cd ../${MAKE_DIR}/ && aclocal && autoconf )
CC="$(hostcc host)" CXX="$(hostcxx host)" CFLAGS="$HOSTCFLAGS" \
../${MAKE_DIR}/configure --prefix="$TARGETDIR" --disable-nls \
|| touch .failed
$MAKE -k clean
# shellcheck disable=SC2086
$MAKE $JOBS || touch .failed
$MAKE install DESTDIR=$DESTDIR || touch .failed
normalize_dirs
}
build_CMAKE() {
CC="$(hostcc host)" CXX="$(hostcxx host)" CFLAGS="$HOSTCFLAGS" \
../${CMAKE_DIR}/configure --prefix="$TARGETDIR" \
......@@ -926,7 +909,6 @@ print_supported() {
MPC|mpc) printf "%s\n" "$MPC_VERSION";;
MPFR|mpfr) printf "%s\n" "$MPFR_VERSION";;
PYTHON|python) printf "%s\n" "$PYTHON_VERSION";;
MAKE|make) printf "%s\n" "$MAKE_VERSION";;
NASM|nasm) printf "%s\n" "${NASM_VERSION}";;
*) printf "Unknown tool %s\n" "$PRINTSUPPORTED";;
esac
......@@ -1032,17 +1014,13 @@ case "$PACKAGE" in
CLANG|clang)
NAME="LLVM clang"
LLVM_VERSION=${CLANG_VERSION}
PACKAGES="CMAKE LLVM CFE CRT CTE"
PACKAGES="CMAKE LLVM CLANG CRT CTE"
CMAKE=${DESTDIR}${TARGETDIR}/bin/cmake
;;
IASL|iasl)
NAME="IASL ACPI compiler"
PACKAGES=IASL
;;
MAKE|make)
NAME="GNU Make"
PACKAGES=MAKE
;;
CMAKE|cmake)
NAME="CMake"
PACKAGES=CMAKE
......@@ -1052,7 +1030,7 @@ case "$PACKAGE" in
PACKAGES=NASM
;;
*)
printf "${red}ERROR: Unsupported package $PACKAGE. (Supported packages are GCC, GDB, CLANG, IASL, MAKE, and NASM)${NC}\n\n";
printf "${red}ERROR: Unsupported package $PACKAGE. (Supported packages are GCC, GDB, CLANG, IASL, and NASM)${NC}\n\n";
exit 1
;;
esac
......@@ -1200,33 +1178,25 @@ if [ -z "${LANGUAGES}" ]; then
LANGUAGES="${DEFAULT_LANGUAGES}"
fi
fi
if [ "$BOOTSTRAP" != 1 ] && \
{ [ "$(hostcc_major)" -lt 4 ] || \
{ [ "$(hostcc_major)" -eq 4 ] && \
[ "$(hostcc_minor)" -lt 9 ] ; } ; }
then
printf "\n${red}WARNING${NC}\n"
printf "Building coreboot requires a host compiler newer than 4.9.x while\n"
printf "yours is $(hostcc_version).\n"
printf "Enabling bootstrapping to provide a sufficiently new compiler:\n"
printf "This will take significantly longer than a usual build.\n"
printf "Alternatively you can abort now and update your host compiler.\n"
timeout 15
BOOTSTRAP=1
fi
if ada_requested; then
if have_gnat; then
if [ "$BOOTSTRAP" != 1 ] && \
{ [ "$(hostcc_major)" -lt 4 ] || \
{ [ "$(hostcc_major)" -eq 4 ] && \
[ "$(hostcc_minor)" -lt 9 ] ; } ; }
then
printf "\n${red}WARNING${NC}\n"
printf "Building the Ada compiler (GNAT $(buildcc_version)) with a host compiler older\n"
printf "than 4.9.x (yours $(hostcc_version)) requires bootstrapping. This will take\n"
printf "significantly longer than a usual build. You can abort and update\n"
printf "your host GNAT or disable Ada support with BUILD_LANGUAGES=c (or\n"
printf "\`-l c\` in case you invoke \`buildgcc\` directly).\n"
timeout 15
BOOTSTRAP=1
fi
else
if ! have_gnat; then
please_install gnat gcc-ada
exit 1
fi
else
if [ "$(hostcc_major)" -lt 4 ] && [ "$BOOTSTRAP" != 1 ]; then
printf "\n${red}WARNING${NC}\n"
printf "Building GCC $(buildcc_version) with a very old host compiler ($(hostcc_version)).\n"
printf "Bootstrapping (-b) is recommended.\n"
timeout 10
fi
fi
fi # GCC
......
diff -Naur acpica-unix2-20190703_/source/compiler/asloptions.c acpica-unix2-20190703/source/compiler/asloptions.c > acpica-unix2-20190703_iasl.patch
--- acpica-unix2-20190703_/source/compiler/asloptions.c
+++ acpica-unix2-20190703/source/compiler/asloptions.c
diff -Naur acpica-unix2-20200717_/source/compiler/asloptions.c acpica-unix2-20200717/source/compiler/asloptions.c > acpica-unix2-20200717_iasl.patch
--- acpica-unix2-20200717_/source/compiler/asloptions.c
+++ acpica-unix2-20200717/source/compiler/asloptions.c
@@ -126,6 +126,7 @@
if (Gbl_DoSignon)
{
......
It fails to compile when using "MAKEINFO = @MAKEINFO@":
binutils-gdb/missing: 81: makeinfo: not found
WARNING: 'makeinfo' is missing on your system.
You should only need it if you modified a '.texi' file, or
any other file indirectly affecting the aspect of the manual.
You might want to install the Texinfo package:
<http://www.gnu.org/software/texinfo/>
The spurious makeinfo call might also be the consequence of
using a buggy 'make' (AIX, DU, IRIX), in which case you might
want to install GNU make:
<http://www.gnu.org/software/make/>
make[4]: *** [Makefile:507: as.info] Error 127
Current patch will change that to "MAKEINFO = true"
diff --git binutils-2.34/Makefile.in binutils-2.34/Makefile.in
index af38671cbe..978d445825 100644
--- binutils-2.34/Makefile.in
+++ binutils-2.34/Makefile.in
@@ -370,7 +370,7 @@ YACC = @YACC@
FLEX = @FLEX@
LEX = @LEX@
M4 = @M4@
-MAKEINFO = @MAKEINFO@
+MAKEINFO = true
EXPECT = @EXPECT@
RUNTEST = @RUNTEST@
diff --git binutils-2.34/Makefile.tpl binutils-2.34/Makefile.tpl
index 5b118a8ba4..2b41fa28ce 100644
--- binutils-2.34/Makefile.tpl
+++ binutils-2.34/Makefile.tpl
@@ -373,7 +373,7 @@ YACC = @YACC@
FLEX = @FLEX@
LEX = @LEX@
M4 = @M4@
-MAKEINFO = @MAKEINFO@
+MAKEINFO = true
EXPECT = @EXPECT@
RUNTEST = @RUNTEST@
diff --git binutils-2.34/bfd/Makefile.in binutils-2.34/bfd/Makefile.in
index 7d3b9c1c5a..c062314063 100644
--- binutils-2.34/bfd/Makefile.in
+++ binutils-2.34/bfd/Makefile.in
@@ -342,7 +342,7 @@ LIPO = @LIPO@
LN_S = @LN_S@
LTLIBOBJS = @LTLIBOBJS@
MAINT = @MAINT@
-MAKEINFO = @MAKEINFO@
+MAKEINFO = true
MKDIR_P = @MKDIR_P@
MKINSTALLDIRS = @MKINSTALLDIRS@
MSGFMT = @MSGFMT@
diff --git binutils-2.34/bfd/Makefile.in.orig binutils-2.34/bfd/Makefile.in.orig
index 78555ccbbc..861fc3570d 100644
--- binutils-2.34/bfd/Makefile.in.orig
+++ binutils-2.34/bfd/Makefile.in.orig
@@ -342,7 +342,7 @@ LIPO = @LIPO@
LN_S = @LN_S@
LTLIBOBJS = @LTLIBOBJS@
MAINT = @MAINT@
-MAKEINFO = @MAKEINFO@
+MAKEINFO = true
MKDIR_P = @MKDIR_P@
MKINSTALLDIRS = @MKINSTALLDIRS@
MSGFMT = @MSGFMT@
diff --git binutils-2.34/bfd/doc/Makefile.in binutils-2.34/bfd/doc/Makefile.in
index 2c1ddd45b8..b3972192e7 100644
--- binutils-2.34/bfd/doc/Makefile.in
+++ binutils-2.34/bfd/doc/Makefile.in
@@ -284,7 +284,7 @@ LIPO = @LIPO@
LN_S = @LN_S@
LTLIBOBJS = @LTLIBOBJS@
MAINT = @MAINT@
-MAKEINFO = @MAKEINFO@
+MAKEINFO = true
MKDIR_P = @MKDIR_P@
MKINSTALLDIRS = @MKINSTALLDIRS@
MSGFMT = @MSGFMT@
diff --git binutils-2.34/binutils/Makefile.in binutils-2.34/binutils/Makefile.in
index 39f08563f9..91d2287c75 100644
--- binutils-2.34/binutils/Makefile.in
+++ binutils-2.34/binutils/Makefile.in
@@ -463,7 +463,7 @@ LN_S = @LN_S@
LTLIBICONV = @LTLIBICONV@
LTLIBOBJS = @LTLIBOBJS@
MAINT = @MAINT@
-MAKEINFO = @MAKEINFO@
+MAKEINFO = true
MKDIR_P = @MKDIR_P@
MKINSTALLDIRS = @MKINSTALLDIRS@
MSGFMT = @MSGFMT@
diff --git binutils-2.34/binutils/doc/Makefile.in binutils-2.34/binutils/doc/Makefile.in
index b0e7b7b6c8..dbb21dd47a 100644
--- binutils-2.34/binutils/doc/Makefile.in
+++ binutils-2.34/binutils/doc/Makefile.in
@@ -298,7 +298,7 @@ LN_S = @LN_S@
LTLIBICONV = @LTLIBICONV@
LTLIBOBJS = @LTLIBOBJS@
MAINT = @MAINT@
-MAKEINFO = @MAKEINFO@
+MAKEINFO = true
MKDIR_P = @MKDIR_P@
MKINSTALLDIRS = @MKINSTALLDIRS@
MSGFMT = @MSGFMT@
diff --git binutils-2.34/gas/Makefile.in binutils-2.34/gas/Makefile.in
index 85c7b04daa..882db6dd81 100644
--- binutils-2.34/gas/Makefile.in
+++ binutils-2.34/gas/Makefile.in
@@ -318,7 +318,7 @@ LIPO = @LIPO@
LN_S = @LN_S@
LTLIBOBJS = @LTLIBOBJS@
MAINT = @MAINT@
-MAKEINFO = @MAKEINFO@
+MAKEINFO = true
MKDIR_P = @MKDIR_P@
MKINSTALLDIRS = @MKINSTALLDIRS@
MSGFMT = @MSGFMT@
diff --git binutils-2.34/gas/doc/Makefile.in binutils-2.34/gas/doc/Makefile.in
index f2336ec8c9..d4c36366a1 100644
--- binutils-2.34/gas/doc/Makefile.in
+++ binutils-2.34/gas/doc/Makefile.in
@@ -280,7 +280,7 @@ LIPO = @LIPO@
LN_S = @LN_S@
LTLIBOBJS = @LTLIBOBJS@
MAINT = @MAINT@
-MAKEINFO = @MAKEINFO@
+MAKEINFO = true
MKDIR_P = @MKDIR_P@
MKINSTALLDIRS = @MKINSTALLDIRS@
MSGFMT = @MSGFMT@
diff --git binutils-2.34/gold/Makefile.in binutils-2.34/gold/Makefile.in
index f2906ede8b..ac4fad5d55 100644
--- binutils-2.34/gold/Makefile.in
+++ binutils-2.34/gold/Makefile.in
@@ -558,7 +558,7 @@ LIBS = @LIBS@
LN_S = @LN_S@
LTLIBOBJS = @LTLIBOBJS@
MAINT = @MAINT@
-MAKEINFO = @MAKEINFO@
+MAKEINFO = true
MERGE_CONSTANTS_FLAG = @MERGE_CONSTANTS_FLAG@
MKDIR_P = @MKDIR_P@
MKINSTALLDIRS = @MKINSTALLDIRS@
diff --git binutils-2.34/gold/testsuite/Makefile.in binutils-2.34/gold/testsuite/Makefile.in
index 9f29dc638c..6907fe1f9a 100644
--- binutils-2.34/gold/testsuite/Makefile.in
+++ binutils-2.34/gold/testsuite/Makefile.in
@@ -2625,7 +2625,7 @@ LIBS = @LIBS@
LN_S = @LN_S@
LTLIBOBJS = @LTLIBOBJS@
MAINT = @MAINT@
-MAKEINFO = @MAKEINFO@
+MAKEINFO = true
MERGE_CONSTANTS_FLAG = @MERGE_CONSTANTS_FLAG@
MKDIR_P = @MKDIR_P@
MKINSTALLDIRS = @MKINSTALLDIRS@
diff --git binutils-2.34/gprof/Makefile.in binutils-2.34/gprof/Makefile.in
index efc2b80eb8..012f186281 100644
--- binutils-2.34/gprof/Makefile.in
+++ binutils-2.34/gprof/Makefile.in
@@ -349,7 +349,7 @@ LIPO = @LIPO@
LN_S = @LN_S@
LTLIBOBJS = @LTLIBOBJS@
MAINT = @MAINT@
-MAKEINFO = @MAKEINFO@
+MAKEINFO = true
MKDIR_P = @MKDIR_P@
MKINSTALLDIRS = @MKINSTALLDIRS@
MSGFMT = @MSGFMT@
diff --git binutils-2.34/ld/Makefile.in binutils-2.34/ld/Makefile.in
index 46d9b14077..2f2b0ae3ce 100644
--- binutils-2.34/ld/Makefile.in
+++ binutils-2.34/ld/Makefile.in
@@ -429,7 +429,7 @@ LIPO = @LIPO@
LN_S = @LN_S@
LTLIBOBJS = @LTLIBOBJS@
MAINT = @MAINT@
-MAKEINFO = @MAKEINFO@
+MAKEINFO = true
MKDIR_P = @MKDIR_P@
MKINSTALLDIRS = @MKINSTALLDIRS@
MSGFMT = @MSGFMT@
diff --git binutils-2.34/libctf/Makefile.in binutils-2.34/libctf/Makefile.in
index 3e8a0172f7..32dc1f08f7 100644
--- binutils-2.34/libctf/Makefile.in
+++ binutils-2.34/libctf/Makefile.in
@@ -328,7 +328,7 @@ LIPO = @LIPO@
LN_S = @LN_S@
LTLIBOBJS = @LTLIBOBJS@
MAINT = @MAINT@
-MAKEINFO = @MAKEINFO@
+MAKEINFO = true
MKDIR_P = @MKDIR_P@
NM = @NM@
NMEDIT = @NMEDIT@
diff --git binutils-2.34/libiberty/Makefile.in binutils-2.34/libiberty/Makefile.in
index fe738d0db4..6d902c5b7b 100644
--- binutils-2.34/libiberty/Makefile.in
+++ binutils-2.34/libiberty/Makefile.in
@@ -56,7 +56,7 @@ CC = @CC@
CFLAGS = @CFLAGS@
CPPFLAGS = @CPPFLAGS@
RANLIB = @RANLIB@
-MAKEINFO = @MAKEINFO@
+MAKEINFO = true
PERL = @PERL@
PICFLAG = @PICFLAG@
diff --git binutils-2.34/opcodes/Makefile.in binutils-2.34/opcodes/Makefile.in
index 8564803fc7..fa790026ac 100644
--- binutils-2.34/opcodes/Makefile.in
+++ binutils-2.34/opcodes/Makefile.in
@@ -322,7 +322,7 @@ LIPO = @LIPO@
LN_S = @LN_S@
LTLIBOBJS = @LTLIBOBJS@
MAINT = @MAINT@
-MAKEINFO = @MAKEINFO@
+MAKEINFO = true
MKDIR_P = @MKDIR_P@
MKINSTALLDIRS = @MKINSTALLDIRS@
MSGFMT = @MSGFMT@
diff --git binutils-2.34/zlib/Makefile.in binutils-2.34/zlib/Makefile.in
index 062dc04e80..4abb5ceeaa 100644
--- binutils-2.34/zlib/Makefile.in
+++ binutils-2.34/zlib/Makefile.in
@@ -304,7 +304,7 @@ LIPO = @LIPO@
LN_S = @LN_S@
LTLIBOBJS = @LTLIBOBJS@
MAINT = @MAINT@
-MAKEINFO = @MAKEINFO@
+MAKEINFO = true
MKDIR_P = @MKDIR_P@
NM = @NM@
NMEDIT = @NMEDIT@
From 41a82fb711f3637b4b7f57756492b628058f9d5f Mon Sep 17 00:00:00 2001
From: Harshit Sharma <harshitsharmajs@gmail.com>
Date: Fri, 10 Jul 2020 13:06:08 -0700
Subject: [PATCH] crossgcc: Enable GCC to get asan shadow offset at runtime
Unlike Linux kernel which has a static shadow region layout, we have multiple stages in
coreboot and thus require a different shadow offset address. Unfortunately, GCC currently
only supports adding a static shadow offset at compile time using -fasan-shadow-offset flag.
For this reason, we enable GCC to determine asan shadow offset address at runtime using a
callback function named __asan_shadow_offset(). This supersedes the need to specify this
address at compile time. GCC then makes use of this shadow offset to protect stack buffers
by inserting red zones around them.
Some other benefits of having this GCC patch are:
a. We can place the shadow region in a separate linker section with all its advantages like
automatic fit insurance. This ensures if a platform doesn't have enough memory space to
hold shadow region, the build will fail. (However, if we use a fixed shadow offset on a
platform that actually doesn't have enough memory, it may still build without any errors.)
b. We don't modify the memory layout compared to the current one, as we are placing the
shadow region at the end of the space already occupied by the program.
c. We can be much more flexible later if needed (thinking of other stages like bootblock).
d. Since we are appending the shadow buffer to the region already occupied, we make efficient
use of the limited memory available which is highly beneficial when using cache as ram.
Further, we have made sure that if you compile you tree with ASan enabled but missed this
patch, it will end up in the following compilation error:
"invalid --param name 'asan-use-shadow-offset-callback'"
So, you cannot accidentally enable the feature without having your compiler patched.
Signed-off-by: Harshit Sharma <harshitsharmajs@gmail.com>
---
gcc/asan.c | 29 ++++++++++++++++++++++-------
gcc/params.def | 6 ++++++
gcc/params.h | 2 ++
3 files changed, 30 insertions(+), 7 deletions(-)
diff --git a/gcc/asan.c b/gcc/asan.c
index 235e21947..713bf994d 100644
--- a/gcc/asan.c
+++ b/gcc/asan.c
@@ -1389,13 +1389,28 @@ asan_emit_stack_protection (rtx base, rtx pbase, unsigned int alignb,
TREE_ASM_WRITTEN (decl) = 1;
TREE_ASM_WRITTEN (id) = 1;
emit_move_insn (mem, expand_normal (build_fold_addr_expr (decl)));
- shadow_base = expand_binop (Pmode, lshr_optab, base,
- gen_int_shift_amount (Pmode, ASAN_SHADOW_SHIFT),
- NULL_RTX, 1, OPTAB_DIRECT);
- shadow_base
- = plus_constant (Pmode, shadow_base,
- asan_shadow_offset ()
- + (base_align_bias >> ASAN_SHADOW_SHIFT));
+ if (ASAN_USE_SHADOW_OFFSET_CALLBACK) {
+ rtx addr, shadow_offset_rtx;
+ ret = init_one_libfunc ("__asan_shadow_offset");
+ addr= convert_memory_address (ptr_mode, base);
+ ret = emit_library_call_value (ret, NULL_RTX, LCT_NORMAL, ptr_mode,
+ addr, ptr_mode);
+ shadow_offset_rtx = convert_memory_address (Pmode, ret);
+ shadow_base = expand_binop (Pmode, lshr_optab, base,
+ gen_int_shift_amount (Pmode, ASAN_SHADOW_SHIFT),
+ NULL_RTX, 1, OPTAB_DIRECT);
+ shadow_base = expand_binop (Pmode, add_optab, shadow_base,
+ shadow_offset_rtx, NULL_RTX, 1, OPTAB_LIB_WIDEN);
+ shadow_base = plus_constant (Pmode, shadow_base,
+ (base_align_bias >> ASAN_SHADOW_SHIFT));
+ } else {
+ shadow_base = expand_binop (Pmode, lshr_optab, base,
+ gen_int_shift_amount (Pmode, ASAN_SHADOW_SHIFT),
+ NULL_RTX, 1, OPTAB_DIRECT);
+ shadow_base = plus_constant (Pmode, shadow_base,
+ asan_shadow_offset ()
+ + (base_align_bias >> ASAN_SHADOW_SHIFT));
+ }
gcc_assert (asan_shadow_set != -1
&& (ASAN_RED_ZONE_SIZE >> ASAN_SHADOW_SHIFT) == 4);
shadow_mem = gen_rtx_MEM (SImode, shadow_base);
diff --git a/gcc/params.def b/gcc/params.def
index dad47ec2b..bfe6eaa0b 100644
--- a/gcc/params.def
+++ b/gcc/params.def
@@ -1203,6 +1203,12 @@ DEFPARAM (PARAM_ASAN_INSTRUMENTATION_WITH_CALL_THRESHOLD,
"in function becomes greater or equal to this number.",
7000, 0, INT_MAX)
+DEFPARAM (PARAM_ASAN_USE_SHADOW_OFFSET_CALLBACK,
+ "asan-use-shadow-offset-callback",
+ "Use shadow offset callback function at runtime instead of "
+ "fixed value at compile time at the cost of runtime overhead.",
+ 0, 0, 1)
+
DEFPARAM (PARAM_USE_AFTER_SCOPE_DIRECT_EMISSION_THRESHOLD,
"use-after-scope-direct-emission-threshold",