Skip to content

Commit

Permalink
hostboot: Patch to fix GCC 10 errors
Browse files Browse the repository at this point in the history
Signed-off-by: Joel Stanley <[email protected]>
  • Loading branch information
shenki committed Mar 17, 2022
1 parent 2df494b commit 2a8ad65
Show file tree
Hide file tree
Showing 4 changed files with 187 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
From fd9ca28d5fd2a4428add2e4c04b3514d5d1dae3f Mon Sep 17 00:00:00 2001
From: Joel Stanley <[email protected]>
Date: Thu, 17 Mar 2022 12:46:15 +1030
Subject: [PATCH 1/4] util: Fix unique_ptr with GCC 9

Change-Id: I08ead07fe5b587b43e06410b31dbfdba54d9a442
Signed-off-by: Joel Stanley <[email protected]>
---
src/include/util/impl/unique_ptr.H | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/include/util/impl/unique_ptr.H b/src/include/util/impl/unique_ptr.H
index 689794330196..5c486526b81b 100644
--- a/src/include/util/impl/unique_ptr.H
+++ b/src/include/util/impl/unique_ptr.H
@@ -402,7 +402,7 @@ namespace std
* @return Value of T::operator[](i)
*/
template<typename Index, typename X = T>
- typename enable_if<is_array<X>::value, decltype(declval<X>()[declval<Index>()])>::type
+ typename enable_if<is_array<X>::value, decltype(declval<X>()[declval<Index>()])>::type&
operator[](const Index i)
{
return iv_ptr[i];
--
2.35.1

Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
From 6fbd93ed7307402027aa336fc6dc512022e7baeb Mon Sep 17 00:00:00 2001
From: Joel Stanley <[email protected]>
Date: Thu, 17 Mar 2022 14:00:52 +1030
Subject: [PATCH 2/4] utilmisc: Fix build error with GCC 10
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

From when this was introduced (2737de709eae) it wasn't commented why it
was done this way. Clean it up.

utilmisc.C:31:6: error: ‘bool Util::isSimics()’ specifies less restrictive attribute than its target ‘bool Util::__isSimicsRunning()’: ‘nothrow’ [-Werror=missing-attributes]
31 | bool isSimics() __attribute__((alias("__isSimicsRunning")));
| ^~~~~~~~
utilmisc.C:34:6: note: ‘bool Util::isSimics()’ target declared here
34 | bool __isSimicsRunning()
| ^~~~~~~~~~~~~~~~~
utilmisc.C:48:6: error: ‘bool Util::isQmeModelEnabled()’ specifies less restrictive attribute than its target ‘bool Util::__isQmeEnabled()’: ‘nothrow’ [-Werror=missing-attributes]
48 | bool isQmeModelEnabled() __attribute__((alias("__isQmeEnabled")));
| ^~~~~~~~~~~~~~~~~
utilmisc.C:51:6: note: ‘bool Util::isQmeModelEnabled()’ target declared here
51 | bool __isQmeEnabled()
| ^~~~~~~~~~~~~~

Change-Id: Id5291022b09dca6789175d69e54a30d55f1bde13
Signed-off-by: Joel Stanley <[email protected]>
---
src/lib/utilmisc.C | 18 ++++++++++--------
1 file changed, 10 insertions(+), 8 deletions(-)

diff --git a/src/lib/utilmisc.C b/src/lib/utilmisc.C
index b3ca1ac04c53..85665c824487 100644
--- a/src/lib/utilmisc.C
+++ b/src/lib/utilmisc.C
@@ -28,8 +28,7 @@
namespace Util
{

-bool isSimics() __attribute__((alias("__isSimicsRunning")));
-extern "C" bool __isSimicsRunning() NEVER_INLINE;
+bool __isSimicsRunning() NEVER_INLINE;

bool __isSimicsRunning()
{
@@ -40,12 +39,11 @@ bool __isSimicsRunning()

bool isSimicsRunning()
{
- static bool simics = isSimics();
+ static bool simics = __isSimicsRunning();
return simics;
}


-bool isQmeModelEnabled() __attribute__((alias("__isQmeEnabled")));
extern "C" bool __isQmeEnabled() NEVER_INLINE;

bool __isQmeEnabled()
@@ -58,7 +56,7 @@ bool __isQmeEnabled()
bool requiresSecondaryCoreWorkaround()
{
static const auto required =
- isSimicsRunning() && !isQmeModelEnabled();
+ isSimicsRunning() && !__isQmeEnabled();
return required;
}

@@ -86,10 +84,14 @@ void setIsConsoleStarted()
g_isConsoleStarted = true;
}

-bool isMultiprocSupported() __attribute__((alias("__isMultiprocSupported")));
extern "C" bool __isMultiprocSupported() NEVER_INLINE;

-bool __isMultiprocSupported()
+bool __isMulitprocSupported()
+{
+ return MAGIC_INST_CHECK_FEATURE(MAGIC_FEATURE__MULTIPROC);
+}
+
+bool isMultiprocSupported()
{
bool multiprocSupport = true;

@@ -98,7 +100,7 @@ bool __isMultiprocSupported()
#else
if (isSimicsRunning())
{
- multiprocSupport = MAGIC_INST_CHECK_FEATURE(MAGIC_FEATURE__MULTIPROC);
+ multiprocSupport = __isMulitprocSupported();
}
#endif

--
2.35.1

Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
From b2d596f1116dfb13f0f980b5a85aa92fe6a795dd Mon Sep 17 00:00:00 2001
From: Joel Stanley <[email protected]>
Date: Thu, 17 Mar 2022 12:52:49 +1030
Subject: [PATCH 3/4] cflags: Work around errors with GCC 9

Change-Id: Ib0542c1fc53a5f1480981158eed10f9a46029446
Signed-off-by: Joel Stanley <[email protected]>
---
src/build/mkrules/cflags.env.mk | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/src/build/mkrules/cflags.env.mk b/src/build/mkrules/cflags.env.mk
index 9b1d30266e30..2bd5ca9a6640 100644
--- a/src/build/mkrules/cflags.env.mk
+++ b/src/build/mkrules/cflags.env.mk
@@ -45,10 +45,11 @@ CFLAGS += -include config.h
COMMONFLAGS += $(OPT_LEVEL) -nostdlib
CFLAGS += $(COMMONFLAGS) -mcpu=power7 -nostdinc -g -mno-vsx -mno-altivec\
-Werror -Wall -mtraceback=no -pipe -mabi=elfv1 \
- -ffunction-sections -fdata-sections -ffreestanding -mbig-endian
+ -ffunction-sections -fdata-sections -ffreestanding -mbig-endian \
+ -Wno-address-of-packed-member
ASMFLAGS += $(COMMONFLAGS) -mcpu=power7 -mbig-endian -ffreestanding -mabi=elfv1
CXXFLAGS += $(CFLAGS) -nostdinc++ -fno-rtti -fno-exceptions -Werror -Wall \
- -fuse-cxa-atexit -std=gnu++14
+ -fuse-cxa-atexit -std=gnu++14 -fpermissive
LDFLAGS += --nostdlib --sort-common -EB $(COMMONFLAGS)

INCFLAGS = $(addprefix -I, $(INCDIR) )
--
2.35.1

Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
From 953f2631d1aadbb4f8eca50c4420a80778cfe4ed Mon Sep 17 00:00:00 2001
From: Joel Stanley <[email protected]>
Date: Thu, 17 Mar 2022 14:34:15 +1030
Subject: [PATCH 4/4] cflags: Disable stack protector

powerpc64le-buildroot-linux-gnu-ld: ../obj/core/bootloader.o: in function `Bootloader::verifyComponentId(void const*, char const*)':
src/bootloader/bootloader.C:279: undefined reference to `__stack_chk_fail'

We should provide an implementation of __stack_chk_fail.

Change-Id: I2af514278b0eaa87a0b7f17fa1908d2b26adf3c4
Signed-off-by: Joel Stanley <[email protected]>
---
src/build/mkrules/cflags.env.mk | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/build/mkrules/cflags.env.mk b/src/build/mkrules/cflags.env.mk
index 2bd5ca9a6640..b30c82d65255 100644
--- a/src/build/mkrules/cflags.env.mk
+++ b/src/build/mkrules/cflags.env.mk
@@ -46,7 +46,7 @@ COMMONFLAGS += $(OPT_LEVEL) -nostdlib
CFLAGS += $(COMMONFLAGS) -mcpu=power7 -nostdinc -g -mno-vsx -mno-altivec\
-Werror -Wall -mtraceback=no -pipe -mabi=elfv1 \
-ffunction-sections -fdata-sections -ffreestanding -mbig-endian \
- -Wno-address-of-packed-member
+ -Wno-address-of-packed-member -fno-stack-protector
ASMFLAGS += $(COMMONFLAGS) -mcpu=power7 -mbig-endian -ffreestanding -mabi=elfv1
CXXFLAGS += $(CFLAGS) -nostdinc++ -fno-rtti -fno-exceptions -Werror -Wall \
-fuse-cxa-atexit -std=gnu++14 -fpermissive
--
2.35.1

0 comments on commit 2a8ad65

Please sign in to comment.