Commit graph

47 commits

Author SHA1 Message Date
David Given 25b6712e63 Rework all the ackbuilder scripts not to use wildcards, because we can't expand
them without luaposix, which isn't available (easily) on OSX or Windows.
2022-07-14 23:57:54 +02:00
Tee-Kiah Chia 84a25b0526 Add fork, wait, waitpid for all Linux targets, & execl for linux386. 2022-01-19 17:05:59 +00:00
George Koehler aeb8ed53e4 Define _EM_LLSIZE, int64_t, uint64_t for linux386.
Also change UINT32_MAX in <stdint.h> from 4294967295 to 4294967295U.
The U suffix avoids a promotion to long or unsigned long if it would
fit in unsigned int.

Define _EM_LLSIZE but not EM_LLSIZE.  The leading underscore is a
convention for such macros.  If code always uses _EM_LLSIZE, we will
never need to add EM_LLSIZE.  The flag -D_EM_LLSIZE={q} is in
plat/linux386/descr, not lib/descr/fe, so platforms without long long
don't define _EM_LLSIZE.

<stdint.h> doesn't keep the old code for _EM_LSIZE == 8, because I
change it to _EM_LLSIZE == 8.  No platform had _EM_LSIZE == 8, and the
old limits like INT64_MAX were wrong.
2019-09-12 13:40:07 -04:00
George Koehler 007a63d529 Begin to add long long to C compiler for linux386.
Add long long type, but without literals; you can't say '123LL' yet.
You can try constant operations, like `(long long)123 + 1`, but the
compiler's `arith` type might not be wide enough.  Conversions,
shifts, and some other operations don't work in i386 ncg; I am using a
union instead of conversions:

	union q {
		long long ll;
		unsigned long long ull;
		int i[2];
	};

Hack plat/linux386/descr to enable long long (size 8, alignment 4)
only for this platform.  The default for other platforms is to disable
long long (size -1).

In lang/cem/cemcom.ansi,

 - BigPars, SmallPars: Add default size, alignment of long long.
 - align.h: Add lnglng_align.
 - arith.c: Convert arithmetic operands to long long or unsigned long
   long when necessary; avoid conversion from long long to long.
   Allow long long as an arithmetic, integral, or logical operand.
 - ch3.c: Handle long long like int and long when erroneously applying
   a selector, like `long long ll; ll.member` or `ll->member`.  Add
   long long to integral and arithmetic types.
 - code.c: Add long long to type stabs for debugging.
 - conversion.c: Add long long to integral conversions.
 - cstoper.c: Write masks up to full_mask[8].  Add FIXME comment.
 - declar.g: Parse `long long` in code.
 - decspecs.c: Understand long long in type declarations.
 - eval.c: Add long long to operations, to generate code like `adi 8`.
   Don't use `ldc` with constant over 4 bytes.
 - ival.g: Allow long long in initializations.
 - main.c: Set lnglng_type and related values.
 - options.c: Add option like `-Vq8.4` to set long long to size 8,
   alignment 4.  I chose 'q', because Perl's pack and Ruby's
   Array#pack use 'q' for 64-bit or long long values; it might be a
   reference to BSD's old quad_t alias for long long.
 - sizes.h: Add lnglng_size.
 - stab.c: Allow long long when writing the type stab for debugging.
   Switch from calculating the ranges to hardcoding them in strings;
   add 8-byte ranges as a special case.  This also hardcodes the
   unsigned 4-byte range as "0;-1".  Before it was either "0;-1" or
   "0;4294967295", depending on sizeof(long) in the compiler.
 - struct.c: Try long long bitfield, but it will probably give the
   error, "bit field type long long does not fit in a word".
 - switch.c: Update comment.
 - tokenname.c: Define LNGLNG (long long) like LNGDBL (long double).
 - type.c, type.str: Add lnglng_type and ulnglng_type.  Add function
   no_long_long() to check if long long is disabled.
2019-09-02 11:24:44 -04:00
David Given ab7002c0ee All the Linux include directories are the same, so common them all out into a
single one, like OSX.
2018-06-24 19:57:43 +02:00
David Given b267b56ad9 Made linux68k work; commoned up all the generic linux includes. 2018-06-23 12:35:17 +02:00
David Given 66815ff987 Make linux386 work with the new libc layout. 2018-06-23 12:13:33 +02:00
David Given 9bf1d548fc Rearrange the libc config files, ready for adding new options. 2018-06-22 23:43:15 +02:00
George Koehler 2b09d3756c These are EM trap numbers.
Remove .sect; absolute symbols don't go in a section.
2018-01-09 00:40:11 -05:00
George Koehler de2c7c3f25 Hide some i386 stuff from linux68k, linuxppc.
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
2018-01-08 23:46:30 -05:00
George Koehler a585ddf578 Fix parameters of signal handlers for linuxppc.
Linux passes the arguments in registers, but our compiler expects
arguments on the stack.  Signal handlers got garbage instead of the
signal number.  Some handlers, like the one in lang/m2/libm2/sigtrp.c,
need the correct signal number.

I write a "bridge" in PowerPC assembly that moves the arguments to the
stack.  I put the bridge in sigaction(), so I provide a signal() that
calls sigaction().  I remove the *.c glob or wildcard from build.lua,
so linuxppc only compiles its own signal.c, not the other signal.c for
linux386 and linux68k.

My bridge uses sigprocmask(), so I also add sigprocmask().  Because
linux386 and linux68k use globs, they also get sigprocmask().  I sync
the header files so all three Linux platforms declare execve(),
sigprocmask(), and unlink(), but not remove(), because we have
remove() in <stdio.h>.

I am using sigaction.s to test some features that we recently added to
our PowerPC assembler.  These are the "hi16[...]" and "lo16[...]"
syntax, and also the extended names like "beq", "cmpwi", "li", "subi".
2017-01-22 00:52:32 -05:00
David Given 51862cff82 Merge pull request #32 from dram/add-execve
Add execve() system call for Linux
2017-01-07 23:23:00 +01:00
Xin Wang 24d26b2826 Add execve() system call for Linux 2017-01-06 18:33:52 +08:00
David Given 0e10329876 Fix an issue throughout where B couldn't be built by ackprogram due to symbol
laziness.
2016-12-29 17:11:53 +00:00
David Given 4485d89b23 Hook the B compiler up to the compiler driver. 2016-11-27 20:48:07 +01:00
David Given 5bce5fc4da Change the extension used by Basic files for .b to .bas, to avoid conflicts
with B.
2016-11-27 20:38:33 +01:00
David Given a9a0b37b14 Plats which use aelflod need to depend on it. 2016-11-26 12:07:08 +01:00
David Given 98c761d5c0 Enable tests for linux386 via qemu-i386. 2016-11-26 11:58:02 +01:00
David Given 36ab90385f Change sbrk() to take an int rather than an intptr_t (following the OpenBSD way
rather than the Linux way; various non-C bits of the ACK assume it takes an
int, so it's cleaner).
2016-11-23 22:06:24 +01:00
David Given f67c98e239 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.
2016-09-02 23:00:38 +02:00
David Given 612e38f1c6 Remove the old make-based build system, plus some big chunks of horribly
obsolete protomake build system.
2016-09-02 22:17:51 +02:00
David Given 5bae29a00c 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.
2016-08-21 22:01:19 +02:00
David Given edee22510b liblinux is no more; its files are now in libsys. 2016-08-20 14:03:49 +02:00
David Given 420c47c386 Fix dependency error (only shows up with make, not ninja. Odd). 2016-08-15 00:46:43 +02:00
David Given 3df4906d52 Turns out I wasn't building the syscall libraries. Do so. 2016-08-14 11:23:57 +02:00
David Given b549980af2 Wasn't exporting the plat headers; refactor to make this a little cleaner. 2016-08-14 11:01:36 +02:00
David Given f253b6a169 linux386 builds. Also, forgot to turn back on the language runtimes. 2016-08-14 10:37:55 +02:00
David Given 88bd7ce126 Remove defunct pmfiles.
--HG--
branch : default-branch
2016-06-03 13:56:50 +02:00
David Given 92817a6ad7 Allow platforms to specify size of long double; seperate alignment from size.
--HG--
branch : dtrg-videocore
2013-05-21 19:18:11 +01:00
David Given 11377070fd Update distribution files.
--HG--
branch : dtrg-buildsystem
2013-05-15 23:46:15 +01:00
David Given 07453d184a Top, topgen, aelflod. Moved the libraries back into the platform-specific
directories --- wrangling descr files was too hard. C programs can be built
for cpm, pc86, linux386, linux68k!

--HG--
branch : dtrg-buildsystem
rename : util/ack/build.mk => util/led/build.mk
rename : util/LLgen/build.mk => util/topgen/build.mk
2013-05-13 23:26:15 +01:00
David Given 442306d557 Split off some of the platform-independent stuff (such as as and ncg).
--HG--
branch : dtrg-buildsystem
rename : plat/pc86/build.mk => mach/i386/build.mk
rename : plat/pc86/build.mk => mach/i80/build.mk
rename : plat/pc86/build.mk => mach/i86/build.mk
rename : plat/pc86/build.mk => mach/m68020/build.mk
rename : plat/pc86/build.mk => mach/powerpc/build.mk
2013-05-13 22:12:46 +01:00
David Given 81778b603f Merge updates from trunk.
--HG--
branch : dtrg-buildsystem
2013-05-13 12:37:27 +01:00
David Given b0c238eb5d Made a start on building the runtimes for each platform and language; the
Linuxes all build.

--HG--
branch : dtrg-buildsystem
rename : modules/src/em_mes/build.mk => modules/src/read_em/build.mk
rename : plat/pc86/build.mk => plat/linux386/build.mk
rename : plat/pc86/build.mk => plat/linux68k/build.mk
rename : plat/pc86/build.mk => plat/linuxppc/build.mk
rename : util/ack/build.mk => util/misc/build.mk
2013-05-12 23:51:55 +01:00
David Given b9b808e01a Apply George Koehler's aelflod fix for generating non-EM_386 binaries.
Adjust platforms to use it. Fix some bugs in the linux386 platform.

--HG--
branch : dtrg-experimental-powerpc
2013-05-09 15:54:23 +01:00
David Given c93cb69959 Check in incomplete Linux PowerPC and M68K work.
--HG--
branch : dtrg-experimental-powerpc
2013-05-08 00:48:48 +01:00
dtrg 7292b538bc Added support for remove() and unlink(). 2010-09-27 20:44:49 +00:00
dtrg 085f346f8c Fixed definitions of O_* flags. 2010-08-20 19:27:09 +00:00
dtrg a0c67da261 Changed to actually work. (On modern Linux systems the old version just
crashes. On old Linux systems it apparently only worked by accident.)
2010-08-06 17:06:31 +00:00
dtrg 78777e802b Now using more conservative optimisation due to random seg fault issues. 2007-04-29 23:02:23 +00:00
dtrg eb4ea1e761 Use better optimisation options. 2007-04-29 21:24:17 +00:00
dtrg a7323e1a8b Documented floating-point status. 2007-04-28 22:34:47 +00:00
dtrg 24ea8aee3d Updated for the 6.0pre2 release. 2007-04-24 20:45:58 +00:00
dtrg 740940c9fc Fixed major typos in the signal declarations that was preventing anything that used signal() from compiling. 2007-04-24 19:34:34 +00:00
dtrg b8e1348f2a Ensured that _errno is always defined. Rejigged the pc86 boot code so it doesn't always waste 510 bytes of memory. 2007-04-24 19:25:00 +00:00
dtrg 9b920e59cb Now fetches argc, argv, env correctly from the host OS. 2007-04-23 23:24:03 +00:00
dtrg b500b1a7b7 Added linux386 platform. 2007-04-21 23:02:11 +00:00