[dunfell,09/11] apt: add -fno-strict-aliasing to CXXFLAGS to fix SHA256 bug

Message ID b08ec0a0e0f160f9b67e2fabed03fb8fd174e0b5.1650131192.git.steve@sakoman.com
State Accepted, archived
Commit dc61dfd7791976c70c93e0d253a8fdbd40d27f3b
Headers show
Series [dunfell,01/11] vim: Upgrade 8.2.4524 -> 8.2.4681 | expand

Commit Message

Steve Sakoman April 16, 2022, 7:14 p.m. UTC
From: Ralph Siemsen <ralph.siemsen@linaro.org>

Recently we've begun seeing issues with apt SHA256 generation/checking on some
distros (fedora 35, alma 8). The version of apt in dunfell uses its own
SHA256 code, not a standard library.

Investigation reveals that the issue is related to -fstrict-aliasing enabled by
-O2 optimization, so turn it off with -fno-strict-aliasing

Signed-off-by: Ralph Siemsen <ralph.siemsen@linaro.org>
Signed-off-by: Steve Sakoman <steve@sakoman.com>
---
 meta/recipes-devtools/apt/apt.inc | 4 ++++
 1 file changed, 4 insertions(+)

Patch

diff --git a/meta/recipes-devtools/apt/apt.inc b/meta/recipes-devtools/apt/apt.inc
index ba827848a7..251795eeca 100644
--- a/meta/recipes-devtools/apt/apt.inc
+++ b/meta/recipes-devtools/apt/apt.inc
@@ -37,5 +37,9 @@  do_configure_prepend() {
     rm -rf ${S}/buildlib/config.guess
 }
 
+# there are code generation issues with some compilers in the SHA256 implementation
+# turn off strict-aliasing to avoid these issues
+CXXFLAGS:append = " -fno-strict-aliasing"
+
 USERADD_PACKAGES = "${PN}"
 USERADD_PARAM_${PN} = "--system --no-create-home --home-dir /nonexistent --shell /bin/false --user-group _apt"