buildroot/package/libva/0001-check-ssp.patch
Bernd Kuhls 30a9e9f605 package/libva: bump version to 2.2.0
Upstream moved its github repo to github.com/intel/, updated URLs, for
reference see upstream PR 198. Also updated project URL.

Added patch to fix build without stack-protector support.

Signed-off-by: Bernd Kuhls <bernd.kuhls@t-online.de>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
2018-08-10 00:01:26 +02:00

65 lines
2.2 KiB
Diff

From c60ac5bc4f95c8d1ce3d44aa1dfad8636dbe3bee Mon Sep 17 00:00:00 2001
From: Bernd Kuhls <bernd.kuhls@t-online.de>
Date: Sun, 29 Jul 2018 00:16:25 +0200
Subject: [PATCH] Check for -fstack-protector
Not all toolchains provide support for -fstack-protector. This patch
provides a configure check to avoid build errors like
/home/buildroot/buildroot/output/host/opt/ext-toolchain/bin/../lib/gcc/x86_64-buildroot-linux-uclibc/6.4.0/../../../../x86_64-buildroot-linux-uclibc/bin/ld: cannot find -lssp_nonshared
/home/buildroot/buildroot/output/host/opt/ext-toolchain/bin/../lib/gcc/x86_64-buildroot-linux-uclibc/6.4.0/../../../../x86_64-buildroot-linux-uclibc/bin/ld: cannot find -lssp
Patch sent upstream as PR 226.
Signed-off-by: Bernd Kuhls <bernd.kuhls@t-online.de>
---
configure.ac | 16 ++++++++++++++++
va/Makefile.am | 5 ++++-
2 files changed, 20 insertions(+), 1 deletion(-)
diff --git a/configure.ac b/configure.ac
index b0b88361..da1908cf 100644
--- a/configure.ac
+++ b/configure.ac
@@ -209,6 +209,22 @@ if test "$ac_cv_have_gnuc_visibility_attribute" = "yes"; then
[Defined to 1 if GCC visibility attribute is supported])
fi
+# Check for -fstack-protector
+ssp_cc=yes
+if test "X$CC-cc" != "X"; then
+ AC_MSG_CHECKING([whether ${CC-cc} accepts -fstack-protector])
+ ssp_old_cflags="$CFLAGS"
+ CFLAGS="$CFLAGS -fstack-protector"
+ AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[alloca(100);]])], [], [ssp_cc=no])
+ AC_MSG_RESULT([$ssp_cc])
+ if test "X$ssp_cc" = "Xno"; then
+ CFLAGS="$ssp_old_cflags"
+ else
+ AC_DEFINE([ENABLE_SSP_CC], 1, [Define if SSP C support is enabled.])
+ fi
+fi
+AM_CONDITIONAL(USE_SSP, test "$ssp_cc" = "yes")
+
# Check for DRM (mandatory)
LIBDRM_VERSION=libdrm_version
PKG_CHECK_MODULES([DRM], [libdrm >= $LIBDRM_VERSION])
diff --git a/va/Makefile.am b/va/Makefile.am
index 5b6d49ab..0e94d0ff 100644
--- a/va/Makefile.am
+++ b/va/Makefile.am
@@ -77,9 +77,12 @@ libva_ldflags = \
libva_cflags = \
-Wall \
- -fstack-protector \
$(NULL)
+if USE_SSP
+libva_cflags += -fstack-protector
+endif
+
lib_LTLIBRARIES = libva.la
libvaincludedir = ${includedir}/va
libvainclude_HEADERS = $(libva_source_h)