Skip to content

Commit

Permalink
Configuration updates to compile with GCC 8
Browse files Browse the repository at this point in the history
Edit op-build config files to use GCC 8 compiler.
Temporarily added 0001-Fix-gcc8-signature-validation-anomaly HB patch.
Temporarily added 0002-GCC8-Code-Fixes HB patch.
Has 0003-space-saving-compile-options patch to reduce size of bootkernel.

Signed-off-by: Luis Fernandez <[email protected]>
  • Loading branch information
LF-Luis committed Jul 3, 2019
1 parent aaebcd4 commit 4e89368
Show file tree
Hide file tree
Showing 7 changed files with 187 additions and 4 deletions.
2 changes: 1 addition & 1 deletion openpower/configs/p9dsu_defconfig
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
BR2_powerpc64le=y
BR2_powerpc_power8=y
BR2_BINUTILS_EXTRA_CONFIG_OPTIONS="--enable-targets=powerpc64-linux"
BR2_GCC_VERSION_6_X=y
BR2_GCC_VERSION_8_X=y
BR2_EXTRA_GCC_CONFIG_OPTIONS="--enable-targets=powerpc64-linux --disable-libsanitizer"
BR2_TOOLCHAIN_BUILDROOT_CXX=y
BR2_TARGET_GENERIC_HOSTNAME="skiroot"
Expand Down
2 changes: 1 addition & 1 deletion openpower/configs/romulus_defconfig
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
BR2_powerpc64le=y
BR2_powerpc_power8=y
BR2_BINUTILS_EXTRA_CONFIG_OPTIONS="--enable-targets=powerpc64-linux"
BR2_GCC_VERSION_6_X=y
BR2_GCC_VERSION_8_X=y
BR2_EXTRA_GCC_CONFIG_OPTIONS="--enable-targets=powerpc64-linux --disable-libsanitizer"
BR2_TOOLCHAIN_BUILDROOT_CXX=y
BR2_TARGET_GENERIC_HOSTNAME="skiroot"
Expand Down
2 changes: 1 addition & 1 deletion openpower/configs/witherspoon_defconfig
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
BR2_powerpc64le=y
BR2_powerpc_power8=y
BR2_BINUTILS_EXTRA_CONFIG_OPTIONS="--enable-targets=powerpc64-linux"
BR2_GCC_VERSION_6_X=y
BR2_GCC_VERSION_8_X=y
BR2_EXTRA_GCC_CONFIG_OPTIONS="--enable-targets=powerpc64-linux --disable-libsanitizer"
BR2_TOOLCHAIN_BUILDROOT_CXX=y
BR2_TARGET_GENERIC_HOSTNAME="skiroot"
Expand Down
2 changes: 1 addition & 1 deletion openpower/configs/zaius_defconfig
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
BR2_powerpc64le=y
BR2_powerpc_power8=y
BR2_BINUTILS_EXTRA_CONFIG_OPTIONS="--enable-targets=powerpc64-linux"
BR2_GCC_VERSION_6_X=y
BR2_GCC_VERSION_8_X=y
BR2_EXTRA_GCC_CONFIG_OPTIONS="--enable-targets=powerpc64-linux --disable-libsanitizer"
BR2_TOOLCHAIN_BUILDROOT_CXX=y
BR2_TARGET_GENERIC_HOSTNAME="skiroot"
Expand Down
13 changes: 13 additions & 0 deletions openpower/linux/0003-space-saving-compile-options.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
diff --git a/Makefile b/Makefile
index 46b6081..efa2361 100644
--- a/Makefile
+++ b/Makefile
@@ -444,7 +444,7 @@ KBUILD_CFLAGS := -Wall -Wundef -Werror=strict-prototypes -Wno-trigraphs \
-fno-strict-aliasing -fno-common -fshort-wchar -fno-PIE \
-Werror=implicit-function-declaration -Werror=implicit-int \
-Wno-format-security \
- -std=gnu89
+ -std=gnu89 -fno-asynchronous-unwind-tables -g0 -fno-shrink-wrap
KBUILD_CPPFLAGS := -D__KERNEL__
KBUILD_AFLAGS_KERNEL :=
KBUILD_CFLAGS_KERNEL :=
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
From 7c5b7b28ee43fed5ece1d5284db375e641502a3d Mon Sep 17 00:00:00 2001
From: Nick Bofferding <[email protected]>
Date: Sat, 15 Jun 2019 21:35:29 -0500
Subject: [PATCH] Fix gcc8 signature validation anomaly

Fixes an issue where signature validation fails when the crypto library is
compiled under GCC8.

Change-Id: I4d586f7df537c062dd8e50a9c2052701446b2213
---
src/securerom/ecverify.C | 38 +++++++++++++++++++++++---------------
1 file changed, 23 insertions(+), 15 deletions(-)

diff --git a/src/securerom/ecverify.C b/src/securerom/ecverify.C
index 6df77df..7b4b21d 100644
--- a/src/securerom/ecverify.C
+++ b/src/securerom/ecverify.C
@@ -5,7 +5,7 @@
/* */
/* OpenPOWER HostBoot Project */
/* */
-/* Contributors Listed Below - COPYRIGHT 2016,2017 */
+/* Contributors Listed Below - COPYRIGHT 2016,2019 */
/* [+] International Business Machines Corp. */
/* */
/* */
@@ -506,20 +506,22 @@ static void bn_mul (bn_t *r, const bn_t *a, const bn_t *b)
a += NWORDS;
for (i=0; i<NWORDS; i++)
{
- asm("mulld %0,%1,%2" //pl = *(--a) * tb
+ --a;
+ asm("mulld %0,%1,%2" //pl = *(a) * tb
: "=r" (pl)
- : "r" (*(--a)), "r" (tb)
+ : "r" (*(a)), "r" (tb)
);
asm("mulhdu %0,%1,%2" //ph = *a * tb
: "=r" (ph)
: "r" (*a), "r" (tb)
);
- asm("addc %1,%5,%4\n" //pl += *(--r)
+ --r;
+ asm("addc %1,%5,%4\n" //pl += *(r)
"addze %2,%6\n" //ph += ca
"addc %0,%5,%7\n" //*r = pl + th
"addze %3,%6" //th = ph + ca
: "=r" (*r), "=r" (pl), "=r" (ph), "=r" (th)
- : "0" (*(--r)), "1" (pl), "2" (ph), "3" (th)
+ : "0" (*(r)), "1" (pl), "2" (ph), "3" (th)
);
}
*(--r) = th;
@@ -674,22 +676,26 @@ static void bn_modred_fast (bn_t *r, bn_t *a)
for (i=0; i<NWORDS-2; i++) {
t1 = *(--ah) << 55;
t2 = *ah >> 9;
- asm("addc %3,%7,%5\n" //t3 = *(--al) + t0;
+ --al;
+ --r;
+ asm("addc %3,%7,%5\n" //t3 = *(al) + t0;
"addze %2,%6\n" //t2 += ca;
- "addc %0,%4,%8\n" //*(--r) = t3 + t1;
+ "addc %0,%4,%8\n" //*(r) = t3 + t1;
"addze %1,%6" //t0 = t2 + ca;
- : "=r" (*(--r)), "=r" (t0), "=r" (t2), "=r" (t3)
- : "3" (t3), "1" (t0), "2" (t2), "r" (*(--al)), "r" (t1)
+ : "=r" (*(r)), "=r" (t0), "=r" (t2), "=r" (t3)
+ : "3" (t3), "1" (t0), "2" (t2), "r" (*(al)), "r" (t1)
);
}
t1 = *(--ah) << 55;
t2 = (*ah >> 9)&BN_PRIME_MSW_MASK;
- asm("addc %3,%7,%5\n" //t3 = *(--al) + t0;
+ --al;
+ --r;
+ asm("addc %3,%7,%5\n" //t3 = *(al) + t0;
"addze %2,%6\n" //t2 += ca;
- "addc %0,%4,%8\n" //*(--r) = t3 + t1;
+ "addc %0,%4,%8\n" //*(r) = t3 + t1;
"addze %1,%6" //t0 = t2 + ca;
- : "=r" (*(--r)), "=r" (t0), "=r" (t2), "=r" (t3)
- : "3" (t3), "1" (t0), "2" (t2), "r" (*(--al)), "r" (t1)
+ : "=r" (*(r)), "=r" (t0), "=r" (t2), "=r" (t3)
+ : "3" (t3), "1" (t0), "2" (t2), "r" (*(al)), "r" (t1)
);
*(--r) = (*(--al)&BN_PRIME_MSW_MASK) + t0;
}
@@ -702,15 +708,17 @@ static void __attribute__((noinline)) bn_modred_slow (bn_t *r)
bn_t t0 = *r >> 9;
*r &= BN_PRIME_MSW_MASK;
r += NWORDS;
+ --r;
asm("addc %0,%1,%2"
: "=r" (*r)
- : "0" (*(--r)), "r" (t0)
+ : "0" (*(r)), "r" (t0)
);
for (i=0; i<NWORDS-1; i++)
{
+ --r;
asm("addze %0,%1"
: "=r" (*r)
- : "0" (*(--r))
+ : "0" (*(r))
);
}
}
--
1.8.3.1

59 changes: 59 additions & 0 deletions openpower/package/hostboot/0002-GCC8-Code-Fixes.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
From 4d0708caf22cd2204d715e6f813b6c2179f412c6 Mon Sep 17 00:00:00 2001
From: Luis Fernandez <[email protected]>
Date: Tue, 18 Jun 2019 14:45:23 -0500
Subject: [PATCH 2/2] GCC8 Code Fixes

Code fix for when compiling with GCC8.

Change-Id: I4d9f2f7ca070806992a19e5910c7d9ec33adb700
---
.../lib/utils/mcbist/gen_mss_mcbist_address.H | 26 +++++++++++-----------
1 file changed, 13 insertions(+), 13 deletions(-)

diff --git a/src/import/generic/memory/lib/utils/mcbist/gen_mss_mcbist_address.H b/src/import/generic/memory/lib/utils/mcbist/gen_mss_mcbist_address.H
index b87cacb..992b1b2 100644
--- a/src/import/generic/memory/lib/utils/mcbist/gen_mss_mcbist_address.H
+++ b/src/import/generic/memory/lib/utils/mcbist/gen_mss_mcbist_address.H
@@ -162,14 +162,14 @@ class address
template< mss::mc_type MC = DEFAULT_MC_TYPE >
address( const ecc::trap_address<MC>& i_address )
{
- this->set_field<PORT >(i_address.get_field<ecc::trap_address<MC>::PORT>());
- this->set_field<DIMM >(i_address.get_field<ecc::trap_address<MC>::DIMM>());
- this->set_field<MRANK >(i_address.get_field<ecc::trap_address<MC>::MRANK>());
- this->set_field<SRANK >(i_address.get_field<ecc::trap_address<MC>::SRANK>());
- this->set_field<ROW >(i_address.get_field<ecc::trap_address<MC>::ROW>());
- this->set_field<COL >(i_address.get_field<ecc::trap_address<MC>::COL>());
- this->set_field<BANK >(i_address.get_field<ecc::trap_address<MC>::BANK>());
- this->set_field<BANK_GROUP>(i_address.get_field<ecc::trap_address<MC>::BANK_GROUP>());
+ this->set_field<PORT >(i_address.template get_field<ecc::trap_address<MC>::PORT>());
+ this->set_field<DIMM >(i_address.template get_field<ecc::trap_address<MC>::DIMM>());
+ this->set_field<MRANK >(i_address.template get_field<ecc::trap_address<MC>::MRANK>());
+ this->set_field<SRANK >(i_address.template get_field<ecc::trap_address<MC>::SRANK>());
+ this->set_field<ROW >(i_address.template get_field<ecc::trap_address<MC>::ROW>());
+ this->set_field<COL >(i_address.template get_field<ecc::trap_address<MC>::COL>());
+ this->set_field<BANK >(i_address.template get_field<ecc::trap_address<MC>::BANK>());
+ this->set_field<BANK_GROUP>(i_address.template get_field<ecc::trap_address<MC>::BANK_GROUP>());
}

///
@@ -180,11 +180,11 @@ class address
template< mss::mc_type MC = DEFAULT_MC_TYPE >
address( const ecc::fwms::address<MC>& i_address )
{
- this->set_field<DIMM >(i_address.get_field<ecc::fwms::address<MC>::DIMM>());
- this->set_field<MRANK >(i_address.get_field<ecc::fwms::address<MC>::MRANK>());
- this->set_field<SRANK >(i_address.get_field<ecc::fwms::address<MC>::SRANK>());
- this->set_field<BANK_GROUP>(i_address.get_field<ecc::fwms::address<MC>::BANK_GROUP>());
- this->set_field<BANK >(i_address.get_field<ecc::fwms::address<MC>::BANK>());
+ this->set_field<DIMM >(i_address.template get_field<ecc::fwms::address<MC>::DIMM>());
+ this->set_field<MRANK >(i_address.template get_field<ecc::fwms::address<MC>::MRANK>());
+ this->set_field<SRANK >(i_address.template get_field<ecc::fwms::address<MC>::SRANK>());
+ this->set_field<BANK_GROUP>(i_address.template get_field<ecc::fwms::address<MC>::BANK_GROUP>());
+ this->set_field<BANK >(i_address.template get_field<ecc::fwms::address<MC>::BANK>());
}

///
--
1.8.2.2

0 comments on commit 4e89368

Please sign in to comment.