Skip to content

Commit

Permalink
Make improvements
Browse files Browse the repository at this point in the history
- This commit mints a new release of APE Loader v1.2 which supports
  loading ELF programs with a non-contiguous virtual address layout
  even though we've never been able to take advantage of it, due to
  how `objcopy -SO binary` fills any holes left by PT_LOAD. This'll
  change soon, since we'll have a new way of creating APE binaries.

- The undiamonding trick with our ioctl() implementation is removed
  since POSIX has been killing ioctl() for years and they've done a
  much better job. One problem it resolves, is that ioctl(FIONREAD)
  wasn't working earlier and that caused issues when building Emacs
  • Loading branch information
jart committed Jul 11, 2023
1 parent a1b1fdd commit 1ee2e89
Show file tree
Hide file tree
Showing 53 changed files with 1,157 additions and 1,257 deletions.
20 changes: 10 additions & 10 deletions ape/ape.mk
Original file line number Diff line number Diff line change
Expand Up @@ -197,25 +197,25 @@ o/$(MODE)/ape/loader-xnu-clang.asm: ape/loader.c
o/$(MODE)/ape/ape.elf: o/$(MODE)/ape/ape.elf.dbg
o/$(MODE)/ape/ape.macho: o/$(MODE)/ape/ape.macho.dbg

o/$(MODE)/ape/ape.elf.dbg: private \
LDFLAGS += \
-z common-page-size=0x10 \
-z max-page-size=0x10
APE_LOADER_LDFLAGS = \
-static \
-no-pie \
-nostdlib \
--no-dynamic-linker \
-zcommon-page-size=0x1000 \
-zmax-page-size=0x1000

o/$(MODE)/ape/ape.elf.dbg: \
o/$(MODE)/ape/loader.o \
o/$(MODE)/ape/loader-elf.o \
ape/loader.lds
@$(ELFLINK)
@$(COMPILE) -ALINK.elf $(LINK) -T ape/loader.lds $(APE_LOADER_LDFLAGS) -o $@ o/$(MODE)/ape/loader-elf.o o/$(MODE)/ape/loader.o

o/$(MODE)/ape/ape.macho.dbg: private \
LDFLAGS += \
-z common-page-size=0x10 \
-z max-page-size=0x10
o/$(MODE)/ape/ape.macho.dbg: \
o/$(MODE)/ape/loader-xnu.o \
o/$(MODE)/ape/loader-macho.o \
ape/loader.lds
@$(ELFLINK)
@$(COMPILE) -ALINK.elf $(LINK) -T ape/loader.lds $(APE_LOADER_LDFLAGS) -o $@ o/$(MODE)/ape/loader-macho.o o/$(MODE)/ape/loader-xnu.o

.PHONY: o/$(MODE)/ape
o/$(MODE)/ape: $(APE_CHECKS) \
Expand Down
9 changes: 2 additions & 7 deletions ape/apeinstall.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,8 @@ echo "Author: Justine Tunney <jtunney@gmail.com>" >&2
################################################################################
# INSTALL APE LOADER SYSTEMWIDE

if [ -f o/depend ]; then
# mkdeps.com build was successfully run so assume we can build
echo >&2
echo "recompiling ape loader" >&2
echo "running: make -j8 o//ape" >&2
make -j8 o//ape || exit
echo "done" >&2
if [ -f o/depend ] && make -j8 o//ape; then
echo "successfully recompiled ape loader" >&2
elif [ -d build/bootstrap ]; then
# if make isn't being used then it's unlikely the user changed the sources
# in that case the prebuilt binaries should be completely up-to-date
Expand Down
Loading

0 comments on commit 1ee2e89

Please sign in to comment.