diff --git a/Makefile b/Makefile index 1ab2b30..d652355 100644 --- a/Makefile +++ b/Makefile @@ -54,7 +54,6 @@ (cd src/lib/libc;make clean) (cd src/bin;make clean) (cd src/lib/ubix;make clean) - (cd src/lib/objgfx40;make clean) (cd src/lib/libcpp;make clean) (cd src/lib/views/sunlight;make clean) (cd src/lib/libstdc++;make clean) diff --git a/src/bin/cat/cat b/src/bin/cat/cat index 0251360..bf8b937 100755 --- a/src/bin/cat/cat +++ b/src/bin/cat/cat Binary files differ diff --git a/src/bin/edit/Makefile b/src/bin/edit/Makefile index 9ad8dfb..61736ff 100644 --- a/src/bin/edit/Makefile +++ b/src/bin/edit/Makefile @@ -36,7 +36,7 @@ $(CXX) -Wall -O $(CFLAGS) $(INCLUDES) -S -o $@ $< .c.o: - $(CC) -Wall -O $(CFLAGS) $(INCLUDES) -c -o $@ $< + $(CC) -Wall -O -ggdb $(CFLAGS) $(INCLUDES) -c -o $@ $< .c.s: $(CC) -Wall -O $(CFLAGS) $(INCLUDES) -S -o $@ $< diff --git a/src/bin/edit/main.c b/src/bin/edit/main.c index b1c9d47..d844a67 100644 --- a/src/bin/edit/main.c +++ b/src/bin/edit/main.c @@ -31,8 +31,9 @@ #include int main(int argc,char **argv) { - extern char *environ; + extern char **environ; FILE *out; + int offset; printf("UbixOS Text Editor\n"); printf("V1.0\n"); #ifdef DEBUG @@ -48,9 +49,12 @@ } //printf("[%S]",getenv("TEST")); - printf("\nENV TEST: [0x%X]\n",environ); + printf("\nENV TEST: [0x%X:0x%X]\n",&environ,offset); + __findenv("TEST",&offset); + printf("\nENV TEST: [0x%X:0x%X]\n",environ,offset); setenv("BLAH","WOOT",1); printf("[%s]",getenv("BLAH")); + __findenv("TEST",&offset); return(0); } diff --git a/src/bin/ld/addlibrary.c b/src/bin/ld/addlibrary.c index bda4116..53c359d 100644 --- a/src/bin/ld/addlibrary.c +++ b/src/bin/ld/addlibrary.c @@ -27,7 +27,7 @@ //if ((tmpLib->output = (char *)malloc((linkerFd->size+0x4000))) == 0x0) { //if ((tmpLib->output = (char *)malloc(0x111000)) == 0x0) { //HELP - if ((tmpLib->output = (char *)getPage((0x110000/0x1000),2)) == 0x0) { + if ((tmpLib->output = (char *)getPage((0x10F000/0x1000),2)) == 0x0) { printf("malloc failed: tmpLib->output\n"); exit(0x1); } @@ -116,7 +116,6 @@ switch (ELF32_R_TYPE(tmpLib->linkerElfRel[x].pltInfo)) { case R_386_32: *reMap += ((uInt32)tmpLib->output + tmpLib->linkerRelSymTab[rel].dynValue); - //printf("[0x%X]",*reMap); break; case R_386_PC32: *reMap += ((uInt32)tmpLib->output + tmpLib->linkerRelSymTab[rel].dynValue) - (uInt32)reMap; @@ -125,8 +124,9 @@ *reMap += (uInt32)tmpLib->output; break; case R_386_JMP_SLOT: + *reMap = ((uInt32)tmpLib->output + tmpLib->linkerRelSymTab[rel].dynValue); //*reMap += (uInt32)tmpLib->output; - //break; + break; case R_386_GLOB_DAT: *reMap = ((uInt32)tmpLib->output + tmpLib->linkerRelSymTab[rel].dynValue); break; diff --git a/src/bin/rtld-elf/Makefile b/src/bin/rtld-elf/Makefile index 5c97230..d4624c3 100644 --- a/src/bin/rtld-elf/Makefile +++ b/src/bin/rtld-elf/Makefile @@ -7,7 +7,7 @@ INCLUDES = -I../../include.new -I./ -CFLAGS+= -Wall -DFREEBSD_ELF -DIN_RTLD -DPIC +CFLAGS+= -Wall -DFREEBSD_ELF -DIN_RTLD -DPIC CFLAGS = -O2 -fno-strict-aliasing -pipe -Wall -DFREEBSD_ELF -DIN_RTLD -I./ -fpic -elf -DPIC -std=gnu99 -Wformat=2 -Wno-format-extra-args -Werror -DDEBUG @@ -45,7 +45,7 @@ $(CXX) -Wall -O $(CFLAGS) $(INCLUDES) -S -o $@ $< .c.o: - $(CC) -Wall -O $(CFLAGS) $(INCLUDES) -c -o $@ $< + $(CC) $(CFLAGS) $(INCLUDES) -c -o $@ $< .c.s: $(CC) -Wall -O $(CFLAGS) $(INCLUDES) -S -o $@ $< diff --git a/src/bin/rtld-elf/rtld.c b/src/bin/rtld-elf/rtld.c index 7281c04..81d5268 100644 --- a/src/bin/rtld-elf/rtld.c +++ b/src/bin/rtld-elf/rtld.c @@ -261,7 +261,6 @@ * init_rtld has returned. It is OK to reference file-scope statics * and string constants, and to call static and global functions. */ - /* Find the auxiliary vector on the stack. */ argc = *sp++; argv = (char **) sp; @@ -274,6 +273,7 @@ aux = (Elf_Auxinfo *) sp; + /* Digest the auxiliary vector. */ for (i = 0; i < AT_COUNT; i++) aux_info[i] = NULL; @@ -1066,12 +1066,16 @@ #ifdef PIC objtmp.relocbase = mapbase; #endif +debug = 1; +while (1); +dbg("SDF"); if (RTLD_IS_DYNAMIC()) { objtmp.dynamic = rtld_dynamic(&objtmp); digest_dynamic(&objtmp, 1); assert(objtmp.needed == NULL); assert(!objtmp.textrel); +while (1); /* * Temporarily put the dynamic linker entry into the object list, so * that symbols can be found. diff --git a/src/lib/csu/crt1.c b/src/lib/csu/crt1.c index 6cdb2a8..bd978d3 100644 --- a/src/lib/csu/crt1.c +++ b/src/lib/csu/crt1.c @@ -85,7 +85,7 @@ argv = ≈ argc = *(long *)(void *)(argv - 1); env = argv + argc + 1; - environ = env; + environ = 0x0;//env; if (argc > 0 && argv[0] != NULL) { __progname = argv[0]; diff --git a/src/lib/libc/Makefile b/src/lib/libc/Makefile index 7c0153f..ee3758b 100644 --- a/src/lib/libc/Makefile +++ b/src/lib/libc/Makefile @@ -49,6 +49,34 @@ $(CC) -nostdlib -shared -Wl,-soname,libc.so -o $(OUTPUT) $(OBJS) $(SUBS) pic.a: $(OBJS) + (make clean) + (cd yp;make PICA=true) + (cd xdr;make PICA=true) + (cd uuid;make PICA=true) + (cd uthread;make PICA=true) + (cd sys;make PICA=true) + (cd string;make PICA=true) + (cd stdtime;make PICA=true) + (cd stdlib;make PICA=true) + (cd stdio;make PICA=true) + (cd rpc;make PICA=true) + (cd resolv;make PICA=true) + (cd regex;make PICA=true) + (cd quad;make PICA=true) + (cd posix1e;make PICA=true) + (cd nls;make PICA=true) + (cd net;make) + (cd nameser;make) + (cd locale;make) + (cd isc;make) + (cd inet;make) + (cd i386;make) + (cd gmon;make) + (cd gen;make) + (cd gdtoa;make) + (cd db;make) + (cd compat-43;make) +pic_a: $(OBJS) $(AR) cq $(LPIC) $(OBJS) $(SUBS) ranlib $(LPIC) diff --git a/src/lib/libc/gen/Makefile b/src/lib/libc/gen/Makefile index 9140bba..336f58a 100644 --- a/src/lib/libc/gen/Makefile +++ b/src/lib/libc/gen/Makefile @@ -2,9 +2,10 @@ # The System Makefile (C) 2002 The UbixOS Project # Include Global 'Source' Options -include ../../../Makefile.inc -include ../../Makefile.inc -include ../Makefile.inc +#include ../../../Makefile.inc +#include ../../Makefile.inc +#include ../Makefile.inc +include ../libc.inc INCLUDES += -I../locale/ -I../i386 @@ -21,7 +22,7 @@ $(CXX) $(CFLAGS) -Wall -nostdlib -O $(INCLUDES) -S -o $@ $< .c.o: - $(CC) $(CFLAGS) -Wall -nostdlib -O $(INCLUDES) -c $< + $(CC) $(CFLAGS) $(INCLUDES) -c $< .c.s: $(CC) $(CFLAGS) -Wall -nostdlib -O $(INCLUDES) -S -o $@ $< diff --git a/src/lib/libc/i386/string/Makefile b/src/lib/libc/i386/string/Makefile index 34d4807..1040c3e 100644 --- a/src/lib/libc/i386/string/Makefile +++ b/src/lib/libc/i386/string/Makefile @@ -8,6 +8,8 @@ INCLUDES += -I../ +CFLAGS += -fpic -DPIC + #Objects OBJS = bcmp.o bcopy.o bzero.o ffs.o index.o memchr.o memcmp.o memcpy.o memmove.o memset.o rindex.o strcat.o strchr.o strcmp.o strcpy.o strlen.o strncmp.o strrchr.o swab.o wcschr.o wcscmp.o wcslen.o wmemchr.o diff --git a/src/lib/libc/libc.inc b/src/lib/libc/libc.inc index 76298d3..2ae059f 100644 --- a/src/lib/libc/libc.inc +++ b/src/lib/libc/libc.inc @@ -2,8 +2,13 @@ REMOVE = rm -fr -CFLAGS = -fpic -DPIC -O2 -fno-strict-aliasing -pipe -D__DBINTERFACE_PRIVATE -DINET6 -DPOSIX_MISTAKE -DBROKEN_DES -DPORTMAP -DDES_BUILTIN -DYP -DHESIOD -Wsystem-headers -Werror -Wall -Wno-format-y2k -Wno-uninitialized -nostdinc -nostdlib #-fpic - +.if defined(PICA) +CFLAGS = -O2 -fno-strict-aliasing -pipe -D__DBINTERFACE_PRIVATE -DINET6 -DPOSIX_MISTAKE -DBROKEN_DES -DPORTMAP -DDES_BUILTIN -DYP -DHESIOD -Wsystem-headers -Werror -Wall -Wno-format-y2k -Wno-uninitialized -nostdinc -nostdlib #-fpic -DPIC +CFLAGS_UTHREAD = -DPIC -O2 -fno-strict-aliasing -pipe -DPTHREAD_KERNEL -D_LOCK_DEBUG -D_PTHREADS_INVARIANTS +.else +CFLAGS = -fpic -DPIC -O2 -fno-strict-aliasing -pipe -D__DBINTERFACE_PRIVATE -DINET6 -DPOSIX_MISTAKE -DBROKEN_DES -DPORTMAP -DDES_BUILTIN -DYP -DHESIOD -Wsystem-headers -Werror -Wall -Wno-format-y2k -Wno-uninitialized -nostdinc -nostdlib #-fpic -DPIC +CFLAGS_UTHREAD = -fpic -DPIC -O2 -fno-strict-aliasing -pipe -DPTHREAD_KERNEL -D_LOCK_DEBUG -D_PTHREADS_INVARIANTS +.endif INCLUDES = -I/usr/home/reddawg/source/ubix2/src/include.new -I/usr/home/reddawg/source/ubix2/src/lib/libc/include -I/home/reddawg/source/ubix2/src/lib/libc/i386 -I/home/reddawg/source/ubix2/src/contrib/gdtoa -I/home/reddawg/source/ubix2/src/lib/libc -I/home/reddawg/source/ubix2/src/lib/libc/resolv -I/home/reddawg/source/ubix2/src/lib/libc/locale -I/home/reddawg/source/ubix2/src/lib/libc/rpc diff --git a/src/lib/libc/stdlib/getenv.c b/src/lib/libc/stdlib/getenv.c index d1230d1..104992d 100644 --- a/src/lib/libc/stdlib/getenv.c +++ b/src/lib/libc/stdlib/getenv.c @@ -37,6 +37,10 @@ #include __FBSDID("$FreeBSD: src/lib/libc/stdlib/getenv.c,v 1.4 2002/03/21 22:48:41 obrien Exp $"); +//TMP +#include + + #include #include #include @@ -52,6 +56,7 @@ * * This routine *should* be a static; don't use it. */ + inline char * __findenv(name, offset) const char *name; @@ -64,6 +69,7 @@ char **p, *cp; /* HACK */ + *offset = (int)environ; return(0x0); if (name == NULL || environ == NULL) diff --git a/src/lib/libc/string/Makefile b/src/lib/libc/string/Makefile index 9086e28..e6e6590 100644 --- a/src/lib/libc/string/Makefile +++ b/src/lib/libc/string/Makefile @@ -2,9 +2,10 @@ # The System Makefile (C) 2002 The UbixOS Project # Include Global 'Source' Options -include ../../../Makefile.inc -include ../../Makefile.inc -include ../Makefile.inc +#include ../../../Makefile.inc +#include ../../Makefile.inc +#include ../Makefile.inc +include ../libc.inc INCLUDES += -I../locale/ @@ -21,7 +22,7 @@ $(CXX) $(CFLAGS) -Wall -nostdlib -O $(INCLUDES) -S -o $@ $< .c.o: - $(CC) $(CFLAGS) -Wall -nostdlib -O $(INCLUDES) -c $< + $(CC) $(CFLAGS) $(INCLUDES) -c $< .c.s: $(CC) $(CFLAGS) -Wall -nostdlib -O $(INCLUDES) -S -o $@ $< diff --git a/src/lib/libc/uthread/Makefile b/src/lib/libc/uthread/Makefile index c3cec82..ac97f32 100644 --- a/src/lib/libc/uthread/Makefile +++ b/src/lib/libc/uthread/Makefile @@ -7,8 +7,7 @@ #include ../Makefile.inc include ../libc.inc -CFLAGS = -fpic -DPIC -O2 -fno-strict-aliasing -pipe -DPTHREAD_KERNEL -D_LOCK_DEBUG -D_PTHREADS_INVARIANTS - +CFLAGS = $(CFLAGS_UTHREAD) INCLUDES += -I../locale/ -I.