Skip to content

Commit

Permalink
Fix Solaris cc wrappers (re: 4e67234)
Browse files Browse the repository at this point in the history
The versions from the Solaris patch require $CC_EXPLICIT to be set,
which is specific to the internal Solaris build environment.

src/cmd/INIT/cc.sol11.*:
- Cope without $CC_EXPLICIT set in environment; fall back to $CC
  and if that is not set either, detect whether to use cc or gcc.
- Set appropriate flags for cc (Solaris Studio) or gcc, including
  the necessary -D_XPG6 flag, without which ksh crashes on Solaris.

bin/package, src/cmd/INIT/package.sh:
- Update hack to add the -D_XPG6 flag so it applies to gcc only
  (note: the src/cmd/INIT/cc.* scripts are never used for gcc).
  • Loading branch information
McDutchie committed Jan 16, 2021
1 parent 2e839d8 commit 68a6f9a
Show file tree
Hide file tree
Showing 6 changed files with 38 additions and 10 deletions.
6 changes: 3 additions & 3 deletions bin/package
Original file line number Diff line number Diff line change
Expand Up @@ -5442,12 +5442,12 @@ make|view)
esac
;;
esac
# Hack for Solaris 11.4, which needs -D_XPG6 in C flags to not segfault
# Hack for Solaris gcc, which needs -D_XPG6 in C flags to not segfault
case `uname` in
SunOS) case " $CCFLAGS " in
SunOS) case "$CC, $CCFLAGS " in
*" -D_XPG6 "*)
;;
*) CCFLAGS="-D_XPG6${CCFLAGS:+ $CCFLAGS}"
*gcc,*) CCFLAGS="-D_XPG6${CCFLAGS:+ $CCFLAGS}"
export CCFLAGS
;;
esac
Expand Down
9 changes: 8 additions & 1 deletion src/cmd/INIT/cc.sol11.i386
Original file line number Diff line number Diff line change
@@ -1,9 +1,16 @@
: solaris.i386 cc wrapper for reasonable ansi C defaults and 32 bit : 2012-05-18 :
: solaris.i386 cc wrapper for reasonable ansi C defaults and 32 bit : 2021-01-16 :

HOSTTYPE=sol11.i386

case " $* " in
*" -dumpmachine "*) echo $HOSTTYPE; exit ;;
esac

# Solaris build scripts set $CC_EXPLICIT. If not set, function without it.
case ${CC_EXPLICIT:=$CC} in
'' | cc)
PATH=`/usr/bin/getconf PATH` # avoid infinite recursion executing 'cc'
CC_EXPLICIT=cc
esac

$CC_EXPLICIT -m32 -xc99 -D_XPG6 "$@"
9 changes: 8 additions & 1 deletion src/cmd/INIT/cc.sol11.i386-64
Original file line number Diff line number Diff line change
@@ -1,9 +1,16 @@
: solaris.i386-64 cc wrapper for reasonable ansi C defaults and 64 bit : 2012-05-18 :
: solaris.i386-64 cc wrapper for reasonable ansi C defaults and 64 bit : 2021-01-16 :

HOSTTYPE=sol11.i386-64

case " $* " in
*" -dumpmachine "*) echo $HOSTTYPE; exit ;;
esac

# Solaris build scripts set $CC_EXPLICIT. If not set, function without it.
case ${CC_EXPLICIT:=$CC} in
'' | cc)
PATH=`/usr/bin/getconf PATH` # avoid infinite recursion executing 'cc'
CC_EXPLICIT=cc
esac

$CC_EXPLICIT -m64 -xc99 -D_XPG6 "$@"
9 changes: 8 additions & 1 deletion src/cmd/INIT/cc.sol11.sparc
Original file line number Diff line number Diff line change
@@ -1,9 +1,16 @@
: solaris.sparc cc wrapper for reasonable ansi C defaults and 32 bit : 2012-05-18 :
: solaris.sparc cc wrapper for reasonable ansi C defaults and 32 bit : 2021-01-16 :

HOSTTYPE=sol11.sparc

case " $* " in
*" -dumpmachine "*) echo $HOSTTYPE; exit ;;
esac

# Solaris build scripts set $CC_EXPLICIT. If not set, function without it.
case ${CC_EXPLICIT:=$CC} in
'' | cc)
PATH=`/usr/bin/getconf PATH` # avoid infinite recursion executing 'cc'
CC_EXPLICIT=cc
esac

$CC_EXPLICIT -m32 -xc99 -D_XPG6 "$@"
9 changes: 8 additions & 1 deletion src/cmd/INIT/cc.sol11.sparc-64
Original file line number Diff line number Diff line change
@@ -1,9 +1,16 @@
: solaris.sparc-64 cc wrapper for reasonable ansi C defaults and 64 bit : 2012-05-18 :
: solaris.sparc-64 cc wrapper for reasonable ansi C defaults and 64 bit : 2021-01-16 :

HOSTTYPE=sol11.sparc-64

case " $* " in
*" -dumpmachine "*) echo $HOSTTYPE; exit ;;
esac

# Solaris build scripts set $CC_EXPLICIT. If not set, function without it.
case ${CC_EXPLICIT:=$CC} in
'' | cc)
PATH=`/usr/bin/getconf PATH` # avoid infinite recursion executing 'cc'
CC_EXPLICIT=cc
esac

$CC_EXPLICIT -m64 -xc99 -D_XPG6 "$@"
6 changes: 3 additions & 3 deletions src/cmd/INIT/package.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5441,12 +5441,12 @@ make|view)
esac
;;
esac
# Hack for Solaris 11.4, which needs -D_XPG6 in C flags to not segfault
# Hack for Solaris gcc, which needs -D_XPG6 in C flags to not segfault
case `uname` in
SunOS) case " $CCFLAGS " in
SunOS) case "$CC, $CCFLAGS " in
*" -D_XPG6 "*)
;;
*) CCFLAGS="-D_XPG6${CCFLAGS:+ $CCFLAGS}"
*gcc,*) CCFLAGS="-D_XPG6${CCFLAGS:+ $CCFLAGS}"
export CCFLAGS
;;
esac
Expand Down

0 comments on commit 68a6f9a

Please sign in to comment.