Skip to content

Commit 2a8ad65

Browse files
committed
hostboot: Patch to fix GCC 10 errors
Signed-off-by: Joel Stanley <[email protected]>
1 parent 2df494b commit 2a8ad65

4 files changed

+187
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
From fd9ca28d5fd2a4428add2e4c04b3514d5d1dae3f Mon Sep 17 00:00:00 2001
2+
From: Joel Stanley <[email protected]>
3+
Date: Thu, 17 Mar 2022 12:46:15 +1030
4+
Subject: [PATCH 1/4] util: Fix unique_ptr with GCC 9
5+
6+
Change-Id: I08ead07fe5b587b43e06410b31dbfdba54d9a442
7+
Signed-off-by: Joel Stanley <[email protected]>
8+
---
9+
src/include/util/impl/unique_ptr.H | 2 +-
10+
1 file changed, 1 insertion(+), 1 deletion(-)
11+
12+
diff --git a/src/include/util/impl/unique_ptr.H b/src/include/util/impl/unique_ptr.H
13+
index 689794330196..5c486526b81b 100644
14+
--- a/src/include/util/impl/unique_ptr.H
15+
+++ b/src/include/util/impl/unique_ptr.H
16+
@@ -402,7 +402,7 @@ namespace std
17+
* @return Value of T::operator[](i)
18+
*/
19+
template<typename Index, typename X = T>
20+
- typename enable_if<is_array<X>::value, decltype(declval<X>()[declval<Index>()])>::type
21+
+ typename enable_if<is_array<X>::value, decltype(declval<X>()[declval<Index>()])>::type&
22+
operator[](const Index i)
23+
{
24+
return iv_ptr[i];
25+
--
26+
2.35.1
27+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
From 6fbd93ed7307402027aa336fc6dc512022e7baeb Mon Sep 17 00:00:00 2001
2+
From: Joel Stanley <[email protected]>
3+
Date: Thu, 17 Mar 2022 14:00:52 +1030
4+
Subject: [PATCH 2/4] utilmisc: Fix build error with GCC 10
5+
MIME-Version: 1.0
6+
Content-Type: text/plain; charset=UTF-8
7+
Content-Transfer-Encoding: 8bit
8+
9+
From when this was introduced (2737de709eae) it wasn't commented why it
10+
was done this way. Clean it up.
11+
12+
utilmisc.C:31:6: error: ‘bool Util::isSimics()’ specifies less restrictive attribute than its target ‘bool Util::__isSimicsRunning()’: ‘nothrow’ [-Werror=missing-attributes]
13+
31 | bool isSimics() __attribute__((alias("__isSimicsRunning")));
14+
| ^~~~~~~~
15+
utilmisc.C:34:6: note: ‘bool Util::isSimics()’ target declared here
16+
34 | bool __isSimicsRunning()
17+
| ^~~~~~~~~~~~~~~~~
18+
utilmisc.C:48:6: error: ‘bool Util::isQmeModelEnabled()’ specifies less restrictive attribute than its target ‘bool Util::__isQmeEnabled()’: ‘nothrow’ [-Werror=missing-attributes]
19+
48 | bool isQmeModelEnabled() __attribute__((alias("__isQmeEnabled")));
20+
| ^~~~~~~~~~~~~~~~~
21+
utilmisc.C:51:6: note: ‘bool Util::isQmeModelEnabled()’ target declared here
22+
51 | bool __isQmeEnabled()
23+
| ^~~~~~~~~~~~~~
24+
25+
Change-Id: Id5291022b09dca6789175d69e54a30d55f1bde13
26+
Signed-off-by: Joel Stanley <[email protected]>
27+
---
28+
src/lib/utilmisc.C | 18 ++++++++++--------
29+
1 file changed, 10 insertions(+), 8 deletions(-)
30+
31+
diff --git a/src/lib/utilmisc.C b/src/lib/utilmisc.C
32+
index b3ca1ac04c53..85665c824487 100644
33+
--- a/src/lib/utilmisc.C
34+
+++ b/src/lib/utilmisc.C
35+
@@ -28,8 +28,7 @@
36+
namespace Util
37+
{
38+
39+
-bool isSimics() __attribute__((alias("__isSimicsRunning")));
40+
-extern "C" bool __isSimicsRunning() NEVER_INLINE;
41+
+bool __isSimicsRunning() NEVER_INLINE;
42+
43+
bool __isSimicsRunning()
44+
{
45+
@@ -40,12 +39,11 @@ bool __isSimicsRunning()
46+
47+
bool isSimicsRunning()
48+
{
49+
- static bool simics = isSimics();
50+
+ static bool simics = __isSimicsRunning();
51+
return simics;
52+
}
53+
54+
55+
-bool isQmeModelEnabled() __attribute__((alias("__isQmeEnabled")));
56+
extern "C" bool __isQmeEnabled() NEVER_INLINE;
57+
58+
bool __isQmeEnabled()
59+
@@ -58,7 +56,7 @@ bool __isQmeEnabled()
60+
bool requiresSecondaryCoreWorkaround()
61+
{
62+
static const auto required =
63+
- isSimicsRunning() && !isQmeModelEnabled();
64+
+ isSimicsRunning() && !__isQmeEnabled();
65+
return required;
66+
}
67+
68+
@@ -86,10 +84,14 @@ void setIsConsoleStarted()
69+
g_isConsoleStarted = true;
70+
}
71+
72+
-bool isMultiprocSupported() __attribute__((alias("__isMultiprocSupported")));
73+
extern "C" bool __isMultiprocSupported() NEVER_INLINE;
74+
75+
-bool __isMultiprocSupported()
76+
+bool __isMulitprocSupported()
77+
+{
78+
+ return MAGIC_INST_CHECK_FEATURE(MAGIC_FEATURE__MULTIPROC);
79+
+}
80+
+
81+
+bool isMultiprocSupported()
82+
{
83+
bool multiprocSupport = true;
84+
85+
@@ -98,7 +100,7 @@ bool __isMultiprocSupported()
86+
#else
87+
if (isSimicsRunning())
88+
{
89+
- multiprocSupport = MAGIC_INST_CHECK_FEATURE(MAGIC_FEATURE__MULTIPROC);
90+
+ multiprocSupport = __isMulitprocSupported();
91+
}
92+
#endif
93+
94+
--
95+
2.35.1
96+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
From b2d596f1116dfb13f0f980b5a85aa92fe6a795dd Mon Sep 17 00:00:00 2001
2+
From: Joel Stanley <[email protected]>
3+
Date: Thu, 17 Mar 2022 12:52:49 +1030
4+
Subject: [PATCH 3/4] cflags: Work around errors with GCC 9
5+
6+
Change-Id: Ib0542c1fc53a5f1480981158eed10f9a46029446
7+
Signed-off-by: Joel Stanley <[email protected]>
8+
---
9+
src/build/mkrules/cflags.env.mk | 5 +++--
10+
1 file changed, 3 insertions(+), 2 deletions(-)
11+
12+
diff --git a/src/build/mkrules/cflags.env.mk b/src/build/mkrules/cflags.env.mk
13+
index 9b1d30266e30..2bd5ca9a6640 100644
14+
--- a/src/build/mkrules/cflags.env.mk
15+
+++ b/src/build/mkrules/cflags.env.mk
16+
@@ -45,10 +45,11 @@ CFLAGS += -include config.h
17+
COMMONFLAGS += $(OPT_LEVEL) -nostdlib
18+
CFLAGS += $(COMMONFLAGS) -mcpu=power7 -nostdinc -g -mno-vsx -mno-altivec\
19+
-Werror -Wall -mtraceback=no -pipe -mabi=elfv1 \
20+
- -ffunction-sections -fdata-sections -ffreestanding -mbig-endian
21+
+ -ffunction-sections -fdata-sections -ffreestanding -mbig-endian \
22+
+ -Wno-address-of-packed-member
23+
ASMFLAGS += $(COMMONFLAGS) -mcpu=power7 -mbig-endian -ffreestanding -mabi=elfv1
24+
CXXFLAGS += $(CFLAGS) -nostdinc++ -fno-rtti -fno-exceptions -Werror -Wall \
25+
- -fuse-cxa-atexit -std=gnu++14
26+
+ -fuse-cxa-atexit -std=gnu++14 -fpermissive
27+
LDFLAGS += --nostdlib --sort-common -EB $(COMMONFLAGS)
28+
29+
INCFLAGS = $(addprefix -I, $(INCDIR) )
30+
--
31+
2.35.1
32+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
From 953f2631d1aadbb4f8eca50c4420a80778cfe4ed Mon Sep 17 00:00:00 2001
2+
From: Joel Stanley <[email protected]>
3+
Date: Thu, 17 Mar 2022 14:34:15 +1030
4+
Subject: [PATCH 4/4] cflags: Disable stack protector
5+
6+
powerpc64le-buildroot-linux-gnu-ld: ../obj/core/bootloader.o: in function `Bootloader::verifyComponentId(void const*, char const*)':
7+
src/bootloader/bootloader.C:279: undefined reference to `__stack_chk_fail'
8+
9+
We should provide an implementation of __stack_chk_fail.
10+
11+
Change-Id: I2af514278b0eaa87a0b7f17fa1908d2b26adf3c4
12+
Signed-off-by: Joel Stanley <[email protected]>
13+
---
14+
src/build/mkrules/cflags.env.mk | 2 +-
15+
1 file changed, 1 insertion(+), 1 deletion(-)
16+
17+
diff --git a/src/build/mkrules/cflags.env.mk b/src/build/mkrules/cflags.env.mk
18+
index 2bd5ca9a6640..b30c82d65255 100644
19+
--- a/src/build/mkrules/cflags.env.mk
20+
+++ b/src/build/mkrules/cflags.env.mk
21+
@@ -46,7 +46,7 @@ COMMONFLAGS += $(OPT_LEVEL) -nostdlib
22+
CFLAGS += $(COMMONFLAGS) -mcpu=power7 -nostdinc -g -mno-vsx -mno-altivec\
23+
-Werror -Wall -mtraceback=no -pipe -mabi=elfv1 \
24+
-ffunction-sections -fdata-sections -ffreestanding -mbig-endian \
25+
- -Wno-address-of-packed-member
26+
+ -Wno-address-of-packed-member -fno-stack-protector
27+
ASMFLAGS += $(COMMONFLAGS) -mcpu=power7 -mbig-endian -ffreestanding -mabi=elfv1
28+
CXXFLAGS += $(CFLAGS) -nostdinc++ -fno-rtti -fno-exceptions -Werror -Wall \
29+
-fuse-cxa-atexit -std=gnu++14 -fpermissive
30+
--
31+
2.35.1
32+

0 commit comments

Comments
 (0)