Rename plat/linux/libsys/errno.s to plat/linux386/libsys/trapno.s and
stop building it for linux68k and linuxppc. It defines symbols for
mach/i386/libem.
In syscalls.h, the numbers after 165 are only for i386, so hide them
from 68k, ppc. These numbers are unused, because the system calls now
in libsys use the lower numbers.
Also teach the build system that libsys depends on the internal
headers in plat/linux/libsys/*.h
Telling osx386 and osxppc to build and run their own tools, not to
reuse the tools from linux386 and linuxppc. This wastes time to build
identical tools, but it removes some bogus dependencies. OS X tools
had wrongly depended on Linux descr files and aelflod; now they don't.
Discussion in https://github.com/davidgiven/ack/pull/23
Also add fstat() and lstat(). I don't #define the constants for
st_mode or d_type, but I provide enough to get the block size of a
file and to list the names in a directory. Some fields of struct stat
get truncated, see XXX in plat/osx/include/sys/stat.h.
In struct dirent, the inode field might be d_ino or d_fileno. I
picked d_ino because Apple's sys/dirent.h uses d_ino (but Apple's
manual pages use d_fileno).
The system call puts the time in a pair of registers, not in the
timeval structure. Add code to move the time to the structure, so
programs see the correct time, not garbage. This fixes our example
programs that use the time as a random seed.
This preserves the name and value of every symbol. The type and other
info of a symbol might be lost. In gdb, one can now "disas main" or
"disas '.ret'" to disassemble functions by name.
Most symbols are in sections, so I also teach cvmach to emit the Mach
section headers. The entry point in plat/osx*/descr moves down to
make room for the section headers and LC_SYMTAB.
I fix some bugs in calculations of cvmach. They were wrong if ROM had
a greater alignment than TEXT, or if DATA did not start on a page
boundary. I introduce machseg[] to simplify the mess of variables in
main(). I declare most functions as static. Also, cvmach becomes the
first program to #include <object.h>.
Before this commit, the headers in plat/osx/include got installed
twice into PLATIND/osx386/include and PLATIND/osxppc/include. This
commit installs them once into PLATIND/osx/include and changes both
descr files to find them.
Several rules in lang/ depend on plat/osx386/include+headers or
plat/osxppc/include+headers. They each become a simplerule that
depends on plat/osx/include+headers.
These produce Mach-o executables for Mac OS X on Intel or PowerPC
processors. Our code generator for PowerPC (mach/powerpc) still has
bugs. Some examples seem to run, but startrek crashes. Our code
generator for Intel (mach/i386) is better.
There is a problem with job control. If you run paranoia or startrek,
then suspend the job (^Z) and resume it ('fg' in bash), then read(2)
might fail with EINTR.
The larger files in this commit are
- plat/osx/cvmach/cvmach.c
- plat/osx/libsys/brk.c
- plat/osx386/libsys/sigaction.s
- plat/osxppc/libsys/sigaction.s