diff --git a/libc/crt/crt.S b/libc/crt/crt.S index c8cd21383..baa5d419a 100644 --- a/libc/crt/crt.S +++ b/libc/crt/crt.S @@ -62,6 +62,8 @@ _start: // set operating system when already detected 1: mov %cl,__hostos(%rip) + mov %r8,__program_executable_name(%rip) + // get startup timestamp as early as possible // its used by --strace flag and kprintf() %T rdtsc diff --git a/libc/nexgen32e/program_executable_name.S b/libc/nexgen32e/program_executable_name.S deleted file mode 100644 index 8d88cc1f1..000000000 --- a/libc/nexgen32e/program_executable_name.S +++ /dev/null @@ -1,32 +0,0 @@ -/*-*- mode:unix-assembly; indent-tabs-mode:t; tab-width:8; coding:utf-8 -*-│ -│ vi: set noet ft=asm ts=8 sw=8 fenc=utf-8 :vi │ -╞══════════════════════════════════════════════════════════════════════════════╡ -│ Copyright 2023 Justine Alexandra Roberts Tunney │ -│ │ -│ Permission to use, copy, modify, and/or distribute this software for │ -│ any purpose with or without fee is hereby granted, provided that the │ -│ above copyright notice and this permission notice appear in all copies. │ -│ │ -│ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL │ -│ WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED │ -│ WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE │ -│ AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL │ -│ DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR │ -│ PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER │ -│ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │ -│ PERFORMANCE OF THIS SOFTWARE. │ -╚─────────────────────────────────────────────────────────────────────────────*/ -#include "libc/macros.internal.h" -#include "libc/notice.inc" - - .initbss 300,_init_program_executable_name -// Global variable holding the binary that we are running as -__program_executable_name: - .quad 0 - .endobj __program_executable_name,globl - .previous - - .init.start 300,_init_program_executable_name - mov %r8,%rax - stosq - .init.end 300,_init_program_executable_name diff --git a/libc/nexgen32e/program_executable_name2.c b/libc/nexgen32e/program_executable_name.c similarity index 97% rename from libc/nexgen32e/program_executable_name2.c rename to libc/nexgen32e/program_executable_name.c index 4186c825d..bbc9a1183 100644 --- a/libc/nexgen32e/program_executable_name2.c +++ b/libc/nexgen32e/program_executable_name.c @@ -17,8 +17,5 @@ │ PERFORMANCE OF THIS SOFTWARE. │ ╚─────────────────────────────────────────────────────────────────────────────*/ #include "libc/runtime/runtime.h" -#ifndef __x86_64__ char *__program_executable_name; - -#endif /* __x86_64__ */