Make build hermetic without shell scripts

- Fix some minor issues in ar.com
- Have execve() look for `ape` command
- Rewrite NT paths using /c/ rather /??/c:/
- Replace broken GCC symlinks with .sym files
- Rewrite $PATH environment variables on startup
- Make $(APE_NO_MODIFY_SELF) the default bootloader
- Add all build command dependencies to build/bootstrap
- Get the repository mostly building from source on non-Linux
This commit is contained in:
Justine Tunney 2022-05-25 11:31:08 -07:00
parent d44ff6ce1f
commit d230a01222
160 changed files with 2754 additions and 1342 deletions

View file

@ -80,7 +80,7 @@ static void chibicc_usage(int status) {
char *p;
size_t n;
p = xslurp("/zip/third_party/chibicc/help.txt", &n);
xwrite(1, p, n);
__paginate(1, p);
_Exit(status);
}
@ -447,7 +447,8 @@ static bool run_subprocess(char **argv) {
_Exit(1);
}
// Wait for the child process to finish.
do rc = wait(&ws);
do
rc = wait(&ws);
while (rc == -1 && errno == EINTR);
return WIFEXITED(ws) && WEXITSTATUS(ws) == 0;
}

View file

@ -93,7 +93,7 @@ $(THIRD_PARTY_CHIBICC2_A).pkg: \
o/$(MODE)/third_party/chibicc/chibicc.com.dbg: \
$(THIRD_PARTY_CHIBICC_A_DEPS) \
$(THIRD_PARTY_CHIBICC_A) \
$(APE) \
$(APE_NO_MODIFY_SELF) \
$(CRT) \
o/$(MODE)/third_party/chibicc/help.txt.zip.o \
o/$(MODE)/third_party/chibicc/chibicc.main.o \
@ -102,7 +102,7 @@ o/$(MODE)/third_party/chibicc/chibicc.com.dbg: \
o/$(MODE)/third_party/chibicc/chibicc2.com.dbg: \
$(THIRD_PARTY_CHIBICC_A_DEPS) \
$(THIRD_PARTY_CHIBICC2_A) \
$(APE) \
$(APE_NO_MODIFY_SELF) \
$(CRT) \
o/$(MODE)/third_party/chibicc/help.txt.zip.o \
o/$(MODE)/third_party/chibicc/chibicc.main.chibicc.o \
@ -122,7 +122,7 @@ o/$(MODE)/third_party/chibicc/chibicc.com: \
o/$(MODE)/third_party/chibicc/as.com.dbg: \
$(THIRD_PARTY_CHIBICC_A_DEPS) \
$(THIRD_PARTY_CHIBICC_A) \
$(APE) \
$(APE_NO_MODIFY_SELF) \
$(CRT) \
o/$(MODE)/third_party/chibicc/as.main.o \
$(THIRD_PARTY_CHIBICC_A).pkg

View file

@ -259,6 +259,15 @@ BUILTIN FUNCTIONS
double __builtin_copysign(double, double)
float __builtin_copysignf(float, float)
long double __builtin_copysignl(long double, long double)
void __builtin_ia32_movntq(di *, di)
int __builtin_ia32_pmovmskb128(v16qi)
T __atomic_load(T *addr, int memorder)
void __atomic_clear(_Bool *addr, int memorder)
_Bool __atomic_test_and_set(void *addr, int memorder)
T __atomic_sub_fetch(T *addr, T amt, int memorder)
T __atomic_fetch_add(T *addr, T amt, int memorder)
T __sync_lock_test_and_set(T *addr, T value, ...)
void __sync_lock_release(T *addr, ...)
BUILTIN OBJECTS

View file

@ -79,7 +79,7 @@ o/$(MODE)/third_party/chibicc/test/%.com.dbg: \
o/$(MODE)/third_party/chibicc/test/%.chibicc.o \
$(THIRD_PARTY_CHIBICC_TEST_A).pkg \
$(CRT) \
$(APE)
$(APE_NO_MODIFY_SELF)
@$(APELINK)
o/$(MODE)/third_party/chibicc/test/%2.com.dbg: \
@ -88,7 +88,7 @@ o/$(MODE)/third_party/chibicc/test/%2.com.dbg: \
o/$(MODE)/third_party/chibicc/test/%.chibicc2.o \
$(THIRD_PARTY_CHIBICC_TEST2_A).pkg \
$(CRT) \
$(APE)
$(APE_NO_MODIFY_SELF)
@$(APELINK)
.PRECIOUS: $(THIRD_PARTY_CHIBICC_TEST_OBJS)