George Koehler [Mon, 28 Nov 2016 19:32:49 +0000 (14:32 -0500)]
Add getdirentries() and stat() for Mac OS X.
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).
George Koehler [Wed, 23 Nov 2016 18:25:55 +0000 (13:25 -0500)]
Make working gettimeofday() for Mac OS X.
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.
George Koehler [Tue, 22 Nov 2016 22:16:30 +0000 (17:16 -0500)]
Teach cvmach to emit the symbol table.
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>.
George Koehler [Tue, 22 Nov 2016 16:13:14 +0000 (11:13 -0500)]
Make possible to #include <object.h>.
This header declares functions in libobject. Our programs never
included object.h, but called functions in libobject without declaring
them. So, our build system never put object.h in the include path;
any #include <object.h> would fail to find the header.
With this commit, a program may #include <object.h> if it has
modules/src/object+lib in its deps.
Declare structs in object.h so we can use them in prototypes without
gcc warning, "'struct whatever' declared inside parameter list".
Remove inclusion of ansi.h from object.h. Programs would need to
depend on modules+headers to get ansi.h in the include path.
George Koehler [Sun, 20 Nov 2016 16:38:16 +0000 (11:38 -0500)]
Use uint32_t in util/led/main.c
This uses uint32_t for the base, file offset, and alignment of each
section, to be consistent with the usage of uint32_t in h/out.h
Also declare setbit() as static.
George Koehler [Sun, 20 Nov 2016 00:23:42 +0000 (19:23 -0500)]
Fix my typo to put symbol "begrom" in correct section.
George Koehler [Tue, 8 Nov 2016 22:13:51 +0000 (17:13 -0500)]
Install only 1 copy, not 2 copies, of osx headers.
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.
George Koehler [Tue, 8 Nov 2016 20:35:02 +0000 (15:35 -0500)]
Add the missing return in plat/osx/libsys/creat.c
Before now, it might have worked by accident if the return value from
open() stayed in the function return area.
George Koehler [Tue, 8 Nov 2016 20:22:09 +0000 (15:22 -0500)]
Remove trailing whitespace in plat/osx*
Also fix a comment.
George Koehler [Tue, 8 Nov 2016 18:49:16 +0000 (13:49 -0500)]
Merge branch 'default' into kernigh-osx
This brings improvements to PowerPC code generation.
David Given [Mon, 7 Nov 2016 19:15:48 +0000 (20:15 +0100)]
Merge pull request #9 from kernigh/fix-flt-trek
fixes for floating point and startrek
George Koehler [Mon, 7 Nov 2016 01:21:48 +0000 (20:21 -0500)]
Edit startrek.c so I can compile it with gcc and OpenBSD libc.
Rename our getline() to get_line() to prevent a conflict with POSIX
getline() declared in stdio.h.
Remove dangerous call to gets(). OpenBSD does not have gets(), C99
deprecated it and C11 removed it.
Also change spelling "sheild" to "shield".
George Koehler [Mon, 7 Nov 2016 00:34:51 +0000 (19:34 -0500)]
Convert 1 to 1.0, not 0.0, for machines with 64-bit long.
This fixes flt_arith2flt() when sizeof(arith) != 4, where arith is
long. When cemcom.ansi sees an expression like d + 1 (where d is some
double), it calls flt_arith2flt() to convert 1 to floating-point. On
machines where sizeof(arith) != 4, the code did n >>= 1 when n should
not have been changed. If n was 1, then n == 0 became true. This
caused the code to convert 1 or -1 to 0.0.
My fix assumes sizeof(arith) >= 8, so I can use n >> 32. Machines
with sizeof(arith) of 5 to 7 would need to do (uarith)n >> 32, where
uarith must be an unsigned integer type of same size as arith.
In startrek.c, the Enterprise can now dock with a starbase. The
compiler no longer translates s1 - 1 to s1 - 0.0 and s1 + 1 to s1 +
0.0, so the game now looks for starbases next to the Enterprise.
George Koehler [Sun, 6 Nov 2016 20:49:47 +0000 (15:49 -0500)]
Remove unused defines from lang/cem/libcc.ansi/math/localmath.h
This undoes part of
bfeb736, and returns to using DBL_MAX_EXP and
DBL_MIN_EXP from float.h.
Add a dependency on math/localmath.h and other local header files so
libc is rebuilt when those headers change.
George Koehler [Sun, 6 Nov 2016 20:01:25 +0000 (15:01 -0500)]
Undo commit
bfeb736 for lang/cem/libcc.ansi/headers/float.h
This restores the correct values of DBL_MAX, DBL_MIN_EXP, and related
constants. This fixes some range checks within libc, causing
atof("-36e90") and atof("1.44e-288") to return the correct values.
George Koehler [Sun, 6 Nov 2016 01:29:03 +0000 (21:29 -0400)]
Simplify flt_arith now that mantissa uses uint32_t.
It seems that someone wanted to build flt_arith with a compiler that
had long but not unsigned long. This required extra code to
accomplish unsigned right shift, unsigned division, and unsigned
comparison using the signed operations. Now that we use uint32_t, we
can simply use the unsigned operations and remove the ucmp() function.
We have similar code in mach/proto/fp/ and in
lang/cem/libcc.ansi/stdlib/ext_comp.c where we use the unsigned
operations.
Some long variables become uint32_t, and some masks with 0xFFFFFFFF
disappear because uint32_t has only 32 bits.
Update flt_arith.3 to show that mantissa uses uint32_t.
Provide a target to install modules/src/flt_arith/test.c as flt_test
so I can run the tests.
George Koehler [Sat, 5 Nov 2016 21:00:24 +0000 (17:00 -0400)]
Switch flt_mantissa fields from long to uint32_t.
This seems to fix an error when flt_arith converts a literal
double-precision float to IEEE format. For example, 0.5 and 0.75 got
converted to slightly below their correct values.
My host gcc for amd64 has 64-bit long, but flt_arith needs only 32
bits. The code (at least flt_add.c) can make 32-bit overflows. Such
overflows would set the higher bits of a 64-bit long, which might
cause problems later.
I need to use uint32_t and not int32_t because the code still uses
long, and the sign extension from int32_t to long would cause
problems. The mantissa represents a value in [0, 2) that can't be
negative, so unsigned type is better. Also, signed overflow is
undefined behavior in C, so flt_add.c better make overflows with
uint32_t and not int32_t.
This commit doesn't touch lang/cem/libcc.ansi/stdlib/ext_fmt.h which
continues to use unsigned long for its mantissa fields.
George Koehler [Sat, 5 Nov 2016 20:24:18 +0000 (16:24 -0400)]
Assume ANSI C in modules/src/flt_arith
Remove the #include "ansi.h" and always use the prototypes.
David Given [Sat, 5 Nov 2016 10:47:36 +0000 (11:47 +0100)]
Properly declare the library headers as dependencies.
David Given [Sun, 30 Oct 2016 14:59:04 +0000 (15:59 +0100)]
Merge pull request #7 from davidgiven/travis
Use built-in Lua rather than relying on a system one
David Given [Sun, 30 Oct 2016 14:53:26 +0000 (15:53 +0100)]
Merge from default.
David Given [Sun, 30 Oct 2016 14:49:39 +0000 (15:49 +0100)]
Don't allow parallel builds in the top-level makefile.
David Given [Sun, 30 Oct 2016 13:28:08 +0000 (14:28 +0100)]
Old versions of make don't support -r.
David Given [Wed, 19 Oct 2016 18:39:10 +0000 (20:39 +0200)]
Merge pull request #6 from kernigh/pr-linuxppc
PowerPC fixes
George Koehler [Wed, 19 Oct 2016 01:16:47 +0000 (21:16 -0400)]
Remove f14 to f31 from FREG and FSREG.
This would have happened later, if f14 to f31 became regvar (like r13
to r31 are now). I am doing it now because ncg is too slow for rules
"with FREG FREG uses FREG". We use such rules for adf 8 and other EM
instructions that operate on 2 floats. Like my last commit
cfbc537,
this commit speeds ncg by removing choices for register allocation.
George Koehler [Tue, 18 Oct 2016 00:31:59 +0000 (20:31 -0400)]
In powerpc ncg, add a speed hack for sti 8.
ncg is too slow with this many registers. A stack pattern "with GPR
GPR GPR" or "with REG REG REG" takes too long to pick registers,
causing ncg 8 to take about 2 seconds on each sti 8. I introduce
REG_PAIR and there are only 4 such pairs.
For programs that use sti 8 (including C programs that copy 8-byte
structs), this speed hack improves the ncg run from several seconds to
almost instantaneous.
Also add a few COMMENT(...) lines in stacking rules.
George Koehler [Mon, 17 Oct 2016 18:57:21 +0000 (14:57 -0400)]
Add costs to powerpc instructions.
Also show how andi., andis., or., set condition codes.
George Koehler [Mon, 17 Oct 2016 04:39:59 +0000 (00:39 -0400)]
Rewrite .fif8 to avoid powerpc64 fctid
This fixes the SIGILL (illegal instruction) in startrek when firing
phasers. The 32-bit processors in my PowerPC Mac and in QEMU don't
have fctid, a 64-bit instruction.
I got the idea from mach/proto/fp/fif8.c to extract the exponent,
clear some bits to get an integer, then subtract the integer from
the original value to get the fraction.
George Koehler [Sun, 16 Oct 2016 22:13:39 +0000 (18:13 -0400)]
Add "kills MEMORY" to powerpc sti rules.
Adjust some of the loi rules (and associated moves) so we can identify
the tokens that must be in MEMORY.
With this commit, I can navigate the Enterprise even if I comment out
my work-around from
e22c888.
George Koehler [Sun, 16 Oct 2016 20:33:24 +0000 (16:33 -0400)]
Remove IND_LABEL_W and IND_LABEL_D
Because li32 always loads a label into a GPR, it is sufficient to
coerce LABEL to REG, then use IND_RC_W or IND_RC_D for indirection
through the label.
George Koehler [Sun, 16 Oct 2016 20:02:25 +0000 (16:02 -0400)]
Simplify moves to and from IND_RC_*
Now that SUM_RC always has a signed 16-bit constant, it happens that
the various IND_RC_* tokens also have a signed 16-bit constant, so
we no longer need to touch the scratch register.
David Given [Sun, 16 Oct 2016 18:10:24 +0000 (20:10 +0200)]
Don't need Lua any more.
David Given [Sun, 16 Oct 2016 18:09:52 +0000 (20:09 +0200)]
Remember to create the build directory when bootstrapping.
David Given [Sun, 16 Oct 2016 18:07:54 +0000 (20:07 +0200)]
Use a self-hosted Lua instead of the system one.
George Koehler [Sun, 16 Oct 2016 17:58:54 +0000 (13:58 -0400)]
Refactor how powerpc ncg pushes constants.
When loc (load constant) pushes a constant, it now checks the value of
the constant and pushes any of 7 tokens. These tokens allow stack
patterns to recognize 16-bit signed integers (CONST2), 16-bit unsigned
integers (UCONST2), multiples of 0x10000 (CONST_HZ), and other
interesting forms of constants.
Use the new constant tokens in the rules for adi, sbi, and, ior, xor.
Adjust a few other rules to understand the new tokens.
Require that SUM_RC has a signed 16-bit constant, and OR_RC and XOR_RC
each have an unsigned 16-bit constant. The moves from SUM_RC, OR_RC,
XOR_RC to GPR no longer touch the scratch register, because the
constant is not too big.
David Given [Sun, 16 Oct 2016 16:16:30 +0000 (18:16 +0200)]
Experiments with declarative apt and OSX.
George Koehler [Sun, 16 Oct 2016 00:00:48 +0000 (20:00 -0400)]
Remove unused parts of mach/powerpc/ncg/table
Remove unused tokens GPRINDIRECTLO, HILABEL, LOLABEL, LABELI. Also
remove an #if 0 ... #endif group of patterns.
George Koehler [Sat, 15 Oct 2016 03:59:26 +0000 (23:59 -0400)]
In powerpc table, fix macros los() and his().
Change the operator in his() from a - minus to a + plus. When los(n)
becomes negative, then his(n) needs to add 0x10000, not subtract it.
Also change los(n) to do the sign extension, because smalls(los(n))
should be true, not false.
Also change hi(n) and lo(n) to wrap n in parentheses, as (n), because
these are macros and n might still contain operators.
George Koehler [Sat, 8 Oct 2016 00:52:13 +0000 (20:52 -0400)]
Remove stackadjust and stackoffset() from ncg.
This feature has never been used since its introduction, more than 3
years ago, in David Given's commit
c93cb69 of May 8, 2013. The commit
was for "PowerPC and M68K work". I am not undoing the entire commit.
I am only removing the stackadjust and stackoffset() feature.
This commit removes the feature from my branch kernigh-linuxppc. This
removal includes the mach/proto/ncg parts. The default branch already
removed most of the feature, but kept the mach/proto/ncg parts. That
removal happened in commit
81778b6 of May 13, 2013 (which was a merge;
git diff
af0dede 81778b6). The branch dtrg-experimental-powerpc
merged the default branch but without the removal. That merge was
commit
4703db0f of Sep 15, 2016 (git diff
8c94b13 4703db0). My branch
kernigh-linuxppc is off branch dtrg-experimental-powerpc, so I can no
longer get the removal by merging default.
David Given described the stackadjust feature in
https://sourceforge.net/p/tack/mailman/message/
30814691/
The instruction stackadjust would add a value to the offset, and the
function stackoffset() would return this offset. One would use this
to track sp - fp, then omit the frame pointer by not keeping fp in a
register.
George Koehler [Fri, 7 Oct 2016 02:59:27 +0000 (22:59 -0400)]
Remove most of GPRE from mach/powerpc/ncg/table
We only need GPRE in a few places where we write {GPRE, regvar(...)}
because ncgg can't parse plain regvar(...). In all other places, a
plain GPR works.
Also remove gpr_gpr_gpr and a few other unused and fake instructions
from the list of instructions.
George Koehler [Fri, 7 Oct 2016 00:47:42 +0000 (20:47 -0400)]
Rename SCRATCH to RSCRATCH. Never stack RSCRATCH nor FSCRATCH.
Rename the scratch gpr (currently r11) from SCRATCH to RSCRATCH so I
can search for RSCRATCH without finding FSCRATCH. I also want to
avoid confusion with the SCRATCH keyword of the old code generator (cg
which came before ncg).
Change the stacking rules to prevent stacking of RSCRATCH or FSCRATCH
or any other GPR or FPR that isn't an allocatable REG or FREG. Then
ncgg rejects any rule that tries to stack a GPR or FPR, so change such
rules to stack a REG or FREG.
George Koehler [Sun, 2 Oct 2016 18:58:05 +0000 (14:58 -0400)]
Commit a preview of osx386 and osxppc as new platforms.
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
George Koehler [Fri, 30 Sep 2016 17:55:06 +0000 (13:55 -0400)]
Merge branch 'default' into kernigh-linuxppc
George Koehler [Fri, 30 Sep 2016 17:40:36 +0000 (13:40 -0400)]
Remove .linenumber and .filename; use hol0 and hol0+4.
We need this because some .e files in lang/ are using 'loe 0' and 'lae
4' to load the line number from hol0 and filename from hol0+4.
George Koehler [Fri, 30 Sep 2016 17:21:42 +0000 (13:21 -0400)]
Define the begdata, begrom, begbss symbols for linuxppc.
I copied the definitions from linux386 and linux68k.
This change also moves _errno and the other common symbols in boot.s
from .text to .bss. Common symbols belong in .bss, but the assembler
seems dumb enough to put them in any section.
George Koehler [Fri, 30 Sep 2016 15:50:50 +0000 (11:50 -0400)]
Add a rule for sdl ldl $1==$2 to work around a bug.
In our powerpc table, sdl fails to kill the old value of the local.
This is a bug, because a later ldl can load the old value instead of
the newly stored value. By rewriting "sdl 0" "ldl 0" as "dup 8" "sdl
0", the newly added rule works around the bug, but only when the ldl
is immediately after the sdl.
This rule improves code that uses double-precision floating point.
The output of printf("%f", 6.0) in C changes from all zero digits to
"
6000000" but still doesn't print the decimal point. The result of
atof("-123.456") becomes correct. In startrek, I can now move the
Enterprise, but I still can't fire phasers without crashing the game.
We already have a rule for stl lol $1==$2. We had two copies of the
rule, so I am deleting the second copy.
George Koehler [Thu, 29 Sep 2016 19:52:54 +0000 (15:52 -0400)]
Rewrite fef 8 in powerpc assembly.
In EM, fef splits a float into exponent and fraction. The old C code,
given an infinite float, got stuck in an infinite loop. The new
assembly code doesn't loop; it extracts the IEEE exponent.
George Koehler [Wed, 28 Sep 2016 04:13:35 +0000 (00:13 -0400)]
For "pat ass", move fake stack to real stack before adjusting SP.
This fixes code that tried to "addi SP, SP, 4" to drop a value that
was in a register, not on the real stack.
Add a rule to optimize "asp 4" (which becomes "loc 4" "ass") when
the value being dropped is already in a GPR.
George Koehler [Tue, 27 Sep 2016 20:46:11 +0000 (16:46 -0400)]
Remove the "invalid" stacking rule.
When ncg fell back on this rule, it did emit the string "invalid" in
the assembly code and caused a syntax error in the assembler.
Adjust the stacking rules so we can stack LOCAL, CONST, and LABEL
without falling back on the "invalid" rule, and so we can stack them
when we have no free register except the scratch register.
George Koehler [Wed, 21 Sep 2016 20:26:30 +0000 (16:26 -0400)]
Multiple tweaks to plat/linuxppc/descr
Don't define __POWERPC. I don't know any other compiler that defines
__POWERPC and don't want to invent a new macro. Apple's gcc 4.0.1
from Xcode 2.5 defines __ppc__, _ARCH_PPC, __POWERPC__. Debian's gcc
4.9.2-10 defines _ARCH_PPC, __PPC__, __powerpc__, __PPC, __powerpc,
PPC, powerpc.
Move the base vm address from 0x80000000 down to 0x10000000, as this
is where Debian loads /bin/true. This is still higher than the base
addresses for linux386 and linux68k.
Sync led's arguments with linux386.
David Given [Wed, 21 Sep 2016 17:47:00 +0000 (19:47 +0200)]
Merge pull request #5 from kernigh/fix-isatty
Implement isatty() for Linux.
George Koehler [Wed, 21 Sep 2016 01:28:37 +0000 (21:28 -0400)]
Implement isatty() for Linux.
If it understands TIOCGETD, then it is a tty, else it isn't one. This
seems to help Basic's input statement so I can see the prompt before
I enter my input.
George Koehler [Sun, 18 Sep 2016 21:03:23 +0000 (17:03 -0400)]
Rename our pseudo-opcode 'la' to 'li32'.
GNU as has "la %r4,8(%r3)" as an alias for "addi %r4,%r3,8", meaning
to load the address of the thing at 8(%r3). Our 'la', now 'li32',
makes an addis/ori pair to load an immediate 32-bit value. For
example, "li32 r4,
23456789" loads a big number.
George Koehler [Sun, 18 Sep 2016 19:08:55 +0000 (15:08 -0400)]
Enable the Hall check again, and get powerpc to pass it.
Upon enabling the check, mach/powerpc/ncg/table fails to build as ncgg
gives many errors of "Previous rule impossible on empty stack". David
Given reported this problem in 2013:
https://sourceforge.net/p/tack/mailman/message/
30814694/
Commit
c93cb69 commented out the error in util/ncgg/cgg.y to disable
the Hall check. This commit enables it again. In ncgg, the Hall
check is checking that a rule is possible with an empty fake stack.
It would be possible if ncg can coerce the values from the real stack
to the fake stack. The powerpc table defined coercions from STACK to
{FS, %a} and {FD, %a}, but the Hall check didn't understand the
coercions and rejected each rule "with FS" or "with FD".
This commit removes the FS and FD tokens and adds a new group of FSREG
registers for single-precision floats, while keeping FREG registers
for double precision. The registers overlap, with each FSREG
containing one FREG, because it is the same register in PowerPC
hardware. FS tokens become FSREG registers and FD tokens become FREG
registers. The Hall check understands the coercions from STACK to
FSREG and FREG. The idea to define separate but overlapping registers
comes from the PDP-11 table (mach/pdp/ncg/table).
This commit also removes F0 from the FREG group. This is my attempt
to keep F0 off the fake stack, because one of the stacking rules uses
F0 as a scratch register (FSCRATCH).
George Koehler [Sun, 18 Sep 2016 18:37:42 +0000 (14:37 -0400)]
In ncgg, increase MAXREGS from 80 to 200.
I need this to add more registers to powerpc.
George Koehler [Sun, 18 Sep 2016 04:07:30 +0000 (00:07 -0400)]
Fix hilo.p for big-endian platforms.
Unless it is packed, a Pascal char is a C int. Using C types, hilo.p
passed an int *buf to uread(), which expected a char *buf. Then
uread() wrote the char on the end of the int. This worked on
little-endian platforms. This failed on big-endian platforms, as
writing the value to the big end of an int multiplied it by
16777216.
The fix is to use a packed array [0..0] of char in Pascal. I also
change 'string' to a packed array, though this is not a necessary part
of the fix.
George Koehler [Sun, 18 Sep 2016 03:55:55 +0000 (23:55 -0400)]
Add the missing .lar4 and .sar4 for powerpc.
Inspired by the sparc code (mach/sparc/libem/lar.s). My powerpc code
might still have bugs, but it's enough for examples/hilo.mod to work.
May need to 'make clean' or touch a build.lua file, so ackbuilder can
notice the new lar4.s and sar4.s files and build them.
George Koehler [Sat, 17 Sep 2016 22:15:54 +0000 (18:15 -0400)]
Merge branch 'default' into kernigh-linuxppc
David Given [Sat, 17 Sep 2016 10:43:15 +0000 (12:43 +0200)]
Eliminate the RELOH2 relocation, as it never worked --- the address would be
calculated incorrectly because of overflow errors.
Replace it with an extended RELOPPC relocation which understands addis/ori
pairs; add an la pseudoop to the assembler which generates these and the
appropriate relocation. Make good.
--HG--
branch : dtrg-experimental-powerpc-branch
David Given [Thu, 15 Sep 2016 21:12:03 +0000 (23:12 +0200)]
Mostly add support for the experimental and largely broken linuxppc platform.
(Doesn't quite build.)
--HG--
branch : dtrg-experimental-powerpc-branch
David Given [Thu, 15 Sep 2016 20:59:01 +0000 (22:59 +0200)]
Merge from default.
--HG--
branch : dtrg-experimental-powerpc-branch
David Given [Sat, 10 Sep 2016 09:25:21 +0000 (11:25 +0200)]
Merge pull request #3 from kernigh/ego-fix
Fix bugs with memory allocation in ego.
George Koehler [Sat, 10 Sep 2016 03:37:43 +0000 (23:37 -0400)]
Fix bugs with memory allocation in ego.
cf/cf_loop.c and share/put.c tried to read the next pointer in an
element of a linked list after freeing the element. ud/ud_copy.c
tried to read beyond the end of the _defs_ array: it only has
_nrexpldefs_ elements, not _nrdefs_ elements.
These bugs caused core dumps on OpenBSD. Its malloc() put _defs_ near
the end of a page, so reading beyond the end crossed into an unmapped
page. Its free() wrote junk bytes and changed the next pointer to
0xdfdfdfdfdfdfdfdf.
David Given [Sun, 4 Sep 2016 17:23:02 +0000 (19:23 +0200)]
Add unlink system call.
David Given [Sat, 3 Sep 2016 17:22:38 +0000 (19:22 +0200)]
Cleanup some stray files.
David Given [Sat, 3 Sep 2016 17:17:09 +0000 (19:17 +0200)]
Add modeline, fix formatting.
David Given [Sat, 3 Sep 2016 17:07:12 +0000 (19:07 +0200)]
Updated.
David Given [Sat, 3 Sep 2016 17:01:47 +0000 (19:01 +0200)]
More documentation.
David Given [Fri, 2 Sep 2016 23:04:16 +0000 (01:04 +0200)]
First half of the ackbuilder documentation.
David Given [Fri, 2 Sep 2016 22:20:11 +0000 (00:20 +0200)]
Makefiles are now slightly less inaccurate. Does actually seem to do sensible
incremental builds now. I loathe make.
David Given [Fri, 2 Sep 2016 21:03:57 +0000 (23:03 +0200)]
Add an install target.
David Given [Fri, 2 Sep 2016 21:00:38 +0000 (23:00 +0200)]
Distributions are a pain --- let's not bother any more. Instead, we just tag
the repository and download a complete snapshot, old and ancient stuff and all.
David Given [Fri, 2 Sep 2016 20:17:51 +0000 (22:17 +0200)]
Remove the old make-based build system, plus some big chunks of horribly
obsolete protomake build system.
David Given [Thu, 1 Sep 2016 21:36:39 +0000 (23:36 +0200)]
Clean up the top level makefile.
David Given [Mon, 22 Aug 2016 21:53:01 +0000 (23:53 +0200)]
Fix a fun bug where, every now again, ego would get its temporary files mangled
and generate invalid calls to the optimisers.
Previously ego would generate a temporary file template that looked like
/tmp/ego.A.BB.XXXXXX, call mktemp() on it to randomise the XXXXXX, and then
replace A and BB with data.
However, it used strrchr to find the A and B. Which would fine, except when
mktemp produced an A or a B in the randomised part...
This code was written on 4 March 1991. I was 16.
David Given [Mon, 22 Aug 2016 20:45:32 +0000 (22:45 +0200)]
Forgot to check a file in.
David Given [Sun, 21 Aug 2016 20:01:19 +0000 (22:01 +0200)]
ego now builds and is used.
This needed lots of refactoring to ego --- not all platforms have ego descr
files, and ego will just crash if you invoke it without one. I think originally
it was never intended that these platforms would be used at -O2 or above.
Plats now only specify the ego descr file if they have one.
David Given [Sun, 21 Aug 2016 19:55:21 +0000 (21:55 +0200)]
filenamesof() an installable now returns all installed files, not just the ones
at the top level (necessary to make a lot of the dependency stuff work when
using tools which depend on installables).
David Given [Sun, 21 Aug 2016 18:27:52 +0000 (20:27 +0200)]
Fix linking bug where em_decode would generate binary data instead of text.
David Given [Sun, 21 Aug 2016 18:08:05 +0000 (20:08 +0200)]
Run through clang-format.
David Given [Sun, 21 Aug 2016 17:53:14 +0000 (19:53 +0200)]
Run through clang-format.
David Given [Sun, 21 Aug 2016 17:46:19 +0000 (19:46 +0200)]
Run through clang-format.
David Given [Sun, 21 Aug 2016 17:38:54 +0000 (19:38 +0200)]
Run through clang-format.
David Given [Sun, 21 Aug 2016 17:38:02 +0000 (19:38 +0200)]
Run through clang-format.
David Given [Sun, 21 Aug 2016 17:34:54 +0000 (19:34 +0200)]
Push through clang-format.
David Given [Sun, 21 Aug 2016 16:51:36 +0000 (18:51 +0200)]
Run through clang-format.
David Given [Sun, 21 Aug 2016 16:45:25 +0000 (18:45 +0200)]
Push em_ego.c through clang-format before working on it.
David Given [Sat, 20 Aug 2016 12:05:24 +0000 (14:05 +0200)]
Build the examples when doing a normal build; this exercises the compiler as a
whole and is one step further towards a proper test suite.
David Given [Sat, 20 Aug 2016 12:04:46 +0000 (14:04 +0200)]
aal doesn't build the ranlib table if you don't set -DAAL.
David Given [Sat, 20 Aug 2016 12:04:17 +0000 (14:04 +0200)]
Add files which got missed in the initial build pass.
David Given [Sat, 20 Aug 2016 12:03:49 +0000 (14:03 +0200)]
liblinux is no more; its files are now in libsys.
David Given [Sat, 20 Aug 2016 12:03:19 +0000 (14:03 +0200)]
rpi has a time() function; don't try to call gettimeofday().
David Given [Sat, 20 Aug 2016 12:02:12 +0000 (14:02 +0200)]
Print hex numbers actually properly this time.
David Given [Sat, 20 Aug 2016 10:40:13 +0000 (12:40 +0200)]
Raspberry Pi backend now builds.
David Given [Sat, 20 Aug 2016 10:40:00 +0000 (12:40 +0200)]
Wildcards are allowed to match no files now.
David Given [Sun, 14 Aug 2016 22:47:08 +0000 (00:47 +0200)]
Filename variables now get passed into ackbuilder on the command line.
David Given [Sun, 14 Aug 2016 22:46:43 +0000 (00:46 +0200)]
Fix dependency error (only shows up with make, not ninja. Odd).
David Given [Sun, 14 Aug 2016 21:01:12 +0000 (23:01 +0200)]
Fix compiler warnings and 64bitisms.
David Given [Sun, 14 Aug 2016 20:55:10 +0000 (22:55 +0200)]
Er, oops; the ninja build system is in a package called ninja-build.
David Given [Sun, 14 Aug 2016 20:52:57 +0000 (22:52 +0200)]
Backport to Lua 5.1 (because 5.2 on Travis doesn't have luaposix...).