This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
New README file submission.
- To: gcc2 at cygnus dot com
- Subject: New README file submission.
- From: Robert Lipe <robertl at dgii dot com>
- Date: Fri, 18 Jul 1997 22:00:07 -0500
Please consider adding the following file as a README.OpenServer in
the top level of GCC. If the 14 character file name thing is still
a problem, we need to find a name that would describe SCO OpenServer.
README.SCO isn't it, for "SCO" is a company that makes at least three
distinctly different families of UNIXen. README.OSR5 or README.sco5
might get my votes.
I've discussed it with Ian [ the King of Binutils ] and we've agreed
that this file belongs in GCC, not in binutils. As goofy as this
looks, it's an important feature to a large amount of the user base,
so I thought it was important to get it written down for future
generations.
Thank you,
RJL
Fri Jul 18 21:51:59 1997 Robert Lipe <robertl@dgii.com>
* README.xxxx: New file. Describe technique to build compatible
tools for both SCO OpenServer COFF and ELF.
GCC 2.8.0 adds support for SCO OpenServer 5.0.0, 5.0.2, 5.0.4,
Internet FastStart 1.0, and Internet FastStart 1.1
The SCO OpenServer compiler, linker, assembler, and related tools
can all generate and read either COFF or ELF binaries. You can do
this with the GNU tools, but it does take some extra effort.
GCC supports switching between either output format by defaulting
to generating COFF but allowing generation of ELF by use of the
'-melf' flag. This is different than the pre 2.8.0 based (non-FSF)
releases of GCC that used the '-belf' flag. If you have the SCO
development system, GCC works just fine with the default assembler.
If you do not have the SCO assembler [ the linker, headers, and
libraries are supplied with all OpenServer runtimes ] you must
first resolve the "chicken and egg" problem to get a functioning
`make`, assembler, archiver, strip, nm, and so on.. Using the
versions on Skunkware (see http://www.sco.com for information
on this free CD) is a lovely way to work this out.
Unfortunately, the GNU assembler can not currently switch
between OpenServer ELF and OpenServer COFF at runtime. Rather
than complicating GCC with a '--with-gas' flag that would require
a funny build procedure for binutils anyway, we found it preferable
to provide a wrapper script for GAS so that GAS appears to be
"compatible enough" with the SCO assembler. Unfortunately, a
funny build procedure for binutils is still required.
This has been tested on Binutils 2.8.0 and 2.8.1.
[ ! -d gas.coff ] && mkdir gas.coff
[ ! -d gas.elf ] && mkdir gas.elf
srcdir="../binutils-2.8.1"
this_host=`$srcdir/config.guess`
.../${srcdir}/gas/configure --host=${this_host}elf --target=${this_host}elf
cd gas.coff
.../${srcdir}/gas/configure --host=${this_host} --target=${this_host} \
--program-prefix=coff-
cd ..
cd gas.elf
.../${srcdir}/gas/configure --host=${this_host} --target=${this_host}elf \
--program-prefix=elf-
cd ..
make all-libiberty all-bfd
cd gas.coff
make all install
cd ..
cd gas.elf
make all install
cd ..
This will give you /usr/local/bin/coff-as and /usr/local/bin/elf-as.
Now do a 'make all-binutils install-binutils' to install ar, nm,
strip, objdump and so on.
Now, just drop the attached shell script into your GCC build area
as "as" and make it executable and you'll be able to switch between
COFF and ELF just fine.
In all, you'll probably find it more satisfying to find a prebuilt
binary kit for the assembler. Assemblers tend to be much more boring
than compilers so even if you don't have the latest version number
around, it's almost certainly "good enough". If you don't have
the SCO assembler, you're going to have to do find a binary kit
regardless.
#!/bin/sh
#
# Act as a wrapper to sit between GCC configured for SCO OpenServer and
# the GNU assembler.
#
# This script does not attempt to fully emulate the behaviour of the SCO
# assembler. If you are a human, you almost certainly don't want to call
# this script. You should be calling the appropriate assmbler yourself.
# In particular, while "as -o foo.o foo.s" works, "as foo.s -o foo.o" loses.
#
error()
{
echo $name: $*
exit 1
}
name=$0
COFF_AS=coff-as
COFF_ELF=elf-as
AS=$COFF_AS
while getopts ab:E:Q:o: c
do
case $c in
b) case $OPTARG in
elf) AS=$COFF_ELF ;;
ibcs2 | coff) AS=$COFF_AS ;;
*) error "Unknown binary type argument to '-b'"
esac ;;
E) ;; # -E is the environment type. (IGnore)
Q) ;; # -Q is the version stamp number. We ignore this.
o) OFILE=$OPTARG ;;
a | b) FLAG=$c;;
o) OARG=$OPTARG;;
*) error "Uknown flag $c" ;;
esac
done
shift `expr $OPTIND - 1`
src_file=$1
# Try to come up with a "reasonable" output name if none is given.
DEF_OFILE=`echo $src_file | sed "s/\.s$/\.o"/p`
#
# If we weren't given an output name via -o and the above command
# was able to produce a *different* name, we'll use it. Otherwise,
# we'll punt to gas which, in all likeliness, is about to fail.
#
if [ "$OFILE" = "" ]
then
if [ "$DEF_OFILE" != "$src_file" ]
then
OFLAG="-o $DEF_OFILE"
fi
else
OFLAG="-o $OFILE"
fi
# echo $AS $OFLAG $src_file
exec $AS $OFLAG $src_file