Patchwork configure: Detect when glibc implements makecontext() to always fail

login
register
mail settings
Submitter Peter Maydell
Date Feb. 23, 2012, 4:16 p.m.
Message ID <1330013760-25793-1-git-send-email-peter.maydell@linaro.org>
Download mbox | patch
Permalink /patch/142659/
State New
Headers show

Comments

Peter Maydell - Feb. 23, 2012, 4:16 p.m.
Improve the configure test for presence of ucontext functions by
making linker warnings fatal; this allows us to detect when we are
linked with a glibc which implements makecontext() to always return
ENOSYS.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
---
Compiling on an Ubuntu Natty ARM host will hit this.
(Anybody think we should clean up our configure tests so we can
enable -Werror and -Wl,--fatal-warnings on all of them?)

 configure |    7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)
Peter Maydell - Feb. 23, 2012, 4:19 p.m.
On 23 February 2012 16:16, Peter Maydell <peter.maydell@linaro.org> wrote:
> Improve the configure test for presence of ucontext functions by
> making linker warnings fatal; this allows us to detect when we are
> linked with a glibc which implements makecontext() to always return
> ENOSYS.

Er, ignore this, emailed wrong patch by mistake!

-- PMM

Patch

diff --git a/configure b/configure
index 9b4fe34..4d9d9e0 100755
--- a/configure
+++ b/configure
@@ -2549,9 +2549,12 @@  ucontext_coroutine=no
 if test "$darwin" != "yes"; then
   cat > $TMPC << EOF
 #include <ucontext.h>
-int main(void) { makecontext(0, 0, 0); }
+int main(void) { makecontext(0, 0, 0); return 0; }
 EOF
-  if compile_prog "" "" ; then
+  # Note that we enable fatal linker warnings to catch the
+  # glibc "makecontext is not implemented and will always fail"
+  # linker warning.
+  if compile_prog "-Wl,--fatal-warnings" "" ; then
       ucontext_coroutine=yes
   fi
 fi