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

@ -16,6 +16,7 @@
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
*/
#include "libc/dce.h"
#include "libc/macros.internal.h"
// Obtains WIN32 magic path, e.g. GetTempPathA.
@ -33,7 +34,13 @@ __getntsyspath:
movpp %rdi,%rcx # call f=%rax(p1=%rcx,p2=%rdx)
sub $40,%rsp
call *%rax
xor %edx,%edx
testb IsWindows()
jz 3f
mov (%rdi),%cl # turn c:\... into \c\...
movb $'\\',(%rdi)
mov %cl,1(%rdi)
movb $'\\',2(%rdi)
3: xor %edx,%edx
mov -8(%rbp),%ecx # restore %edx param as %ecx
cmp %eax,%ecx # use current dir on overflow
cmovbe %edx,%eax