Build: Fix bug with glibc dt-utils (#275)

* Fix bug with glibc dt-utils

* Fix openvmtools

* Fix openvmtools p2
This commit is contained in:
Pascal Vizeli
2018-12-05 07:33:15 +01:00
committed by GitHub
parent 76fad70ebe
commit fd707ba270
16 changed files with 391 additions and 271 deletions

View File

@@ -0,0 +1,75 @@
From 1c80e31872aec9f2ef7eca6a52aa89c0ea759d8f Mon Sep 17 00:00:00 2001
From: Enrico Joerns <ejo@pengutronix.de>
Date: Wed, 5 Sep 2018 12:28:28 +0200
Subject: [PATCH] src: fix compilation for glibc version 2.27.9000-36.fc29 and
newer
As recent glibc versions (>= 2.27.9000-36.fc29) also define 'struct
statx' which is also defined in linux/stat.h, compilation fails with
error:
| In file included from ../dt-utils-2018.05.0/src/crypto/digest.c:24:
| [..]/usr/include/linux/stat.h:56:8: error: redefinition of 'struct statx_timestamp'
| struct statx_timestamp {
| ^~~~~~~~~~~~~~~
| In file included from [..]/usr/include/sys/stat.h:446,
| from ../dt-utils-2018.05.0/src/dt/common.h:15,
| from ../dt-utils-2018.05.0/src/crypto/digest.c:19:
| [..]/usr/include/bits/statx.h:25:8: note: originally defined here
| struct statx_timestamp
| ^~~~~~~~~~~~~~~
| In file included from ../dt-utils-2018.05.0/src/crypto/digest.c:24:
| [..]/usr/include/linux/stat.h:99:8: error: redefinition of 'struct statx'
| struct statx {
| ^~~~~
| In file included from [..]/usr/include/sys/stat.h:446,
| from ../dt-utils-2018.05.0/src/dt/common.h:15,
| from ../dt-utils-2018.05.0/src/crypto/digest.c:19:
| [..]/usr/include/bits/statx.h:36:8: note: originally defined here
| struct statx
| ^~~~~
The linux/stat.h originates from the code that was copied from barebox
but is not explicitly required to be linux/stat.h instead of sys/stat.h
and we do not actually use struct statx.
Thus it is safe to simply replace occurrences of linux/stat.h by
sys/stat.h to fix compilation.
Signed-off-by: Enrico Joerns <ejo@pengutronix.de>
[Thomas: backport from upstream.]
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
---
src/barebox-state/backend_storage.c | 2 +-
src/crypto/digest.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/barebox-state/backend_storage.c b/src/barebox-state/backend_storage.c
index 53fe829..1052656 100644
--- a/src/barebox-state/backend_storage.c
+++ b/src/barebox-state/backend_storage.c
@@ -19,7 +19,7 @@
#include <linux/kernel.h>
#include <linux/list.h>
#include <linux/mtd/mtd-abi.h>
-#include <linux/stat.h>
+#include <sys/stat.h>
#include <linux/fs.h>
#include <malloc.h>
#include <printk.h>
diff --git a/src/crypto/digest.c b/src/crypto/digest.c
index 7a8c3c0..8353412 100644
--- a/src/crypto/digest.c
+++ b/src/crypto/digest.c
@@ -21,7 +21,7 @@
#include <malloc.h>
#include <fs.h>
#include <fcntl.h>
-#include <linux/stat.h>
+#include <sys/stat.h>
#include <errno.h>
#include <module.h>
#include <linux/err.h>
--
2.19.2

View File

@@ -4,6 +4,7 @@ config BR2_PACKAGE_GLIBC
bool
default y
select BR2_PACKAGE_LINUX_HEADERS
select BR2_TOOLCHAIN_HAS_SSP
select BR2_TOOLCHAIN_HAS_SSP if BR2_PACKAGE_HOST_BINUTILS_SUPPORTS_CFI
help
https://www.gnu.org/software/libc/
endif

View File

@@ -0,0 +1,7 @@
# Locally calculated (fetched from Github)
sha256 e08ab67b2db2d0f0e8f3311d23c54fb8f6d4c1ef6fa0b4047fd5da400e3ce9de glibc-arc-2018.03-release.tar.gz
# Hashes for license files
sha256 8177f97513213526df2cf6184d8ff986c675afb514d4e68a404010521b880643 COPYING
sha256 dc626520dcd53a22f727af3ee42c770e56c97a64fe3adb063799d8ab032fe551 COPYING.LIB
sha256 61abdd6930c9c599062d89e916b3e7968783879b6be0ee1c6229dd6169def431 LICENSES

View File

@@ -0,0 +1,88 @@
From 4a06ceea33ecc220bbfe264d8f1e74de2f04e90d Mon Sep 17 00:00:00 2001
From: Martin Jansa <Martin.Jansa@gmail.com>
Date: Tue, 2 Oct 2018 15:38:43 +0000
Subject: [PATCH] sysdeps/ieee754/soft-fp: ignore maybe-uninitialized with -O
[BZ #19444]
* with -O, -O1, -Os it fails with:
In file included from ../soft-fp/soft-fp.h:318,
from ../sysdeps/ieee754/soft-fp/s_fdiv.c:28:
../sysdeps/ieee754/soft-fp/s_fdiv.c: In function '__fdiv':
../soft-fp/op-2.h:98:25: error: 'R_f1' may be used uninitialized in this function [-Werror=maybe-uninitialized]
X##_f0 = (X##_f1 << (_FP_W_TYPE_SIZE - (N)) | X##_f0 >> (N) \
^~
../sysdeps/ieee754/soft-fp/s_fdiv.c:38:14: note: 'R_f1' was declared here
FP_DECL_D (R);
^
../soft-fp/op-2.h:37:36: note: in definition of macro '_FP_FRAC_DECL_2'
_FP_W_TYPE X##_f0 _FP_ZERO_INIT, X##_f1 _FP_ZERO_INIT
^
../soft-fp/double.h:95:24: note: in expansion of macro '_FP_DECL'
# define FP_DECL_D(X) _FP_DECL (2, X)
^~~~~~~~
../sysdeps/ieee754/soft-fp/s_fdiv.c:38:3: note: in expansion of macro 'FP_DECL_D'
FP_DECL_D (R);
^~~~~~~~~
../soft-fp/op-2.h:101:17: error: 'R_f0' may be used uninitialized in this function [-Werror=maybe-uninitialized]
: (X##_f0 << (_FP_W_TYPE_SIZE - (N))) != 0)); \
^~
../sysdeps/ieee754/soft-fp/s_fdiv.c:38:14: note: 'R_f0' was declared here
FP_DECL_D (R);
^
../soft-fp/op-2.h:37:14: note: in definition of macro '_FP_FRAC_DECL_2'
_FP_W_TYPE X##_f0 _FP_ZERO_INIT, X##_f1 _FP_ZERO_INIT
^
../soft-fp/double.h:95:24: note: in expansion of macro '_FP_DECL'
# define FP_DECL_D(X) _FP_DECL (2, X)
^~~~~~~~
../sysdeps/ieee754/soft-fp/s_fdiv.c:38:3: note: in expansion of macro 'FP_DECL_D'
FP_DECL_D (R);
^~~~~~~~~
Build tested with Yocto for ARM, AARCH64, X86, X86_64, PPC, MIPS, MIPS64
with -O, -O1, -Os.
For AARCH64 it needs one more fix in locale for -Os.
[BZ #19444]
* sysdeps/ieee754/soft-fp/s_fdiv.c: Include <libc-diag.h> and use
DIAG_PUSH_NEEDS_COMMENT, DIAG_IGNORE_NEEDS_COMMENT and
DIAG_POP_NEEDS_COMMENT to disable -Wmaybe-uninitialized.
Signed-off-by: Yegor Yefremov <yegorslists@googlemail.com>
---
sysdeps/ieee754/soft-fp/s_fdiv.c | 12 ++++++++++++
1 files changed, 12 insertions(+)
diff --git a/sysdeps/ieee754/soft-fp/s_fdiv.c b/sysdeps/ieee754/soft-fp/s_fdiv.c
index 341339f5ed..7a15cbeee6 100644
--- a/sysdeps/ieee754/soft-fp/s_fdiv.c
+++ b/sysdeps/ieee754/soft-fp/s_fdiv.c
@@ -25,6 +25,16 @@
#undef fdivl
#include <math-narrow.h>
+#include <libc-diag.h>
+
+/* R_f[01] are not set in cases where they are not used in packing,
+ but the compiler does not see that they are set in all cases where
+ they are used, resulting in warnings that they may be used
+ uninitialized. The location of the warning differs in different
+ versions of GCC, it may be where R is defined using a macro or it
+ may be where the macro is defined. This happens only with -O1. */
+DIAG_PUSH_NEEDS_COMMENT;
+DIAG_IGNORE_NEEDS_COMMENT (8, "-Wmaybe-uninitialized");
#include <soft-fp.h>
#include <single.h>
#include <double.h>
@@ -53,4 +63,6 @@ __fdiv (double x, double y)
CHECK_NARROW_DIV (ret, x, y);
return ret;
}
+DIAG_POP_NEEDS_COMMENT;
+
libm_alias_float_double (div)
--
2.17.0

View File

@@ -0,0 +1,7 @@
# Locally calculated (fetched from Github)
sha256 b070f746f932cfce107bb9be2d59ded5b44b25ddafb480c9110c52b88cc2dec1 glibc-glibc-2.28-50-gb8dd0f42780a3133c02f064a2c0c5c4e7ab61aaa.tar.gz
# Hashes for license files
sha256 8177f97513213526df2cf6184d8ff986c675afb514d4e68a404010521b880643 COPYING
sha256 dc626520dcd53a22f727af3ee42c770e56c97a64fe3adb063799d8ab032fe551 COPYING.LIB
sha256 35bdb41dc0bcb10702ddacbd51ec4c0fe6fb3129f734e8c85fc02e4d3eb0ce3f LICENSES

View File

@@ -1,8 +1,2 @@
# Locally calculated (fetched from Github)
sha256 33189b3f10c88730a1f686fac794bc01f31765f12ffd75bc5e8a0f2a690d217a glibc-glibc-2.27-57-g6c99e37f6fb640a50a3113b2dbee5d5389843c1e.tar.gz
# Locally calculated (fetched from Github)
sha256 e08ab67b2db2d0f0e8f3311d23c54fb8f6d4c1ef6fa0b4047fd5da400e3ce9de glibc-arc-2018.03-release.tar.gz
sha256 8177f97513213526df2cf6184d8ff986c675afb514d4e68a404010521b880643 COPYING
sha256 dc626520dcd53a22f727af3ee42c770e56c97a64fe3adb063799d8ab032fe551 COPYING.LIB
sha256 61abdd6930c9c599062d89e916b3e7968783879b6be0ee1c6229dd6169def431 LICENSES
# This hash file is not used; instead, update the
# hash files in the per-version sub-directories.

View File

@@ -10,7 +10,7 @@ GLIBC_SITE = $(call github,foss-for-synopsys-dwc-arc-processors,glibc,$(GLIBC_VE
else
# Generate version string using:
# git describe --match 'glibc-*' --abbrev=40 origin/release/MAJOR.MINOR/master
GLIBC_VERSION = glibc-2.27-57-g6c99e37f6fb640a50a3113b2dbee5d5389843c1e
GLIBC_VERSION = glibc-2.28-50-gb8dd0f42780a3133c02f064a2c0c5c4e7ab61aaa
# Upstream doesn't officially provide an https download link.
# There is one (https://sourceware.org/git/glibc.git) but it's not reliable,
# sometimes the connection times out. So use an unofficial github mirror.
@@ -28,7 +28,8 @@ GLIBC_ADD_TOOLCHAIN_DEPENDENCY = NO
# Before glibc is configured, we must have the first stage
# cross-compiler and the kernel headers
GLIBC_DEPENDENCIES = host-gcc-initial linux-headers host-bison host-gawk
GLIBC_DEPENDENCIES = host-gcc-initial linux-headers host-bison host-gawk \
$(BR2_MAKE_HOST_DEPENDENCY)
GLIBC_SUBDIR = build
@@ -66,6 +67,22 @@ define GLIBC_ADD_MISSING_STUB_H
endef
endif
GLIBC_CONF_ENV = \
ac_cv_path_BASH_SHELL=/bin/bash \
libc_cv_forced_unwind=yes \
libc_cv_ssp=no
# Override the default library locations of /lib64/<abi> and
# /usr/lib64/<abi>/ for RISC-V.
ifeq ($(BR2_riscv),y)
GLIBC_CONF_ENV += libc_cv_slibdir=/lib64 libc_cv_rtlddir=/lib
endif
# glibc requires make >= 4.0 since 2.28 release.
# https://www.sourceware.org/ml/libc-alpha/2018-08/msg00003.html
GLIBC_MAKE = $(BR2_MAKE)
GLIBC_CONF_ENV += ac_cv_prog_MAKE="$(BR2_MAKE)"
# Even though we use the autotools-package infrastructure, we have to
# override the default configure commands for several reasons:
#
@@ -84,10 +101,8 @@ define GLIBC_CONFIGURE_CMDS
$(TARGET_CONFIGURE_OPTS) \
CFLAGS="-O2 $(GLIBC_EXTRA_CFLAGS)" CPPFLAGS="" \
CXXFLAGS="-O2 $(GLIBC_EXTRA_CFLAGS)" \
$(GLIBC_CONF_ENV) \
$(SHELL) $(@D)/configure \
ac_cv_path_BASH_SHELL=/bin/bash \
libc_cv_forced_unwind=yes \
libc_cv_ssp=no \
--target=$(GNU_TARGET_NAME) \
--host=$(GNU_TARGET_NAME) \
--build=$(GNU_HOST_NAME) \

View File

@@ -1,26 +0,0 @@
lib/misc/msgList.c: missing #ifdef
This macro checks for BSD style printf(), which is not present
when compiling for uClibc. The linked functions are unnecessary in
this case, and they break compilation.
Signed-off-by: Karoly Kasza <kaszak@gmail.com>
--- openvmtools-stable-9.10.0.orig/open-vm-tools/lib/misc/msgList.c 2015-06-17 10:01:00.000000000 +0200
+++ openvmtools-stable-9.10.0/open-vm-tools/lib/misc/msgList.c 2015-06-17 10:01:00.000000000 +0200
@@ -487,6 +487,7 @@
return messages->id;
}
+#ifdef HAS_BSD_PRINTF
/*
*----------------------------------------------------------------------
@@ -566,6 +567,7 @@
}
}
+#endif
/*
*----------------------------------------------------------------------

View File

@@ -1,2 +1,2 @@
# locally computed
sha256 ff384ab0c11e19db0fd6ddab60e8ae48a4591b141fb3a8e8f1d4e1a489dd293f openvmtools-5a9033ddfa95786d867e4d02bbb9a29bac8fb64f.tar.gz
sha256 c0ecd281d6113ca700b1ab0a10559db72e80d8fc03264d53ebfdc400578ab1b6 openvmtools-stable-10.3.5.tar.gz

View File

@@ -4,7 +4,7 @@
#
################################################################################
OPENVMTOOLS_VERSION = 5a9033ddfa95786d867e4d02bbb9a29bac8fb64f
OPENVMTOOLS_VERSION = stable-10.3.5
OPENVMTOOLS_SITE = $(call github,vmware,open-vm-tools,$(OPENVMTOOLS_VERSION))
OPENVMTOOLS_SUBDIR = open-vm-tools
OPENVMTOOLS_LICENSE = LGPL-2.1