Skip to contentSkip to conversation

gdbm: add patch to fix link failure against gcc 10

PATCH In review Otavio Salvador 2 participants 10 messages Jun 12, 2020

lore
Share & tools
lore
#0 lore raw

PATCH 1/9 gdbm: add patch to fix link failure against gcc 10

From: Richard Leitner <[email protected]>

This also makes appending "-fcommon" to CFLAGS obsolete and enables native builds with a host gcc v10.

(cherry picked from commit 7717b35265e6ef8ef71a4eca4074294dfcc2110c)

---

 ...gdbm-fix-link-failure-against-gcc-10.patch | 47 +++++++++++++++++++
 meta/recipes-support/gdbm/gdbm_1.18.1.bb      |  3 +-
 2 files changed, 48 insertions(+), 2 deletions(-)
 create mode 100644 meta/recipes-support/gdbm/files/gdbm-fix-link-failure-against-gcc-10.patch
meta/recipes-support/gdbm/files/gdbm-fix-link-failure-against-gcc-10.patch new file +47 -0
new file mode 100644
index 0000000000..c1580418dc
@@ -0,0 +1,47 @@
+From f993697af81c37df9c55e0ebedeb1b8b880506ae Mon Sep 17 00:00:00 2001
+From: Richard Leitner <[email protected]>
+Date: Tue, 5 May 2020 11:59:42 +0200
+Subject: [PATCH] gdbm: fix link failure against gcc-10
+
+Copied from gentoo's solution at https://bugs.gentoo.org/show_bug.cgi?id=705898
+Original patch by Sergei Trofimovich <[email protected]>
+
+Original description:
+
+Before the change on gcc-10 link failed as:
+```
+  CCLD     gdbmtool
+ld: ./libgdbmapp.a(parseopt.o):(.bss+0x8): multiple definition of `parseopt_program_args';
+  gdbmtool.o:(.data.rel.local+0x260): first defined here
+ld: ./libgdbmapp.a(parseopt.o):(.bss+0x10): multiple definition of `parseopt_program_doc';
+  gdbmtool.o:(.data.rel.local+0x268): first defined here
+```
+
+gcc-10 will change the default from -fcommon to fno-common:
+    https://gcc.gnu.org/PR85678.
+
+The fix is to avoid multiple definition and rely on
+declarations only.
+
+Upstream-Status: Pending
+Signed-off-by: Richard Leitner <[email protected]>
+---
+ src/parseopt.c | 2 --
+ 1 file changed, 2 deletions(-)
+
+diff --git a/src/parseopt.c b/src/parseopt.c
+index 268e080..a4c8576 100644
+--- a/src/parseopt.c
++++ b/src/parseopt.c
+@@ -255,8 +255,6 @@ print_option_descr (const char *descr, size_t lmargin, size_t rmargin)
+ }
+ 
+ char *parseopt_program_name;
+-char *parseopt_program_doc;
+-char *parseopt_program_args;
+ const char *program_bug_address = "<" PACKAGE_BUGREPORT ">";
+ void (*parseopt_help_hook) (FILE *stream);
+ 
+-- 
+2.26.2
+
meta/recipes-support/gdbm/gdbm_1.18.1.bb +1 -2
index 5cb7c558b8..fbb1fe72d7 100644
@@ -8,6 +8,7 @@ LIC_FILES_CHKSUM = "file://COPYING;md5=241da1b9fe42e642cbb2c24d5e0c4d24"
 SRC_URI = "${GNU_MIRROR}/gdbm/gdbm-${PV}.tar.gz \
            file://run-ptest \
            file://ptest.patch \
+           file://gdbm-fix-link-failure-against-gcc-10.patch \
           "
 
 SRC_URI[md5sum] = "988dc82182121c7570e0cb8b4fcd5415"
@@ -23,8 +24,6 @@ CACHED_CONFIGUREVARS += "ac_cv_lib_ndbm_main=no ac_cv_lib_dbm_main=no"
 
 BBCLASSEXTEND = "native nativesdk"
 
-CFLAGS += "-fcommon"
-
 do_install_append () {
     # Create a symlink to ndbm.h and gdbm.h in include/gdbm to let other packages to find
     # these headers
Signature · 1 line
2.27.0
#1 lore raw

PATCH 2/9 libtirpc: remove extra "-fcommon" from CFLAGS

From: Richard Leitner <[email protected]>

commit daed7eedba ("Avoid multiple-definiton with gcc -fno-common") of libtirpc fixed the -fno-common issues. Therefore it should be save to remove the extra "-fcommon" in CFLAGS.

(cherry picked from commit 9e4546701775fe98532f011f5ad146cfb1b33715)

---

 meta/recipes-extended/libtirpc/libtirpc_1.2.5.bb | 2 --
 1 file changed, 2 deletions(-)
meta/recipes-extended/libtirpc/libtirpc_1.2.5.bb +0 -2
index fc66821ecc..f8e34f58a2 100644
@@ -21,8 +21,6 @@ inherit autotools pkgconfig
 
 EXTRA_OECONF = "--disable-gssapi"
 
-CFLAGS += "-fcommon"
-
 do_install_append() {
 	chown root:root ${D}${sysconfdir}/netconfig
 }
Signature · 1 line
2.27.0
#2 lore raw

PATCH 3/9 libtirpc: upgrade 1.2.5 -> 1.2.6

In reply to Otavio Salvador

From: zhengruoqin <[email protected]>

0001-xdr_float-do-not-include-bits-endian.h.patch
removed since it is included in 1.2.6

(cherry picked from commit c940792e1492923036cae97010f9945e7ad43a32)

---

 ...r_float-do-not-include-bits-endian.h.patch | 34 -------------------
 .../{libtirpc_1.2.5.bb => libtirpc_1.2.6.bb}  |  8 ++---
 2 files changed, 3 insertions(+), 39 deletions(-)
 delete mode 100644 meta/recipes-extended/libtirpc/libtirpc/0001-xdr_float-do-not-include-bits-endian.h.patch
 rename meta/recipes-extended/libtirpc/{libtirpc_1.2.5.bb => libtirpc_1.2.6.bb} (74%)
meta/recipes-extended/libtirpc/libtirpc/0001-xdr_float-do-not-include-bits-endian.h.patch deleted +0 -34
deleted file mode 100644
index 3797cdf521..0000000000
@@ -1,34 +0,0 @@
-From d04f4d6f0e682f16b0ce96839ab4eadade591eb1 Mon Sep 17 00:00:00 2001
-From: Rosen Penev <[email protected]>
-Date: Tue, 21 Jan 2020 11:51:16 -0500
-Subject: [PATCH] xdr_float: do not include bits/endian.h
-
-bits/endian.h is an internal header. endian.h should be included.
-
-Fixes compilation with recent musl.
-
-Signed-off-by: Rosen Penev <[email protected]>
-Signed-off-by: Steve Dickson <[email protected]>
-
-Upstream-Status: Backport [http://git.linux-nfs.org/?p=steved/libtirpc.git;a=commit;h=d04f4d6f0e682f16b0ce96839ab4eadade591eb1]
-Signed-off-by: Anuj Mittal <[email protected]>
----
- src/xdr_float.c | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/src/xdr_float.c b/src/xdr_float.c
-index 26bc865..349d48f 100644
---- a/src/xdr_float.c
-+++ b/src/xdr_float.c
-@@ -83,7 +83,7 @@ static struct sgl_limits {
- };
- #else
- 
--#include <bits/endian.h>
-+#include <endian.h>
- #define IEEEFP
- 
- #endif /* vax */
--- 
-2.21.1
-
meta/recipes-extended/libtirpc/libtirpc_1.2.6.bb renamed from meta/recipes-extended/libtirpc/libtirpc_1.2.5.bb +3 -5
similarity index 74%
rename from meta/recipes-extended/libtirpc/libtirpc_1.2.5.bb
rename to meta/recipes-extended/libtirpc/libtirpc_1.2.6.bb
index f8e34f58a2..10a324c3b6 100644
@@ -9,13 +9,11 @@ LIC_FILES_CHKSUM = "file://COPYING;md5=f835cce8852481e4b2bbbdd23b5e47f3 \
 
 PROVIDES = "virtual/librpc"
 
-SRC_URI = "${SOURCEFORGE_MIRROR}/${BPN}/${BP}.tar.bz2 \
-           file://0001-xdr_float-do-not-include-bits-endian.h.patch \
-           "
+SRC_URI = "${SOURCEFORGE_MIRROR}/${BPN}/${BP}.tar.bz2"
 UPSTREAM_CHECK_URI = "https://sourceforge.net/projects/libtirpc/files/libtirpc/"
 UPSTREAM_CHECK_REGEX = "(?P<pver>\d+(\.\d+)+)/"
-SRC_URI[md5sum] = "688787ddff7c6a92ef15ae3f5dc4dfa1"
-SRC_URI[sha256sum] = "f3b6350c7e9c3cd9c58fc7a5e5f8e6be469cc571bb5eb31eb9790b3e675186ca"
+SRC_URI[md5sum] = "b25f9cc18bfad50f7c446c77f4ae00bb"
+SRC_URI[sha256sum] = "4278e9a5181d5af9cd7885322fdecebc444f9a3da87c526e7d47f7a12a37d1cc"
 
 inherit autotools pkgconfig
 
Signature · 1 line
2.27.0
Acked-by on v1 3/9
#3 lore raw

Re: [OE-core] [dunfell-backport PATCH 3/9] libtirpc: upgrade 1.2.5 -> 1.2.6

Quoted 10 lines · Otavio Salvador

From: zhengruoqin <[email protected]>

0001-xdr_float-do-not-include-bits-endian.h.patch
removed since it is included in 1.2.6

(cherry picked from commit c940792e1492923036cae97010f9945e7ad43a32)

For me this fixes native build on hosts with gcc10

#4 lore raw

PATCH 4/9 dtc: update to 1.6.0

In reply to Otavio Salvador

From: Richard Leitner <[email protected]>

This also fixes issues with gcc 10's default change to "-fno-common".

(cherry picked from commit 3acc1e5d5bce4e229801c9d66391e007390fb373)

---

 meta/recipes-kernel/dtc/{dtc_1.5.1.bb => dtc_1.6.0.bb} | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
 rename meta/recipes-kernel/dtc/{dtc_1.5.1.bb => dtc_1.6.0.bb} (81%)
meta/recipes-kernel/dtc/dtc_1.6.0.bb renamed from meta/recipes-kernel/dtc/dtc_1.5.1.bb +1 -1
similarity index 81%
rename from meta/recipes-kernel/dtc/dtc_1.5.1.bb
rename to meta/recipes-kernel/dtc/dtc_1.6.0.bb
index 9df8a06d47..92df70d9fc 100644
@@ -3,7 +3,7 @@ require dtc.inc
 LIC_FILES_CHKSUM = "file://GPL;md5=b234ee4d69f5fce4486a80fdaf4a4263 \
 		    file://libfdt/libfdt.h;beginline=4;endline=7;md5=05bb357cfb75cae7d2b01d2ee8d76407"
 
-SRCREV = "60e0db3d65a1218b0d5a29474e769f28a18e3ca6"
+SRCREV = "2525da3dba9beceb96651dc2986581871dbeca30"
 
 S = "${WORKDIR}/git"
 
Signature · 1 line
2.27.0
#5 lore raw

PATCH 5/9 go-mod.bbclass: Add class for `go mod` support

In reply to Otavio Salvador

From: Otavio Salvador <[email protected]>

When using Go Modules, the the current working directory MUST be at or below the location of the 'go.mod' file when the go tool is used, and there is no way to tell it to look elsewhere. It will automatically look upwards for the file, but not downwards.

To support this use case, we provide the GO_WORKDIR variable, which defaults to GO_IMPORT but allows for easy override.

[YOCTO #13883]

(cherry picked from commit 11c2b06ac98cc5064640705712bffa156519f450)

---

 meta/classes/go-mod.bbclass | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)
 create mode 100644 meta/classes/go-mod.bbclass
meta/classes/go-mod.bbclass new file +20 -0
new file mode 100644
index 0000000000..5871d02506
@@ -0,0 +1,20 @@
+# Handle Go Modules support
+#
+# When using Go Modules, the the current working directory MUST be at or below
+# the location of the 'go.mod' file when the go tool is used, and there is no
+# way to tell it to look elsewhere.  It will automatically look upwards for the
+# file, but not downwards.
+#
+# To support this use case, we provide the `GO_WORKDIR` variable, which defaults
+# to `GO_IMPORT` but allows for easy override.
+#
+# Copyright 2020 (C) O.S. Systems Software LTDA.
+
+# The '-modcacherw' option ensures we have write access to the cached objects so
+# we avoid errors during clean task as well as when removing the TMPDIR.
+export GOBUILDFLAGS ?= "-v ${GO_LDFLAGS} -modcacherw"
+
+inherit go
+
+GO_WORKDIR ?= "${GO_IMPORT}"
+do_compile[dirs] += "${B}/src/${GO_WORKDIR}"
Signature · 1 line
2.27.0
#6 lore raw

PATCH 6/9 glide: Avoid use of 'go mod' support

In reply to Otavio Salvador

From: Otavio Salvador <[email protected]>

Glide utility must not use 'go mod' support, so we explicitly disable it.

(cherry picked from commit b5a4369ba606677285b0a89a78c040b38f57767f)

---

 meta/recipes-devtools/glide/glide_0.13.3.bb | 4 ++++
 1 file changed, 4 insertions(+)
meta/recipes-devtools/glide/glide_0.13.3.bb +4 -0
index ebad0ec60a..31295edf90 100644
@@ -9,6 +9,10 @@ SRCREV = "8ed5b9292379d86c39592a7e6a58eb9c903877cf"
 
 inherit go
 
+# New Go versions has Go modules support enabled by default and cause the Glide
+# tool build to fail.
+export GO111MODULE = "off"
+
 RDEPENDS_${PN}-dev += "bash"
 RDEPENDS_${PN}-ptest += "bash"
 
Signature · 1 line
2.27.0
#7 lore raw

PATCH 7/9 go-dep: Avoid use of 'go mod' support

In reply to Otavio Salvador

From: Otavio Salvador <[email protected]>

dep utility must not use 'go mod' support, so we explicitly disable it.

(cherry picked from commit b34000ae3dd6e0a1d7fc332efb35c5da84cf2275)

---

 meta/recipes-devtools/go/go-dep_0.5.4.bb | 4 ++++
 1 file changed, 4 insertions(+)
meta/recipes-devtools/go/go-dep_0.5.4.bb +4 -0
index 615cb289e5..496224a5cf 100644
@@ -13,6 +13,10 @@ SRCREV = "1f7c19e5f52f49ffb9f956f64c010be14683468b"
 
 inherit go
 
+# New Go versions has Go modules support enabled by default and cause the Glide
+# tool build to fail.
+export GO111MODULE = "off"
+
 GO_INSTALL = "${GO_IMPORT}/cmd/dep"
 
 RDEPENDS_${PN}-dev += "bash"
Signature · 1 line
2.27.0
#8 lore raw

PATCH 8/9 go.bbclass: Add `-trimpath` to default build flags

In reply to Otavio Salvador

From: Otavio Salvador <[email protected]>

The -trimpath option is important for reproducible builds so full build paths and module paths are not embedded.

(cherry picked from commit e3df027b3697b6a92b417bba8d442a5bd15525fd)

---

 meta/classes/go.bbclass | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
meta/classes/go.bbclass +1 -1
index c99689ac59..a9e31b50ea 100644
@@ -41,7 +41,7 @@ GO_EXTLDFLAGS ?= "${HOST_CC_ARCH}${TOOLCHAIN_OPTIONS} ${GO_RPATH_LINK} ${LDFLAGS
 GO_LINKMODE ?= ""
 GO_LINKMODE_class-nativesdk = "--linkmode=external"
 GO_LDFLAGS ?= '-ldflags="${GO_RPATH} ${GO_LINKMODE} -extldflags '${GO_EXTLDFLAGS}'"'
-export GOBUILDFLAGS ?= "-v ${GO_LDFLAGS}"
+export GOBUILDFLAGS ?= "-v ${GO_LDFLAGS} -trimpath"
 export GOPATH_OMIT_IN_ACTIONID ?= "1"
 export GOPTESTBUILDFLAGS ?= "${GOBUILDFLAGS} -c"
 export GOPTESTFLAGS ?= ""
Signature · 1 line
2.27.0
#9 lore raw

PATCH 9/9 binutils: add patch to fix issues with gcc 10

In reply to Otavio Salvador

From: Richard Leitner <[email protected]>

gcc 10 introduced "-fno-common" as default. Therefore backport the according binutils patch to fix this issue.

(cherry picked from commit fbeb572e1872cf64786d01d5c6408a6765f814ce)

---

 .../binutils/binutils-2.34.inc                |  1 +
 ...dundant-program_name-definition-fno-.patch | 61 +++++++++++++++++++
 2 files changed, 62 insertions(+)
 create mode 100644 meta/recipes-devtools/binutils/binutils/0017-binutils-drop-redundant-program_name-definition-fno-.patch
meta/recipes-devtools/binutils/binutils-2.34.inc +1 -0
index 66a3850ef2..f65fdb7328 100644
@@ -41,6 +41,7 @@ SRC_URI = "\
      file://0014-Detect-64-bit-MIPS-targets.patch \
      file://0015-sync-with-OE-libtool-changes.patch \
      file://0016-Check-for-clang-before-checking-gcc-version.patch \
+     file://0017-binutils-drop-redundant-program_name-definition-fno-.patch \
      file://CVE-2020-0551.patch \
 "
 S  = "${WORKDIR}/git"
meta/recipes-devtools/binutils/binutils/0017-binutils-drop-redundant-program_name-definition-fno-.patch new file +61 -0

61 lines not on this page · raw message

Signature · 1 line
2.27.0