check later whether the final link may succeed, and include "sh.h" → catch inlining bugs in system headers fighting with -c combine
This commit is contained in:
parent
0168f6dc48
commit
1b9bee46fc
87
Build.sh
87
Build.sh
@ -1,5 +1,5 @@
|
||||
#!/bin/sh
|
||||
srcversion='$MirOS: src/bin/mksh/Build.sh,v 1.484 2011/07/07 21:24:51 tg Exp $'
|
||||
srcversion='$MirOS: src/bin/mksh/Build.sh,v 1.485 2011/07/16 18:03:04 tg Exp $'
|
||||
#-
|
||||
# Copyright (c) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011
|
||||
# Thorsten Glaser <tg@mirbsd.org>
|
||||
@ -1001,46 +1001,6 @@ if test 1 = $i; then
|
||||
ac_flags 1 wall -Wall
|
||||
fi
|
||||
|
||||
# check whether whatever we use for the final link will succeed
|
||||
if test $cm = makefile; then
|
||||
: nothing to check
|
||||
else
|
||||
HAVE_LINK_WORKS=x
|
||||
ac_testinit link_works '' 'checking if the final link command may succeed'
|
||||
fv=1
|
||||
cat >conftest.c <<-'EOF'
|
||||
#include <stdio.h>
|
||||
int main(void) { printf("Hello, World!\n"); return (0); }
|
||||
EOF
|
||||
case $cm in
|
||||
llvm)
|
||||
v "$CC $CFLAGS $CPPFLAGS $NOWARN -emit-llvm -c conftest.c" || fv=0
|
||||
rmf mksh.s
|
||||
test $fv = 0 || v "llvm-link -o - conftest.o | opt $optflags | llc -o mksh.s" || fv=0
|
||||
test $fv = 0 || v "$CC $CFLAGS $LDFLAGS -o $tcfn mksh.s $LIBS $ccpr"
|
||||
;;
|
||||
dragonegg)
|
||||
v "$CC $CFLAGS $CPPFLAGS $NOWARN -S -flto conftest.c" || fv=0
|
||||
test $fv = 0 || v "mv conftest.s conftest.ll"
|
||||
test $fv = 0 || v "llvm-as conftest.ll" || fv=0
|
||||
rmf mksh.s
|
||||
test $fv = 0 || v "llvm-link -o - conftest.bc | opt $optflags | llc -o mksh.s" || fv=0
|
||||
test $fv = 0 || v "$CC $CFLAGS $LDFLAGS -o $tcfn mksh.s $LIBS $ccpr"
|
||||
;;
|
||||
combine)
|
||||
v "$CC $CFLAGS $CPPFLAGS $LDFLAGS -fwhole-program --combine $NOWARN -o $tcfn conftest.c $LIBS $ccpr"
|
||||
;;
|
||||
lto|normal)
|
||||
cm=normal
|
||||
v "$CC $CFLAGS $CPPFLAGS $NOWARN -c conftest.c" || fv=0
|
||||
test $fv = 0 || v "$CC $CFLAGS $LDFLAGS -o $tcfn conftest.o $LIBS $ccpr"
|
||||
;;
|
||||
esac
|
||||
test -f $tcfn || fv=0
|
||||
ac_testdone
|
||||
test $fv = 1 || exit 1
|
||||
fi
|
||||
|
||||
phase=x
|
||||
# The following tests run with -Werror or similar (all compilers) if possible
|
||||
NOWARN=$DOWARN
|
||||
@ -1192,6 +1152,51 @@ ac_header strings.h sys/types.h string.h
|
||||
ac_header ulimit.h sys/types.h
|
||||
ac_header values.h
|
||||
|
||||
#
|
||||
# check whether whatever we use for the final link will succeed
|
||||
#
|
||||
if test $cm = makefile; then
|
||||
: nothing to check
|
||||
else
|
||||
HAVE_LINK_WORKS=x
|
||||
ac_testinit link_works '' 'checking if the final link command may succeed'
|
||||
fv=1
|
||||
cat >conftest.c <<-'EOF'
|
||||
#define EXTERN
|
||||
#define MKSH_INCLUDES_ONLY
|
||||
#include "sh.h"
|
||||
__RCSID("$MirOS: src/bin/mksh/Build.sh,v 1.485 2011/07/16 18:03:04 tg Exp $");
|
||||
int main(void) { printf("Hello, World!\n"); return (0); }
|
||||
EOF
|
||||
case $cm in
|
||||
llvm)
|
||||
v "$CC $CFLAGS $CPPFLAGS $NOWARN -emit-llvm -c conftest.c" || fv=0
|
||||
rmf mksh.s
|
||||
test $fv = 0 || v "llvm-link -o - conftest.o | opt $optflags | llc -o mksh.s" || fv=0
|
||||
test $fv = 0 || v "$CC $CFLAGS $LDFLAGS -o $tcfn mksh.s $LIBS $ccpr"
|
||||
;;
|
||||
dragonegg)
|
||||
v "$CC $CFLAGS $CPPFLAGS $NOWARN -S -flto conftest.c" || fv=0
|
||||
test $fv = 0 || v "mv conftest.s conftest.ll"
|
||||
test $fv = 0 || v "llvm-as conftest.ll" || fv=0
|
||||
rmf mksh.s
|
||||
test $fv = 0 || v "llvm-link -o - conftest.bc | opt $optflags | llc -o mksh.s" || fv=0
|
||||
test $fv = 0 || v "$CC $CFLAGS $LDFLAGS -o $tcfn mksh.s $LIBS $ccpr"
|
||||
;;
|
||||
combine)
|
||||
v "$CC $CFLAGS $CPPFLAGS $LDFLAGS -fwhole-program --combine $NOWARN -o $tcfn conftest.c $LIBS $ccpr"
|
||||
;;
|
||||
lto|normal)
|
||||
cm=normal
|
||||
v "$CC $CFLAGS $CPPFLAGS $NOWARN -c conftest.c" || fv=0
|
||||
test $fv = 0 || v "$CC $CFLAGS $LDFLAGS -o $tcfn conftest.o $LIBS $ccpr"
|
||||
;;
|
||||
esac
|
||||
test -f $tcfn || fv=0
|
||||
ac_testdone
|
||||
test $fv = 1 || exit 1
|
||||
fi
|
||||
|
||||
#
|
||||
# Environment: definitions
|
||||
#
|
||||
|
Loading…
Reference in New Issue
Block a user