Get LIBC_TESTLIB building on AARCH64

This commit is contained in:
Justine Tunney 2023-05-11 19:56:33 -07:00
parent 95fab334e4
commit 5e2f7f7ced
No known key found for this signature in database
GPG key ID: BE714B4575D6E328
46 changed files with 975 additions and 1174 deletions

View file

@ -40,8 +40,6 @@ getopt (BSD-3)\\n\
Copyright 1987, 1993, 1994 The Regents of the University of California\"");
asm(".include \"libc/disclaimer.inc\"");
STATIC_YOINK("_init_getopt");
#define BADCH (int)'?'
#define BADARG (int)':'
@ -75,8 +73,8 @@ int optreset;
*/
char *optarg;
_Hide char *getopt_place;
_Hide char kGetoptEmsg[1];
char *getopt_place;
static char kGetoptEmsg[1];
static void getopt_print_badch(const char *s) {
char b1[512];
@ -117,6 +115,13 @@ static void getopt_print_badch(const char *s) {
*/
int getopt(int nargc, char *const nargv[], const char *ostr) {
char *oli; /* option letter list index */
static bool once;
if (!once) {
opterr = 1;
optind = 1;
getopt_place = kGetoptEmsg;
once = true;
}
/*
* Some programs like cvs expect optind = 0 to trigger
* a reset of getopt.

View file

@ -8,16 +8,8 @@ THIRD_PARTY_GETOPT = $(THIRD_PARTY_GETOPT_A_DEPS) $(THIRD_PARTY_GETOPT_A)
THIRD_PARTY_GETOPT_A = o/$(MODE)/third_party/getopt/getopt.a
THIRD_PARTY_GETOPT_A_FILES := $(wildcard third_party/getopt/*)
THIRD_PARTY_GETOPT_A_HDRS = $(filter %.h,$(THIRD_PARTY_GETOPT_A_FILES))
THIRD_PARTY_GETOPT_A_SRCS_S = $(filter %.S,$(THIRD_PARTY_GETOPT_A_FILES))
THIRD_PARTY_GETOPT_A_SRCS_C = $(filter %.c,$(THIRD_PARTY_GETOPT_A_FILES))
THIRD_PARTY_GETOPT_A_SRCS = \
$(THIRD_PARTY_GETOPT_A_SRCS_S) \
$(THIRD_PARTY_GETOPT_A_SRCS_C)
THIRD_PARTY_GETOPT_A_OBJS = \
$(THIRD_PARTY_GETOPT_A_SRCS_S:%.S=o/$(MODE)/%.o) \
$(THIRD_PARTY_GETOPT_A_SRCS_C:%.c=o/$(MODE)/%.o)
THIRD_PARTY_GETOPT_A_SRCS = $(filter %.c,$(THIRD_PARTY_GETOPT_A_FILES))
THIRD_PARTY_GETOPT_A_OBJS = $(THIRD_PARTY_GETOPT_A_SRCS:%.c=o/$(MODE)/%.o)
THIRD_PARTY_GETOPT_A_CHECKS = \
$(THIRD_PARTY_GETOPT_A).pkg \

View file

@ -1,27 +0,0 @@
/*-*- mode:asm; indent-tabs-mode:t; tab-width:8; coding:utf-8 -*-│
vi: set et ft=asm ts=8 tw=8 fenc=utf-8 :vi
Copyright 2020 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"
.init.start 201,_init_getopt
push $1
pop %rax
mov %eax,opterr(%rip)
mov %eax,optind(%rip)
movl $kGetoptEmsg,getopt_place(%rip)
.init.end 201,_init_getopt