Commit graph

1874 commits

Author SHA1 Message Date
David Given 64c62439cd Fix a bunch of issues with the new temp file generation. 2022-07-18 22:18:08 +02:00
David Given 0cd26b1d0c Get fed up with trying to make mkstemp work and wrote my own function
which does what I want.
2022-07-18 21:42:52 +02:00
David Given 0cadd6a299 Remove shf, which is obsolete and unused. 2022-07-18 20:50:26 +02:00
David Given bf8dda7aa3 Remove the K&R cpp, which is obsolete and unused. 2022-07-18 20:49:58 +02:00
David Given e9687e90b5 Remove flex, which is obsolete and unused. 2022-07-18 20:49:21 +02:00
David Given 3a417ef5a0 Remove byacc, which is obsolete and unused. 2022-07-18 20:49:05 +02:00
David Given 7d112a394c Open EM files in binary mode. 2022-07-18 20:25:56 +02:00
David Given 205a50d8ee Add more binary mode flags. 2022-07-18 19:36:44 +02:00
David Given 279de30935 More binary mode flag setting. 2022-07-18 19:29:53 +02:00
David Given 20c2029753 Remove ed. We don't need it any more! 2022-07-18 00:25:22 +02:00
David Given 78674d935f Warning fixes. 2022-07-17 23:52:05 +02:00
David Given 739b9af662 Make ego put its temporary files in the right place. 2022-07-17 21:09:18 +02:00
David Given 28d4480f62 It turns out that you can't use freopen() to set binary mode of
stdin/stdout on Windows; so add a new system function called
sys_setbinarymode which does it instead. Then find lots more binary mode
flags which need setting.
2022-07-17 20:47:53 +02:00
David Given acd2fe1351 More binary flags; and, remember to truncate existing files when trying
to create new ones.
2022-07-17 20:11:21 +02:00
David Given 2558d00d17 Replace the terrible code generation shell script with a Lua script. 2022-07-17 18:15:09 +02:00
David Given 90c6f0274a Stupid git didn't commit the files I told it to. 2022-07-17 14:53:48 +02:00
David Given 544e8d474b Only Windows has O_BINARY. 2022-07-17 13:36:26 +02:00
David Given f9785629e0 Add a binary flag. 2022-07-17 13:01:11 +02:00
David Given 8e4a6ca47d Fix a nasty temporary file race condition. 2022-07-17 13:00:18 +02:00
David Given cb37502a23 Make work, mostly, on Windows --- temporary files are now created in the
right place, creat() isn't used because it doesn't work, partial file
read/writes work, etc.
2022-07-17 01:58:16 +02:00
David Given 748dd1ac00 More removals of NAME_MAX. 2022-07-16 23:27:57 +02:00
David Given 438fdd91a6 Windows doesn't have NAME_MAX or any interesting signals. 2022-07-16 23:21:13 +02:00
David Given bb0236cbf7 ego uses fork/exec too, so factor out the new system() code from ack and use it
there.
2022-07-16 23:14:39 +02:00
David Given cf3f5bf64e More signal removals. 2022-07-16 22:51:48 +02:00
David Given fd691cfaf6 Windows doesn't do signals much. 2022-07-16 22:45:08 +02:00
David Given 31fe10bf5d Reformat. 2022-07-16 22:43:39 +02:00
David Given e43905afeb Reformat. 2022-07-16 22:33:48 +02:00
David Given d48e7399ee Use system() rather than fork()/wait() to run commands, to keep Windows happy. 2022-07-16 22:33:29 +02:00
David Given 9519588f59 Convert all the things to Unix format. 2022-07-16 00:02:46 +02:00
David Given 020c84db3d Try forcing ed to produce LF output files rather than CRLF ones. 2022-07-15 23:42:23 +02:00
David Given 6778fd05f9 Finally make build on Windows, at least locally. 2022-07-15 22:56:11 +02:00
David Given 98d37492ec Better llgen windowsification. 2022-07-15 00:43:34 +02:00
David Given e7626705f6 Try and make llgen work on Windows. 2022-07-15 00:34:38 +02:00
David Given 269115f0a2 Try and make ed build on Windows. 2022-07-15 00:28:32 +02:00
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
David Given 99ec64a7a0 Add support for specifying the output directory (avoiding nasty cd tricks when
using it in build scripts).
2022-07-14 01:15:29 +02:00
David Given 8b0a3ac473 Attempt to make work on OSX, and update the build matrix. 2022-06-20 00:18:16 +02:00
David Given ddfe372ac8
Merge pull request #250 from davidgiven/dtrg-tmp
Use more modern temp file handling.
2022-06-01 22:37:42 +02:00
David Given 76060c4dde Eliminate the TMP_DIR compile-time constant in favour of using $TMPDIR and
mkstemp where possible.
2022-05-29 00:44:28 +02:00
Tee-Kiah Chia d85480f441 aal: recognize but ignore an s option for GNU ar compatibility
first/build.lua invokes the archiver $(AR) with the flags `cqs`.
This patch allows this to work even if $(AR) is aal.
2022-03-19 20:44:14 +00:00
David Given f7de764a86 Generate HTML versions of the documentation as well. 2022-02-05 20:50:49 +01:00
David Given 00cb4144f2
Merge pull request #246 from davidgiven/llgen
Fix the LLgen standalone build scripts
2022-02-03 22:33:13 +01:00
David Given 06ede2e2f5 Fix the main documentation PDF not to use mangled character spacing. 2022-02-03 21:40:49 +01:00
David Given 1b972fcd17 Rip out the old pm stuff and write a simple Makefile. Update README. 2022-02-03 21:28:47 +01:00
Tee-Kiah Chia 4d5b1ec115 util/ego: inlining pass now tries to remove unused procedures
This addresses issue #230, though only partially.
2021-04-26 14:27:45 +00:00
Tee-Kiah Chia a29507d9e4 aslod: fix: use section alignments when computing section sizes
The follows( ) function uses pa->os_lign when determining
whether an output section pa immediately follows another
section pb.

However, emits( ) was not using this alignment information
when laying out and padding the output sections.  This seems
to be a bug.

I suspect that mach/arm/cv/cv.c might need a similar fix.
2021-03-18 18:25:04 +00:00
Tee-Kiah Chia 9c7ce04cec Fix static buffer overflow in genname( ) in LLgen
This should fix at least some instances of the "undefined
reference to `LLnc_recover'" error that happens in some
builds (https://github.com/davidgiven/ack/issues/218).

The bug was that genname( ) used a static `namebuf' buffer
and did not properly check for overflow when writing into
it.  The result was that the `non_corr' variable was
sometimes overwritten with a non-zero value when it should
be zero, causing bogus results later.

This proposed patch makes genname( ) dynamically allocate
and resize a buffer for holding a target file name.

I also take this chance to fix a typo in correct_prefix().
2021-03-16 17:59:29 +00:00
David Given 3eed6db007 Fix some issues caused by, I think, COMMON variables no longer working in
recent gccs?
2020-09-14 22:38:01 +02:00
George Koehler e841adf970 Fix END pseudo in util/ego/sr; closes #203
The strength reduction (SR) phase mishandled the END pseudo when SR
found at least 2 different expressions in the same loop, and SR made a
new header for the loop.

Since 1987 (commit 159b84e), SR appended the new header to the end of
the procedure.  Later, SR fixed the header by adding a BRA branch to
the loop's entry, and moving the END pseudo from the previous basic
block to the header.  If SR found multiple expressions, it called
fix_header() multiple times, and tried to move the END again.  The
extra move failed assert(INSTR(e) == ps_end), or moved another line
after the END, so opt2 (the peephole optimizer) would crash.

Fix by removing fix_header() and moving the code to make_header(), so
SR adds the BRA and moves the END when it makes the header, and does
so only once for each header.

Adjust init_code(), which inserts code into a header.  Stop checking
for an empty header, because make_header() now adds BRA.  After
inserting code before BRA, don't move LP_INSTR, because later
insertions should go before BRA, not after END.
2019-11-15 11:50:05 -05:00
George Koehler fc1476c88b Add -DDEBUG to enable assertions in util/ego
Our build enables assertions in some other ACK tools (like assemblers
and LLgen), but disabled them in ego until now.  Bug #203 becomes a
failed assertion in ego's SR phase:

    sr: util/ego/sr/sr_reduce.c:483: fix_header: Assertion
    `INSTR(e) == ps_end' failed.

Comment out 2 assertions in util/ego/share, because they fail on
systems with 4-byte int, 8-byte long.
2019-11-14 17:17:24 -05:00