ack.git
8 years agoRename our pseudo-opcode 'la' to 'li32'.
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.

8 years agoEnable the Hall check again, and get powerpc to pass it.
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).

8 years agoIn ncgg, increase MAXREGS from 80 to 200.
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.

8 years agoFix hilo.p for big-endian platforms.
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.

8 years agoAdd the missing .lar4 and .sar4 for powerpc.
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.

8 years agoMerge branch 'default' into kernigh-linuxppc
George Koehler [Sat, 17 Sep 2016 22:15:54 +0000 (18:15 -0400)]
Merge branch 'default' into kernigh-linuxppc

8 years agoEliminate the RELOH2 relocation, as it never worked --- the address would be dtrg-experimental-powerpc
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

8 years agoMostly add support for the experimental and largely broken linuxppc platform.
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

8 years agoMerge from default.
David Given [Thu, 15 Sep 2016 20:59:01 +0000 (22:59 +0200)]
Merge from default.

--HG--
branch : dtrg-experimental-powerpc-branch

8 years agoMerge pull request #3 from kernigh/ego-fix iburg
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.

8 years agoFix 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.

8 years agoAdd unlink system call. buildsystem
David Given [Sun, 4 Sep 2016 17:23:02 +0000 (19:23 +0200)]
Add unlink system call.

8 years agoCleanup some stray files.
David Given [Sat, 3 Sep 2016 17:22:38 +0000 (19:22 +0200)]
Cleanup some stray files.

8 years agoAdd modeline, fix formatting.
David Given [Sat, 3 Sep 2016 17:17:09 +0000 (19:17 +0200)]
Add modeline, fix formatting.

8 years agoUpdated.
David Given [Sat, 3 Sep 2016 17:07:12 +0000 (19:07 +0200)]
Updated.

8 years agoMore documentation.
David Given [Sat, 3 Sep 2016 17:01:47 +0000 (19:01 +0200)]
More documentation.

8 years agoFirst half of the ackbuilder documentation.
David Given [Fri, 2 Sep 2016 23:04:16 +0000 (01:04 +0200)]
First half of the ackbuilder documentation.

8 years agoMakefiles are now slightly less inaccurate. Does actually seem to do sensible
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.

8 years agoAdd an install target.
David Given [Fri, 2 Sep 2016 21:03:57 +0000 (23:03 +0200)]
Add an install target.

8 years agoDistributions are a pain --- let's not bother any more. Instead, we just tag
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.

8 years agoRemove the old make-based build system, plus some big chunks of horribly
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.

8 years agoClean up the top level makefile.
David Given [Thu, 1 Sep 2016 21:36:39 +0000 (23:36 +0200)]
Clean up the top level makefile.

8 years agoFix a fun bug where, every now again, ego would get its temporary files mangled
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.

8 years agoForgot to check a file in.
David Given [Mon, 22 Aug 2016 20:45:32 +0000 (22:45 +0200)]
Forgot to check a file in.

8 years agoego now builds and is used.
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.

8 years agofilenamesof() an installable now returns all installed files, not just the ones
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).

8 years agoFix linking bug where em_decode would generate binary data instead of text.
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.

8 years agoRun through clang-format.
David Given [Sun, 21 Aug 2016 18:08:05 +0000 (20:08 +0200)]
Run through clang-format.

8 years agoRun through clang-format.
David Given [Sun, 21 Aug 2016 17:53:14 +0000 (19:53 +0200)]
Run through clang-format.

8 years agoRun through clang-format.
David Given [Sun, 21 Aug 2016 17:46:19 +0000 (19:46 +0200)]
Run through clang-format.

8 years agoRun through clang-format.
David Given [Sun, 21 Aug 2016 17:38:54 +0000 (19:38 +0200)]
Run through clang-format.

8 years agoRun through clang-format.
David Given [Sun, 21 Aug 2016 17:38:02 +0000 (19:38 +0200)]
Run through clang-format.

8 years agoPush through clang-format.
David Given [Sun, 21 Aug 2016 17:34:54 +0000 (19:34 +0200)]
Push through clang-format.

8 years agoRun through clang-format.
David Given [Sun, 21 Aug 2016 16:51:36 +0000 (18:51 +0200)]
Run through clang-format.

8 years agoPush em_ego.c through clang-format before working on it.
David Given [Sun, 21 Aug 2016 16:45:25 +0000 (18:45 +0200)]
Push em_ego.c through clang-format before working on it.

8 years agoBuild the examples when doing a normal build; this exercises the compiler as a
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.

8 years agoaal doesn't build the ranlib table if you don't set -DAAL.
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.

8 years agoAdd files which got missed in the initial build pass.
David Given [Sat, 20 Aug 2016 12:04:17 +0000 (14:04 +0200)]
Add files which got missed in the initial build pass.

8 years agoliblinux is no more; its files are now in libsys.
David Given [Sat, 20 Aug 2016 12:03:49 +0000 (14:03 +0200)]
liblinux is no more; its files are now in libsys.

8 years agorpi has a time() function; don't try to call gettimeofday().
David Given [Sat, 20 Aug 2016 12:03:19 +0000 (14:03 +0200)]
rpi has a time() function; don't try to call gettimeofday().

8 years agoPrint hex numbers actually properly this time.
David Given [Sat, 20 Aug 2016 12:02:12 +0000 (14:02 +0200)]
Print hex numbers actually properly this time.

8 years agoRaspberry Pi backend now builds.
David Given [Sat, 20 Aug 2016 10:40:13 +0000 (12:40 +0200)]
Raspberry Pi backend now builds.

8 years agoWildcards are allowed to match no files now.
David Given [Sat, 20 Aug 2016 10:40:00 +0000 (12:40 +0200)]
Wildcards are allowed to match no files now.

8 years agoFilename variables now get passed into ackbuilder on the command line.
David Given [Sun, 14 Aug 2016 22:47:08 +0000 (00:47 +0200)]
Filename variables now get passed into ackbuilder on the command line.

8 years agoFix dependency error (only shows up with make, not ninja. Odd).
David Given [Sun, 14 Aug 2016 22:46:43 +0000 (00:46 +0200)]
Fix dependency error (only shows up with make, not ninja. Odd).

8 years agoFix compiler warnings and 64bitisms.
David Given [Sun, 14 Aug 2016 21:01:12 +0000 (23:01 +0200)]
Fix compiler warnings and 64bitisms.

8 years agoEr, oops; the ninja build system is in a package called ninja-build.
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.

8 years agoBackport to Lua 5.1 (because 5.2 on Travis doesn't have luaposix...).
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...).

8 years agoAdd another Travis library.
David Given [Sun, 14 Aug 2016 20:41:54 +0000 (22:41 +0200)]
Add another Travis library.

8 years agoUpdate Travis metadata.
David Given [Sun, 14 Aug 2016 12:44:00 +0000 (14:44 +0200)]
Update Travis metadata.

8 years agoLED builds now.
David Given [Sun, 14 Aug 2016 12:40:01 +0000 (14:40 +0200)]
LED builds now.

8 years agoMove the em_code headers into the em_code module.
David Given [Sun, 14 Aug 2016 12:17:35 +0000 (14:17 +0200)]
Move the em_code headers into the em_code module.

8 years agoMove util/data into modules/src/em_data, for consistency with the other
David Given [Sun, 14 Aug 2016 12:09:38 +0000 (14:09 +0200)]
Move util/data into modules/src/em_data, for consistency with the other
modules.

8 years agolinux68k builds now.
David Given [Sun, 14 Aug 2016 09:34:18 +0000 (11:34 +0200)]
linux68k builds now.

8 years agoinstallables need to depend on their source files...
David Given [Sun, 14 Aug 2016 09:25:47 +0000 (11:25 +0200)]
installables need to depend on their source files...

8 years agoTurns out I wasn't building the syscall libraries. Do so.
David Given [Sun, 14 Aug 2016 09:23:57 +0000 (11:23 +0200)]
Turns out I wasn't building the syscall libraries. Do so.

8 years agoWasn't exporting the plat headers; refactor to make this a little cleaner.
David Given [Sun, 14 Aug 2016 09:01:36 +0000 (11:01 +0200)]
Wasn't exporting the plat headers; refactor to make this a little cleaner.

8 years agolinux386 builds. Also, forgot to turn back on the language runtimes.
David Given [Sun, 14 Aug 2016 08:37:55 +0000 (10:37 +0200)]
linux386 builds. Also, forgot to turn back on the language runtimes.

8 years agoBiggish refactor to break cycles; my build rules were full of them. cpm builds,
David Given [Sat, 13 Aug 2016 23:39:40 +0000 (01:39 +0200)]
Biggish refactor to break cycles; my build rules were full of them. cpm builds,
which requires top and topgen.

8 years agoAdd cycle detection, because it was ruining my day. Allow targets to be stored
David Given [Sat, 13 Aug 2016 23:38:36 +0000 (01:38 +0200)]
Add cycle detection, because it was ruining my day. Allow targets to be stored
in a file called build-<target>.lua to allow better dividing up of build rules
(to break cycles).

8 years agoPascal runtime library now builds.
David Given [Sat, 13 Aug 2016 11:07:19 +0000 (13:07 +0200)]
Pascal runtime library now builds.

8 years agoPascal compiler builds.
David Given [Sat, 13 Aug 2016 11:03:06 +0000 (13:03 +0200)]
Pascal compiler builds.

8 years agoModula-2 runtime library now builds.
David Given [Sat, 13 Aug 2016 10:43:44 +0000 (12:43 +0200)]
Modula-2 runtime library now builds.

8 years agoFixed a small bug where two line number directives next to each other wouldn't
David Given [Sat, 13 Aug 2016 10:21:16 +0000 (12:21 +0200)]
Fixed a small bug where two line number directives next to each other wouldn't
be parsed properly (the second one would be treated as Modula-2 syntax).

8 years agoThe Modula-2 compiler now builds.
David Given [Fri, 12 Aug 2016 22:02:21 +0000 (00:02 +0200)]
The Modula-2 compiler now builds.

8 years agoThe Basic runtime builds now.
David Given [Thu, 11 Aug 2016 22:24:40 +0000 (00:24 +0200)]
The Basic runtime builds now.

8 years agoThe Basic compiler works now.
David Given [Thu, 11 Aug 2016 22:19:51 +0000 (00:19 +0200)]
The Basic compiler works now.

8 years agoreplace() gets confused if you give it a singleton list as its parameter.
David Given [Thu, 11 Aug 2016 22:19:30 +0000 (00:19 +0200)]
replace() gets confused if you give it a singleton list as its parameter.

8 years agoReplaced the funky and hard-to-compile ACK malloc with a much smaller
David Given [Wed, 10 Aug 2016 22:30:32 +0000 (00:30 +0200)]
Replaced the funky and hard-to-compile ACK malloc with a much smaller
and simpler one stolen from K&R. libc builds now.

8 years agoMost of libc builds now (missing malloc).
David Given [Mon, 8 Aug 2016 21:55:47 +0000 (23:55 +0200)]
Most of libc builds now (missing malloc).

8 years agoTarget lists can now have keyed items ({["foo"] = "+target"); this is
David Given [Mon, 8 Aug 2016 21:55:23 +0000 (23:55 +0200)]
Target lists can now have keyed items ({["foo"] = "+target"); this is
used by both installable and by clibrary{} to allow headers to be
installed into subdirectories.

8 years agoWe can build our first C file.
David Given [Sun, 7 Aug 2016 19:56:53 +0000 (21:56 +0200)]
We can build our first C file.

8 years agoAdd check for undefined variables. Find undefined variables. Fix undefined
David Given [Thu, 4 Aug 2016 22:01:55 +0000 (00:01 +0200)]
Add check for undefined variables. Find undefined variables. Fix undefined
variables.

8 years agoMassive ackbuilder refactor --- cleaner and more expressive. Lists
David Given [Thu, 4 Aug 2016 21:51:19 +0000 (23:51 +0200)]
Massive ackbuilder refactor --- cleaner and more expressive. Lists
are automatically flattened (leading to better build files), and the
list and filename functions are vastly more orthogonal.

8 years agoBuilds libend (the simplest library). Becoming obvious I need to rework the way
David Given [Fri, 29 Jul 2016 22:39:22 +0000 (00:39 +0200)]
Builds libend (the simplest library). Becoming obvious I need to rework the way
ackbuilder deals with lists.

8 years agoC preprocessor; tabgen; now the pc86 boot.s builds using the ack
David Given [Thu, 28 Jul 2016 22:22:49 +0000 (00:22 +0200)]
C preprocessor; tabgen; now the pc86 boot.s builds using the ack
toolchain.

8 years agoFix a nasty dependency bug where filenamesof() on installables wouldn't
David Given [Thu, 28 Jul 2016 22:22:22 +0000 (00:22 +0200)]
Fix a nasty dependency bug where filenamesof() on installables wouldn't
return any of the installable files (which meant installables were
never considered as dependencies).

8 years agoReplace the hacky cflags variable with an equally hacky but vastly
David Given [Tue, 26 Jul 2016 22:10:15 +0000 (00:10 +0200)]
Replace the hacky cflags variable with an equally hacky but vastly
more useful magic vars variable.

8 years agoReplaced the fairly complex environment code with a much simpler
David Given [Tue, 26 Jul 2016 21:43:31 +0000 (23:43 +0200)]
Replaced the fairly complex environment code with a much simpler
emitter object.

8 years agoyacc, ncgg; platform ncg builds now.
David Given [Tue, 26 Jul 2016 21:35:30 +0000 (23:35 +0200)]
yacc, ncgg; platform ncg builds now.

8 years agoBaby steps towards building a platform --- make the assembler work.
David Given [Sat, 23 Jul 2016 22:50:02 +0000 (00:50 +0200)]
Baby steps towards building a platform --- make the assembler work.
Add ackbuilder support for C preprocessor files and yacc.

8 years agoMore programs, more libraries. src/modules build files are now saner.
David Given [Fri, 22 Jul 2016 22:30:31 +0000 (00:30 +0200)]
More programs, more libraries. src/modules build files are now saner.

8 years agocemcom.ansi now builds.
David Given [Tue, 19 Jul 2016 21:43:14 +0000 (23:43 +0200)]
cemcom.ansi now builds.

8 years agoSaner clibrary dependency and header handling.
David Given [Tue, 19 Jul 2016 21:42:56 +0000 (23:42 +0200)]
Saner clibrary dependency and header handling.

8 years agoError out if a template expansion returns nil (as it's normally an error).
David Given [Tue, 19 Jul 2016 21:42:42 +0000 (23:42 +0200)]
Error out if a template expansion returns nil (as it's normally an error).

8 years agoackbuilder rules files now require absolute paths in external variables
David Given [Mon, 18 Jul 2016 21:16:27 +0000 (23:16 +0200)]
ackbuilder rules files now require absolute paths in external variables
(otherwise commands which change directory don't work).

8 years agoBuilt a make bootstrap that runs either make or ninja depending on which is
David Given [Sat, 16 Jul 2016 12:58:29 +0000 (14:58 +0200)]
Built a make bootstrap that runs either make or ninja depending on which is
installed.

8 years agoMore stuff builds; almost the C compiler now.
David Given [Thu, 14 Jul 2016 21:54:13 +0000 (23:54 +0200)]
More stuff builds; almost the C compiler now.

8 years agoconcat, targetnamesof. deps is now handled more consistently (treated the same
David Given [Thu, 14 Jul 2016 21:53:34 +0000 (23:53 +0200)]
concat, targetnamesof. deps is now handled more consistently (treated the same
as ins but not passed in as inputs).

8 years agoAllow headers which aren't .h files.
David Given [Thu, 30 Jun 2016 11:27:47 +0000 (13:27 +0200)]
Allow headers which aren't .h files.

8 years agoMake work with make.
David Given [Thu, 30 Jun 2016 11:19:10 +0000 (13:19 +0200)]
Make work with make.

8 years agoBetter cwd handling.
David Given [Wed, 29 Jun 2016 11:58:38 +0000 (13:58 +0200)]
Better cwd handling.

8 years agoclibrary can now export headers.
David Given [Wed, 29 Jun 2016 11:28:45 +0000 (13:28 +0200)]
clibrary can now export headers.

8 years agoLocal rules; include() and replace().
David Given [Wed, 29 Jun 2016 11:28:22 +0000 (13:28 +0200)]
Local rules; include() and replace().

8 years agoAll the amisc binaries now build.
David Given [Sun, 19 Jun 2016 07:32:45 +0000 (09:32 +0200)]
All the amisc binaries now build.

8 years agoAdd ninja support. It works so much better than make.
David Given [Sun, 19 Jun 2016 06:55:02 +0000 (08:55 +0200)]
Add ninja support. It works so much better than make.

8 years agoFirst draft at installables; not very satisfactory. make bugs with multiple
David Given [Thu, 16 Jun 2016 03:26:44 +0000 (05:26 +0200)]
First draft at installables; not very satisfactory. make bugs with multiple
output targets and parallelism?

8 years agoinstallable works, although it's a bit kludgy. Change the : separator to +
David Given [Tue, 14 Jun 2016 05:34:14 +0000 (07:34 +0200)]
installable works, although it's a bit kludgy. Change the : separator to +
because : is special in make and non of the others I could think of would work.

8 years agoWe can build a real program now!
David Given [Sun, 12 Jun 2016 18:59:43 +0000 (20:59 +0200)]
We can build a real program now!

8 years agoAdd hgignore file.
David Given [Sun, 12 Jun 2016 18:59:16 +0000 (20:59 +0200)]
Add hgignore file.