Clang fixes
cover Clang fixes
These changes are found with clang and makes oe-core build again with clang
The following changes since commit 6265facc75c3d980dd39494399251bf9121c25cb:
epiphany: Add missing mime-xgd inherit (2020-01-19 23:49:39 +0000)
are available in the Git repository at:
git://git.yoctoproject.org/poky-contrib kraj/pu
http://git.yoctoproject.org/cgit.cgi/poky-contrib/log/?h=kraj/pu
Khem Raj (3):
gettext: Fix overloadable error with clang
mesa: Help compile with clang/mips
tcp-wrappers: Remove redundant forward declarations
.../gettext/gettext-0.20.1/overloadable.patch | 22 ++++++++++ meta/recipes-core/gettext/gettext_0.20.1.bb | 1 + ...0001-Remove-fgets-extern-declaration.patch | 43 +++++++++++++++++++ .../tcp-wrappers/tcp-wrappers_7.6.bb | 1 + ...sdetects-64bit-atomics-on-mips-clang.patch | 27 ++++++++++++ meta/recipes-graphics/mesa/mesa_19.3.1.bb | 1 + 6 files changed, 95 insertions(+) create mode 100644 meta/recipes-core/gettext/gettext-0.20.1/overloadable.patch create mode 100644 meta/recipes-extended/tcp-wrappers/tcp-wrappers-7.6/0001-Remove-fgets-extern-declaration.patch create mode 100644 meta/recipes-graphics/mesa/files/0001-meson-misdetects-64bit-atomics-on-mips-clang.patch
Signature · 1 line
2.25.0
PATCH 1/3 gettext: Fix overloadable error with clang
Clang detects that getcwd is being re-declared and signatures don't match, simple solution is to let clang use overloadable attribute
--- .../gettext/gettext-0.20.1/overloadable.patch | 22 +++++++++++++++++++ meta/recipes-core/gettext/gettext_0.20.1.bb | 1 + 2 files changed, 23 insertions(+) create mode 100644 meta/recipes-core/gettext/gettext-0.20.1/overloadable.patch
meta/recipes-core/gettext/gettext-0.20.1/overloadable.patch new file +22 -0
@@ -0,0 +1,22 @@ +Use overloadable attribute to aid clang + +Fixes +dcigettext.c:147:7: error: redeclaration of 'getcwd' must have the 'overloadable' attribute + +Upstream-Status: Pending +Signed-off-by: Khem Raj <[email protected]> +--- a/gettext-runtime/intl/dcigettext.c ++++ b/gettext-runtime/intl/dcigettext.c +@@ -144,7 +144,11 @@ char *getwd (); + # if VMS + # define getcwd(buf, max) (getcwd) (buf, max, 0) + # else +-char *getcwd (); ++char ++#ifdef __clang__ ++__attribute__((overloadable)) ++#endif ++*getcwd (); + # endif + # endif + # ifndef HAVE_STPCPY
meta/recipes-core/gettext/gettext_0.20.1.bb +1 -0
@@ -25,6 +25,7 @@ SRC_URI = "${GNU_MIRROR}/gettext/gettext-${PV}.tar.gz \ file://serial-tests-config.patch \ file://0001-msgmerge-Fix-behaviour-of-for-msgfmt-on-PO-files-wit.patch \ file://0001-tests-autopoint-3-unset-MAKEFLAGS.patch \ + file://overloadable.patch \ " SRC_URI[md5sum] = "bb5b0c0caa028105f3ca1905ddc306e2"
Signature · 1 line
2.25.0
PATCH 2/3 mesa: Help compile with clang/mips
In reply to Khem Rajmeson is detecting it does not support 64bit attomics but then when defining local suppliments confused clang
../mesa-19.3.1/src/util/u_atomic.c:38:1: error: cannot redeclare builtin function '__sync_add_and_fetch_8' __sync_add_and_fetch_8(uint64_t *ptr, uint64_t val)
^../mesa-19.3.1/src/util/u_atomic.c:38:1: note: '__sync_add_and_fetch_8' is a builtin with type 'long long (volatile long long *, long long, ...)' ../mesa-19.3.1/src/util/u_atomic.c:38:1: error: definition of builtin function '__sync_add_and_fetch_8' __sync_add_and_fetch_8(uint64_t *ptr, uint64_t val)
^
--- ...sdetects-64bit-atomics-on-mips-clang.patch | 27 +++++++++++++++++++ meta/recipes-graphics/mesa/mesa_19.3.1.bb | 1 + 2 files changed, 28 insertions(+) create mode 100644 meta/recipes-graphics/mesa/files/0001-meson-misdetects-64bit-atomics-on-mips-clang.patch
meta/recipes-graphics/mesa/files/0001-meson-misdetects-64bit-atomics-on-mips-clang.patch new file +27 -0
@@ -0,0 +1,27 @@ +From bb2f0bea553d51d659a9bc46f7ae186885405151 Mon Sep 17 00:00:00 2001 +From: Khem Raj <[email protected]> +Date: Mon, 13 Jan 2020 15:23:47 -0800 +Subject: [PATCH] meson misdetects 64bit atomics on mips/clang + +Upstream-Status: Pending +Signed-off-by: Khem Raj <[email protected]> +--- + src/util/u_atomic.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/src/util/u_atomic.c b/src/util/u_atomic.c +index e4bffa8..58e1ddd 100644 +--- a/src/util/u_atomic.c ++++ b/src/util/u_atomic.c +@@ -21,7 +21,7 @@ + * IN THE SOFTWARE. + */ + +-#if defined(MISSING_64BIT_ATOMICS) && defined(HAVE_PTHREAD) ++#if !defined(__clang__) && defined(MISSING_64BIT_ATOMICS) && defined(HAVE_PTHREAD) + + #include <stdint.h> + #include <pthread.h> +-- +2.24.1 +
meta/recipes-graphics/mesa/mesa_19.3.1.bb +1 -0
@@ -6,6 +6,7 @@ SRC_URI = "https://mesa.freedesktop.org/archive/mesa-${PV}.tar.xz \ file://0003-Allow-enable-DRI-without-DRI-drivers.patch \ file://0004-Revert-mesa-Enable-asm-unconditionally-now-that-gen_.patch \ file://0005-vc4-use-intmax_t-for-formatted-output-of-timespec-me.patch \ + file://0001-meson-misdetects-64bit-atomics-on-mips-clang.patch \ " SRC_URI[md5sum] = "5c5965db31993af47fee82c9a7ccba5e"
Signature · 1 line
2.25.0
PATCH 3/3 tcp-wrappers: Remove redundant forward declarations
In reply to Khem Rajfgets is already in stdio.h, and it can confuse the compilers when using fortified headers, therefore remove the declarations
--- ...0001-Remove-fgets-extern-declaration.patch | 43 +++++++++++++++++++ .../tcp-wrappers/tcp-wrappers_7.6.bb | 1 + 2 files changed, 44 insertions(+) create mode 100644 meta/recipes-extended/tcp-wrappers/tcp-wrappers-7.6/0001-Remove-fgets-extern-declaration.patch
meta/recipes-extended/tcp-wrappers/tcp-wrappers-7.6/0001-Remove-fgets-extern-declaration.patch new file +43 -0
@@ -0,0 +1,43 @@ +From 24d10919b4bc5e37a2d80b274d2cd2ee77b03549 Mon Sep 17 00:00:00 2001 +From: Khem Raj <[email protected]> +Date: Mon, 13 Jan 2020 14:25:47 -0800 +Subject: [PATCH] Remove fgets() extern declaration + +These sources already include <stdio.h> which should bring the correct +declaration + +Upstream-Status: Pending +Signed-off-by: Khem Raj <[email protected]> +--- + hosts_access.c | 1 - + misc.c | 2 -- + 2 files changed, 3 deletions(-) + +diff --git a/hosts_access.c b/hosts_access.c +index 329b35e..0133e5e 100644 +--- a/hosts_access.c ++++ b/hosts_access.c +@@ -44,7 +44,6 @@ static char sccsid[] = "@(#) hosts_access.c 1.21 97/02/12 02:13:22"; + #include <netdb.h> + #endif + +-extern char *fgets(); + extern int errno; + + #ifndef INADDR_NONE +diff --git a/misc.c b/misc.c +index 74ca319..9a5e73a 100644 +--- a/misc.c ++++ b/misc.c +@@ -18,8 +18,6 @@ static char sccsic[] = "@(#) misc.c 1.2 96/02/11 17:01:29"; + + #include "tcpd.h" + +-extern char *fgets(); +- + #ifndef INADDR_NONE + #define INADDR_NONE (-1) /* XXX should be 0xffffffff */ + #endif +-- +2.24.1 +
meta/recipes-extended/tcp-wrappers/tcp-wrappers_7.6.bb +1 -0
@@ -49,6 +49,7 @@ SRC_URI = "http://ftp.porcupine.org/pub/security/tcp_wrappers_${PV}.tar.gz \ file://0001-Fix-build-with-clang.patch \ file://fix_warnings.patch \ file://fix_warnings2.patch \ + file://0001-Remove-fgets-extern-declaration.patch \ " SRC_URI[md5sum] = "e6fa25f71226d090f34de3f6b122fb5a"
Signature · 1 line
2.25.0