Distinguish between gcc and mescc; select LIBS accordingly.

* build-aux/check.sh.in: Distinguish between gcc and mescc;
add MES_CHECKING_BUILTIN_LIBS.
* build-aux/test-c.sh: Use it to select LIBS accordingly.
This commit is contained in:
Danny Milosavljevic 2020-08-29 15:24:48 +02:00 committed by Jan (janneke) Nieuwenhuizen
parent 56f859200e
commit 237dd8a0f0
No known key found for this signature in database
GPG Key ID: F3C1A0D9C1D65273
2 changed files with 18 additions and 6 deletions

View File

@ -79,6 +79,8 @@ if test $compiler = gcc; then
cd gcc-lib cd gcc-lib
srcdest=$srcdir/../ srcdest=$srcdir/../
srcdir=../$srcdir srcdir=../$srcdir
MES_CHECKING_BUILTIN_LIBS="-l gcc"
export MES_CHECKING_BUILTIN_LIBS
../pre-inst-env ${SHELL} ${srcdest}build-aux/check-mescc.sh ../pre-inst-env ${SHELL} ${srcdest}build-aux/check-mescc.sh
) )
fi fi
@ -97,7 +99,8 @@ fi
LDFLAGS=" LDFLAGS="
-nostdlib -nostdlib
" "
LIBS="-lc -lmescc" MES_CHECKING_BUILTIN_LIBS="-l mescc"
export MES_CHECKING_BUILTIN_LIBS
AR="${srcdest}pre-inst-env mesar" AR="${srcdest}pre-inst-env mesar"
CC="${srcdest}pre-inst-env mescc" CC="${srcdest}pre-inst-env mescc"
../pre-inst-env ${SHELL} ${srcdest}build-aux/check-mescc.sh ../pre-inst-env ${SHELL} ${srcdest}build-aux/check-mescc.sh

View File

@ -40,16 +40,25 @@ rm -f "$o"
CC=${CC-gcc} CC=${CC-gcc}
i=$(basename "$t" .c) i=$(basename "$t" .c)
if [ -z "${MES_CHECKING_BUILTIN_LIBS}" ]
then
MES_CHECKING_BUILTIN_LIBS="`${CC} --print-libgcc-file-name`"
fi
if [ -z "${i/[012][0-9]-*/}" ]; then if [ -z "${i/[012][0-9]-*/}" ]; then
LIBS='-l mescc' LIBS="${MES_CHECKING_BUILTIN_LIBS}"
elif [ -z "${i/[34][0-9]-*/}" ]; then elif [ -z "${i/[34][0-9]-*/}" ]; then
LIBS='-l c-mini -l mescc' LIBS="-l c-mini ${MES_CHECKING_BUILTIN_LIBS} -l c-mini"
elif [ -z "${i/[78][0-9a-z]-*/}" ]; then elif [ -z "${i/[78][0-9a-z]-*/}" ]; then
LIBS='-l c+tcc -l mescc' LIBS="-l c+tcc ${MES_CHECKING_BUILTIN_LIBS} -l c+tcc"
elif [ -z "${i/9[0-9a-z]-*/}" ]; then elif [ -z "${i/9[0-9a-z]-*/}" ]; then
LIBS='-l c+gnu -l mescc' LIBS="-l c+gnu ${MES_CHECKING_BUILTIN_LIBS} -l c+gnu"
else else
LIBS='-l c -l mescc' # Make it possible to resolve raise(), required by libgcc.a, provided
# in libc.a. The final command line has to have "-lc -lgcc -lc".
# See <https://www.openwall.com/lists/musl/2018/05/09/1>.
LIBS="-l c ${MES_CHECKING_BUILTIN_LIBS} -l c"
fi fi
if test $mes_kernel = gnu\ if test $mes_kernel = gnu\