libqb/02-build-configure-run-attribute-section-test-through-r.patch
Jan Pokorný 95877b0e29
1.0.2-10 - Evolution of the previous (rhbz#1478089, rhbz#1487787)
Signed-off-by: Jan Pokorný <jpokorny@redhat.com>
2017-10-13 23:04:41 +02:00

57 lines
2.0 KiB
Diff

From ccfe20a89b3099f17f22971995ace787356ed5f4 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Jan=20Pokorn=C3=BD?= <jpokorny@redhat.com>
Date: Fri, 6 Oct 2017 17:17:26 +0200
Subject: [PATCH 2/6] build: configure: run attribute section test through
run-time assertion
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
It's unclear why the apparently run-time test hasn't been set to that
effect, mere compilability was tested so far.
Also, based on feedback by Ferenc Wágner, unify and increase usability
of the run-time error signalling through assertions.
Signed-off-by: Jan Pokorný <jpokorny@redhat.com>
---
configure.ac | 22 +++++++++++++---------
1 file changed, 13 insertions(+), 9 deletions(-)
diff --git a/configure.ac b/configure.ac
index 22630ba..478194c 100644
--- a/configure.ac
+++ b/configure.ac
@@ -620,15 +620,19 @@ AC_SUBST(HAVE_SLOW_TESTS)
if test "x${GCC}" = xyes; then
AC_MSG_CHECKING([whether GCC supports __attribute__((section()) + ld supports orphan sections])
if test "x${ac_cv_link_attribute_section}" = x ; then
- AC_TRY_LINK([#include <assert.h>
- extern void * __start___verbose, * __stop___verbose;],
- [static int my_var __attribute__((section("__verbose"))) = 5;
- if (__start___verbose == __stop___verbose) assert(0);
- if (my_var == 5) return 0;
- else return -1;
- ],
- [gcc_has_attribute_section=yes],
- [gcc_has_attribute_section=no])
+ AC_TRY_RUN(
+ AC_LANG_PROGRAM(
+ [[#include <assert.h>
+ extern void * __start___verbose, * __stop___verbose;]],
+ [[static int my_var __attribute__((section("__verbose"))) = 5;
+ assert("non-empty data section"
+ && __start___verbose != __stop___verbose);
+ assert("no data section value loss"
+ && my_var == 5);]]
+ ),
+ [gcc_has_attribute_section=yes],
+ [gcc_has_attribute_section=no]
+ )
else
gcc_has_attribute_section=${ac_cv_link_attribute_section}
fi
--
2.14.2