From 796ce1191ffd99f0bceba174355f695af8dc368a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Pokorn=C3=BD?= 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ý --- 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 - 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 + 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