Needed pfil 2.1.11 to compile in 64-bit mode for Sun Fire X2100M2 (AMD 64) so
applied the following changes (under Solaris 10 x86 6/06 system base)
in order to generate a successful compilation.
Buyer beware; the resultant code is yet to be tested, and I only used
gcc 4.1.1; the Sun C compiler flags were guesses; somebody should confirm them.
I see similar amd64 tweaks in the ip_filter code already but.
Ian D
*** Makefile.dist Tue Dec 26 02:37:36 2006
--- Makefile Tue Dec 26 03:41:59 2006
***************
*** 20,31 ****
#
SOLARIS="`uname -r | sed -e 's/[0-9]*\.\([0-9]*\).*/\1/'`"
SFLAGS=-I.. -I. -D_KERNEL -DSUNDDI -DSOLARIS2=${SOLARIS} $(PFILDEBUG)
! SBITS:sh=optisa sparcv9 >/dev/null 2>&1; if [ "$?" -eq 0 ] ; then echo "64";
else echo "32"; fi
MIOCPULLUP:sh=/usr/ccs/bin/nm -p /dev/ksyms|/usr/xpg4/bin/grep -q miocpullup;
if [ "$?" -ne 0 ] ; then echo -DNEED_MIOCPULLUP; fi
! # For Sun's C compiler in /opt/SUNWSpro cc:
! S64FLAGS=-xildoff -xarch=v9 -xchip=ultra -dalign -xcode=abs32
-DDO=pfil${SBITS}
! # For GCC
#S64FLAGS=-m64 -mcmodel=medlow -DDO=pfil${SBITS}
#
TMP=/tmp
PKG=pfil
--- 20,40 ----
#
SOLARIS="`uname -r | sed -e 's/[0-9]*\.\([0-9]*\).*/\1/'`"
SFLAGS=-I.. -I. -D_KERNEL -DSUNDDI -DSOLARIS2=${SOLARIS} $(PFILDEBUG)
! SBITS:sh=optisa sparcv9 >/dev/null 2>&1; if [ "$?" -eq 0 ] ; then echo "64";
else optisa amd64 >/dev/null 2>&1; if [ "$?" -eq 0 ] ; then echo "64"; else
echo "32"; fi; fi
! KTYPE:sh=optisa sparcv9 >/dev/null 2>&1; if [ "$?" -eq 0 ] ; then echo
"sparcv9"; else optisa amd64 >/dev/null 2>&1; if [ "$?" -eq 0 ] ; then echo
"amd64"; else echo "32-bit"; fi; fi
MIOCPULLUP:sh=/usr/ccs/bin/nm -p /dev/ksyms|/usr/xpg4/bin/grep -q miocpullup;
if [ "$?" -ne 0 ] ; then echo -DNEED_MIOCPULLUP; fi
!
! #
! # see http://docs.sun.com/app/docs/doc/817-5789/6ml7kh1b3?a=view
! #
! # For Sun's C compiler in /opt/SUNWSpro cc on sparcv9:
! #S64FLAGS=-xildoff -xarch=v9 -xchip=ultra -dalign -xcode=abs32
-DDO=pfil${SBITS}
! # For Sun's C compiler in /opt/SUNWSpro cc on amd64:
! #S64FLAGS=-Xa -xildoff -xarch=amd64 -xcode=abs32 -DDO=pfil${SBITS}
! # For GCC on sparcv9
#S64FLAGS=-m64 -mcmodel=medlow -DDO=pfil${SBITS}
+ # For GCC on amd64
+ S64FLAGS=-m64 -mcmodel=kernel -mno-red-zone -ffreestanding -DDO=pfil${SBITS}
#
TMP=/tmp
PKG=pfil
***************
*** 47,53 ****
SunOS32: SunOS/Makefile
(cd SunOS; make pfil "BITS=32" OS=solaris DO=pfil "ADEF=${SFLAGS}")
! SunOS64 sparc64 sunos64: SunOS/Makefile
(cd SunOS; make pfil "BITS=32" OS=solaris DO=pfil "ADEF=${SFLAGS}")
/bin/rm -f SunOS/*.o
(cd SunOS; make pfil${SBITS} "BITS=64" OS=solaris DO=pfil64
"ADEF=${SFLAGS} ${S64FLAGS}")
--- 56,62 ----
SunOS32: SunOS/Makefile
(cd SunOS; make pfil "BITS=32" OS=solaris DO=pfil "ADEF=${SFLAGS}")
! SunOS64 sparc64 sunos64 amd64: SunOS/Makefile
(cd SunOS; make pfil "BITS=32" OS=solaris DO=pfil "ADEF=${SFLAGS}")
/bin/rm -f SunOS/*.o
(cd SunOS; make pfil${SBITS} "BITS=64" OS=solaris DO=pfil64
"ADEF=${SFLAGS} ${S64FLAGS}")
***************
*** 108,117 ****
pkginfo.dist > pkginfo)
cat prototype.dist > prototype
if [ -f pfil64 ] ; then \
! echo 'd none kernel/strmod/sparcv9 ? root sys' >> prototype; \
! echo 'l none kernel/strmod/sparcv9/pfil=../../drv/sparcv9/pfil'
>> prototype; \
! echo 'd none kernel/drv/sparcv9 ? root sys' >> prototype; \
! echo 'f none kernel/drv/sparcv9/pfil=pfil64 ? root sys' >>
prototype; \
fi
pkgmk -o -d $(TMP)
pkgtrans -s $(TMP) pfil.pkg $(PKG)
--- 117,126 ----
pkginfo.dist > pkginfo)
cat prototype.dist > prototype
if [ -f pfil64 ] ; then \
! echo gd none kernel/strmod/$KTYPE ? root sys' >> prototype; \
! echo 'l none kernel/strmod/$KTYPE/pfil=../../drv/$KTYPE/pfil'
>> prototype; \
! echo 'd none kernel/drv/$KTYPE ? root sys' >> prototype; \
! echo 'f none kernel/drv/$KTYPE/pfil=pfil64 ? root sys' >>
prototype; \
fi
pkgmk -o -d $(TMP)
pkgtrans -s $(TMP) pfil.pkg $(PKG)