Track down required changes in 2001/anonymous

In order to know what had to change exactly I tested this out (though
it's possible I forgot to initially document changes and so I did not
test everything) and I have documented it in the README.md. The required
changes:

- remove infinite recursion from main(): move the body of main() to
another function.

- add #include <sys/mman.h> for mmap().

Without either this did not work. I also changed (in case of
non-standardised constants) '3' in the call to mmap() to be
PROT_READ|PROT_WRITE but this appears to not be strictly required.

I added the script try.me.sh which has more commands than the previous
try section to show how it works and what changes etc.

Updated .gitignore as the above script creates some.

Make make all attempt to compile anonymous.ten.c: it's an important part
of the program though it can work on other 32-bit ELF binaries.

Update bugs.md explaining why this won't work with macOS.
This commit is contained in:
Cody Boone Ferguson committed 2023-05-02 03:11:18 -07:00
1 parent ffc50a98a5
commit 9990fe2abd
5 files changed
+98 -19

No files matched your search

+9 -4
View File
@@ -117,7 +117,7 @@ PROG= ${ENTRY}
#
OBJ= ${PROG}.o
DATA=
TARGET= ${PROG}
TARGET= ${PROG} ${PROG}.ten
#
ALT_OBJ=
ALT_TARGET=
@@ -135,7 +135,6 @@ all: data ${TARGET}
supernova deep_magic magic charon pluto
${PROG}: ${PROG}.c
@echo "NOTE: this entry seems to no longer work."
magic='${CC} ${CFLAGS}'; \
X='-DA(X)=#X'; \
warning='-Dprocessor'; \
@@ -144,12 +143,17 @@ ${PROG}: ${PROG}.c
${PROG}.ten: ${PROG}.ten.c
@echo "NOTE: this program must be compiled as 32-bit to use with the entry itself."
@echo "if you want to use it where this is not possible e.g. with a Mac try, say to"
@echo "WARNING: ${PROG}.ten.c must be compiled as 32-bit to use with the entry itself;"
@echo "this is because the program works on 32-bit binaries. If you cannot use -m32 this"
@echo "will NOT work!"
@echo
@echo "If you want to use it where this is not possible e.g. with a Mac, say to"
@echo "use by itself, try:"
@echo
@echo " ${CC} $< -o $@"
@echo
@echo "but running ${PROG} on the resulting binary will crash."
@echo
${CC} ${CFLAGS} -m32 $< -o $@ ${LIBS}
# alternative executable
@@ -181,6 +185,7 @@ clean:
clobber: clean
${RM} -f ${TARGET} ${ALT_TARGET}
${RM} -f anonymous.ten.bak ten.od ten.od.bak ten.txt ten.bak.txt
@-if [ -e sandwich ]; then \
${RM} -f sandwich; \
echo 'ate sandwich'; \