9c, 9l: accept CC9FLAGS from config
Also, if CC9FLAGS includes -fsanitize=address (ASAN), predefine PLAN9PORT_ASAN for use by programs that need to know (mainly libthread). The 9c script used to have a variable called ngflags, which was ccflags except -g (ng stood for "no g"), but nothing needs it split out anymore, so simplify to just ccflags.
This commit is contained in:
parent
154140a22b
commit
9444b8e4bc
3 changed files with 39 additions and 18 deletions
34
bin/9c
34
bin/9c
|
|
@ -4,7 +4,7 @@ test -f $PLAN9/config && . $PLAN9/config
|
||||||
usegcc()
|
usegcc()
|
||||||
{
|
{
|
||||||
cc=${CC9:-gcc}
|
cc=${CC9:-gcc}
|
||||||
ngflags=" \
|
cflags=" \
|
||||||
-O2 \
|
-O2 \
|
||||||
-c \
|
-c \
|
||||||
-Wall \
|
-Wall \
|
||||||
|
|
@ -24,7 +24,12 @@ usegcc()
|
||||||
"
|
"
|
||||||
# want to put -fno-optimize-sibling-calls here but
|
# want to put -fno-optimize-sibling-calls here but
|
||||||
# that option only works with gcc3+ it seems
|
# that option only works with gcc3+ it seems
|
||||||
cflags="$ngflags -ggdb"
|
cflags="$cflags -ggdb"
|
||||||
|
cflags="$cflags $CC9FLAGS"
|
||||||
|
case "$cflags" in
|
||||||
|
*sanitize=address*)
|
||||||
|
cflags="$cflags -DPLAN9PORT_ASAN"
|
||||||
|
esac
|
||||||
}
|
}
|
||||||
|
|
||||||
quiet()
|
quiet()
|
||||||
|
|
@ -60,7 +65,7 @@ quiet()
|
||||||
useclang()
|
useclang()
|
||||||
{
|
{
|
||||||
cc=${CC9:-clang}
|
cc=${CC9:-clang}
|
||||||
ngflags=" \
|
cflags=" \
|
||||||
-O2 \
|
-O2 \
|
||||||
-c \
|
-c \
|
||||||
-Wall \
|
-Wall \
|
||||||
|
|
@ -79,13 +84,19 @@ useclang()
|
||||||
-fsigned-char \
|
-fsigned-char \
|
||||||
-fno-caret-diagnostics \
|
-fno-caret-diagnostics \
|
||||||
"
|
"
|
||||||
cflags="$ngflags -g"
|
cflags="$cflags -g"
|
||||||
|
cflags="$cflags $CC9FLAGS"
|
||||||
|
|
||||||
|
case "$cflags" in
|
||||||
|
*sanitize=address*)
|
||||||
|
cflags="$cflags -DPLAN9PORT_ASAN"
|
||||||
|
esac
|
||||||
}
|
}
|
||||||
|
|
||||||
usexlc()
|
usexlc()
|
||||||
{
|
{
|
||||||
cc=${CC9:-xlc_r}
|
cc=${CC9:-xlc_r}
|
||||||
ngflags=" \
|
cflags=" \
|
||||||
-c \
|
-c \
|
||||||
-O0 \
|
-O0 \
|
||||||
-qmaxmem=-1 \
|
-qmaxmem=-1 \
|
||||||
|
|
@ -96,7 +107,8 @@ usexlc()
|
||||||
-qsuppress=1506-1300 \
|
-qsuppress=1506-1300 \
|
||||||
-qsuppress=1506-342 \
|
-qsuppress=1506-342 \
|
||||||
"
|
"
|
||||||
cflags="$ngflags -g -qfullpath"
|
cflags="$cflags -g -qfullpath"
|
||||||
|
cflags="$cflags $CC9FLAGS"
|
||||||
}
|
}
|
||||||
|
|
||||||
tag="${SYSNAME:-`uname`}-${OBJTYPE:-`uname -m`}-${CC9:-cc}"
|
tag="${SYSNAME:-`uname`}-${OBJTYPE:-`uname -m`}-${CC9:-cc}"
|
||||||
|
|
@ -105,14 +117,14 @@ case "$tag" in
|
||||||
*DragonFly*clang|*BSD*clang*) useclang ;;
|
*DragonFly*clang|*BSD*clang*) useclang ;;
|
||||||
*Darwin-x86_64*)
|
*Darwin-x86_64*)
|
||||||
useclang
|
useclang
|
||||||
cflags="$ngflags -g3 -m64"
|
cflags="$cflags -g3 -m64"
|
||||||
;;
|
;;
|
||||||
*Darwin*clang*)
|
*Darwin*clang*)
|
||||||
useclang
|
useclang
|
||||||
cflags="$ngflags -g3 -m32"
|
cflags="$cflags -g3 -m32"
|
||||||
;;
|
;;
|
||||||
*Darwin*) usegcc
|
*Darwin*) usegcc
|
||||||
cflags="$ngflags -g3 -no-cpp-precomp -m32" ;;
|
cflags="$cflags -g3 -no-cpp-precomp -m32" ;;
|
||||||
*HP-UX*) cc=${CC9:-cc}; cflags="-g -O -c -Ae" ;;
|
*HP-UX*) cc=${CC9:-cc}; cflags="-g -O -c -Ae" ;;
|
||||||
*Linux*) usegcc
|
*Linux*) usegcc
|
||||||
case "${CC9:-gcc}" in
|
case "${CC9:-gcc}" in
|
||||||
|
|
@ -134,11 +146,11 @@ case "$tag" in
|
||||||
u=`uname`
|
u=`uname`
|
||||||
v=`uname -r`
|
v=`uname -r`
|
||||||
s=`echo $u$v | tr '. ' '__'`
|
s=`echo $u$v | tr '. ' '__'`
|
||||||
cflags="$ngflags -g"
|
cflags="$cflags -g"
|
||||||
cflags="$cflags -D__sun__ -D__${s}__"
|
cflags="$cflags -D__sun__ -D__${s}__"
|
||||||
;;
|
;;
|
||||||
*AIX*) usexlc
|
*AIX*) usexlc
|
||||||
cflags="$ngflags -g -D__AIX__"
|
cflags="$cflags -g -D__AIX__"
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
echo 9c does not know how to compile on "$tag" 1>&2
|
echo 9c does not know how to compile on "$tag" 1>&2
|
||||||
|
|
|
||||||
14
bin/9l
14
bin/9l
|
|
@ -12,29 +12,29 @@ extralibs="-lm"
|
||||||
tag="${SYSNAME:-`uname`}-${OBJTYPE:-`uname -m`}"
|
tag="${SYSNAME:-`uname`}-${OBJTYPE:-`uname -m`}"
|
||||||
case "$tag" in
|
case "$tag" in
|
||||||
*DragonFly*|*BSD*)
|
*DragonFly*|*BSD*)
|
||||||
ld=${CC9:-gcc}
|
ld="${CC9:-gcc} $CC9FLAGS"
|
||||||
userpath=true
|
userpath=true
|
||||||
extralibs="$extralibs -lutil"
|
extralibs="$extralibs -lutil"
|
||||||
;;
|
;;
|
||||||
*OSF1*)
|
*OSF1*)
|
||||||
ld=${CC9:-cc}
|
ld="${CC9:-cc} $CC9FLAGS"
|
||||||
userpath=true
|
userpath=true
|
||||||
extralibs="$extralibs -lutil"
|
extralibs="$extralibs -lutil"
|
||||||
nmflags="-B"
|
nmflags="-B"
|
||||||
;;
|
;;
|
||||||
*Linux*)
|
*Linux*)
|
||||||
ld=${CC9:-gcc}
|
ld="${CC9:-gcc} $CC9FLAGS"
|
||||||
userpath=true
|
userpath=true
|
||||||
extralibs="$extralibs -lutil -lresolv -lpthread"
|
extralibs="$extralibs -lutil -lresolv -lpthread"
|
||||||
;;
|
;;
|
||||||
*Darwin*x86_64*)
|
*Darwin*x86_64*)
|
||||||
ld="${CC9:-gcc} -m64"
|
ld="${CC9:-gcc} -m64 $CC9FLAGS"
|
||||||
;;
|
;;
|
||||||
*Darwin*)
|
*Darwin*)
|
||||||
ld="${CC9:-gcc} -m32"
|
ld="${CC9:-gcc} -m32 $CC9FLAGS"
|
||||||
;;
|
;;
|
||||||
*SunOS*)
|
*SunOS*)
|
||||||
ld="${CC9:-cc} -g"
|
ld="${CC9:-cc} -g $CC9FLAGS"
|
||||||
extralibs="$extralibs -lrt -lpthread -lsocket -lnsl"
|
extralibs="$extralibs -lrt -lpthread -lsocket -lnsl"
|
||||||
# Record paths to shared libraries to avoid needing LD_LIBRARY_PATH
|
# Record paths to shared libraries to avoid needing LD_LIBRARY_PATH
|
||||||
for i in "$libsl $@"
|
for i in "$libsl $@"
|
||||||
|
|
@ -61,7 +61,7 @@ case "$tag" in
|
||||||
esac
|
esac
|
||||||
;;
|
;;
|
||||||
*AIX*)
|
*AIX*)
|
||||||
ld="${CC9:-xlc_r} -g -O0"
|
ld="${CC9:-xlc_r} -g -O0 $CC9FLAGS"
|
||||||
nmflags="-A -B"
|
nmflags="-A -B"
|
||||||
extralibs="$extralibs -lpthread"
|
extralibs="$extralibs -lpthread"
|
||||||
;;
|
;;
|
||||||
|
|
|
||||||
|
|
@ -89,6 +89,15 @@ If
|
||||||
contains a line
|
contains a line
|
||||||
.B WSYSTYPE=nowsys
|
.B WSYSTYPE=nowsys
|
||||||
then the system is built without using X11.
|
then the system is built without using X11.
|
||||||
|
.B LOCAL.config
|
||||||
|
may also list settings for
|
||||||
|
.B CC9
|
||||||
|
(the host C compiler)
|
||||||
|
and
|
||||||
|
.B CC9FLAGS
|
||||||
|
(any additional flags to pass to the compiler).
|
||||||
|
Values more complex than single words should be quoted
|
||||||
|
with single quotes.
|
||||||
.PP
|
.PP
|
||||||
On most Linux systems, the X11 header packages need to be installed
|
On most Linux systems, the X11 header packages need to be installed
|
||||||
to build using X11. On Debian. the required packages are
|
to build using X11. On Debian. the required packages are
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue