SYSTRACE("_SysWrite(0x%x, 0x%x, %p\"%.*s\")", FD, Bytes, Src, Bytes, (char*)Src);
return _Syscall(SYS_WRITE, ">i >i >d", FD, Bytes, Bytes, Src);
}
+uint64_t acess__SysTruncate(int fd, uint64_t size) {
+ TODO();
+ return 0;
+}
int acess__SysSeek(int FD, int64_t Ofs, int Dir)
{
TODO();
return 0;
}
+void* acess__SysMMap(void *addr, size_t length, unsigned int _flags, int fd, uint64_t offset)
+{
+ TODO();
+ return NULL;
+}
+int acess__SysMUnMap(void *addr, size_t length)
+{
+ TODO();
+ return 0;
+}
+uint64_t acess__SysMarshalFD(int FD)
+{
+ TODO();
+ return 0;
+}
+int acess__SysUnMarshalFD(uint64_t Handle)
+{
+ TODO();
+ return -1;
+}
int acess__SysOpenChild(int fd, char *name, int flags) {
SYSTRACE("_SysOpenChild(0x%x, '%s', 0x%x)", fd, name, flags);
DEFSYM(_SysAllocate),
DEFSYM(_SysSetMemFlags),
DEFSYM(_SysDebug),
+ {"_ZN4_sys5debugEPKcz", &acess__SysDebug},
DEFSYM(_SysSetFaultHandler),
DEFSYM(_SysWaitEvent),
return &acess__errno;
}
+void _ZN4_sys5debugEPKcz(const char *fmt, ...) __attribute__((alias("acess__SysDebug")));
+
#undef acess__SysSpawn
int acess__SysSpawn(const char *binary, const char **argv, const char **envp, int nfd, int fds[], struct s_sys_spawninfo *info)
install-Filesystem: $(CC)
@$(SUBMAKE) install -C Usermode/Filesystem
+ifeq ($(ARCHDIR),native)
+.PHONY: $(CC)
+else
$(CC):
@echo ---
@echo $(CC) does not exist, recompiling
@echo ---
make -C Externals/cross-compiler/
+endif
endif
# Default compilers
+ifneq ($(ARCHDIR),native)
CC = $(COMPILERDIR)bin/$(TRIPLET)-gcc
CXX = $(COMPILERDIR)bin/$(TRIPLET)-g++
LD = $(COMPILERDIR)bin/$(TRIPLET)-ld
OBJDUMP = $(COMPILERDIR)bin/$(TRIPLET)-objdump
+endif
ifneq ($(ARCH),host)
ifneq ($(ARCHDIR),$(ARCH))
#CFLAGS += -Wall -Wextra -Wwrite-strings -Wshadow -Wswitch-default -Wswitch-enum -Wstrict-overflow=5 -Wfloat-equal -Wundef -Wmissing-declarations -Wlogical-op -Wformat=2 -Winit-self -Wmissing-include-dirs -Wswitch-default -Wswitch-enum -Wsync-nand -Wunused -Wstrict-overflow=5 -Wfloat-equal -Wundef -Wno-endif-labels -Wshadow -Wunsafe-loop-optimizations -Wbad-function-cast -Wc++-compat -Wcast-qual -Wcast-align -Wwrite-strings -Wconversion -Wlogical-op -Waggregate-return -Wstrict-prototypes -Wold-style-definition -Wmissing-declarations -Wnormalized=nfc -Wpacked -Wpadded -Wredundant-decls -Wnested-externs -Winline -Winvalid-pch -Wdisabled-optimization -Woverlength-strings
DIR = Bin
+
+# vim: ft=make
_LIBS := $(filter -l%,$(LIBS))
_LIBS := $(patsubst -l%,$(OUTPUTDIR)Libs/lib%.so,$(_LIBS))
+ifeq ($(ARCHDIR),native)
+ LDFLAGS := -L$(OUTPUTDIR)Libs/ $(subst -lc++ ,-lc++_acess ,$(LDFLAGS))
+ LIBS := $(subst -lc++ ,-lc++_acess ,$(LIBS))
+endif
ifeq ($(VERBOSE),)
V := @
else
_LIBS := $(filter -l%,$(LDFLAGS))
_LIBS := $(patsubst -l%,$(OUTPUTDIR)Libs/lib%.so,$(_LIBS))
+ifeq ($(ARCHDIR),native)
+ LIBS := $(patsubst -lc,-lc_acess,$(LIBS))
+ LIBS := $(patsubst -lc++,-lc++_acess,$(LIBS))
+ ifneq ($(BIN),libc_acess.so)
+ LIBS += -lc_acess
+ endif
+endif
+
OBJ := $(addprefix $(_OBJPREFIX),$(OBJ))
UTESTS := $(patsubst TEST_%.c,%,$(wildcard TEST_*.c))
@mkdir -p $(dir $@)
$(CC) $(CFLAGS) -c $< -o $@
-#$(OUTPUTDIR)Libs/crt0.o: obj-$(ARCH)/crt0_asm.o obj-$(ARCH)/crt0_c.o
-# @mkdir -p $(dir $@)
-# $(LD) -r -o $@ $?
-
-#obj-$(ARCH)/crt0_asm.o: crt0.$(ARCHDIR).$(ASSUFFIX)
-# @mkdir -p $(dir $@)
-# $(AS) $(ASFLAGS) $< -o $@
-
-#obj-$(ARCH)/crt0_c.o: crt0.c
-# @mkdir -p $(dir $@)
-# $(CC) -c $< -o $@
-
--- /dev/null
+.section .init
+.global _init
+.type _init, @function
+_init:
+ /* gcc will nicely put the contents of crtbegin.o's .init section here. */
+
+.section .fini
+.global _fini
+.type _fini, @function
+_fini:
+ /* gcc will nicely put the contents of crtbegin.o's .fini section here. */
--- /dev/null
+.section .init
+ /* gcc will nicely put the contents of crtend.o's .init section here. */
+
+.section .fini
+ /* gcc will nicely put the contents of crtend.o's .fini section here. */
#define _SysFDFlags acess__SysFDFlags
#define _SysClose acess__SysClose
#define _SysRead acess__SysRead
+#define _SysTruncate acess__SysTruncate
#define _SysWrite acess__SysWrite
#define _SysSeek acess__SysSeek
#define _SysTell acess__SysTell
#define _SysSelect acess__SysSelect
#define _SysMkDir acess__SysMkDir
#define _SysUnlink acess__SysUnlink
+#define _SysMMap acess__SysMMap
+#define _SysMUnMap acess__SysMUnMap
+#define _SysMarshalFD acess__SysMarshalFD
+#define _SysUnMarshalFD acess__SysUnMarshalFD
#define _errno acess__errno
extern int _SysMkDir(const char *dirname);
extern int _SysUnlink(const char *pathname);
extern void* _SysMMap(void *addr, size_t length, unsigned int _flags, int fd, uint64_t offset);
-#define _SysMMap(addr,length,flags,prot,fd,offset) _SysMMap(addr,length,(flags|(prot<<16)), fd, offset)
+#ifdef _SysMMap
+# undef _SysMMap
+# define _SysMMap(addr,length,flags,prot,fd,offset) acess__SysMMap(addr,length,(flags|(prot<<16)), fd, offset)
+#else
+# define _SysMMap(addr,length,flags,prot,fd,offset) _SysMMap(addr,length,(flags|(prot<<16)), fd, offset)
+#endif
extern int _SysMUnMap(void *addr, size_t length);
extern uint64_t _SysMarshalFD(int FD);
extern int _SysUnMarshalFD(uint64_t Handle);
CFLAGS += -Wextra
CXXFLAGS +=
ASFLAGS +=
-LDFLAGS += -soname libaxwin4.so -Map map.txt -lc -lc++
+LDFLAGS += -soname libaxwin4.so -Map map.txt
+LIBS += -lc -lc++
OBJ = main.o ipc.o ipc_acessipcpipe.o
OBJ += wm.o window_drawing.o
OBJ += string.o mutex.o\r
OBJ += exceptions.o exception_handling.o system_error.o\r
OBJ += gxx_personality.o\r
+ifeq ($(ARCHDIR),native)\r
+# - Include libgcc_eh (separate in linux), and the linux libc (space avoids hack in Makefile.tpl)\r
+LIBS += -lgcc_eh -l c\r
+endif\r
DEPFILES := $(OBJ:%.o=%.d)\r
BIN = libc++.so\r
ifeq ($(ARCHDIR),native)\r
default:
::_SysDebug("_get_base: Unknown encoding relativity 0x%x", (encoding & DW_EH_PE_relmask));
::abort();
+ for(;;);
}
}
static uint64_t _read_encoded(const void *&ptr, _Unwind_Context *context, int encoding)
// Multiple inheritance
_SysDebug("TODO: type_info::__is_child - Multiple inheritance");
abort();
+ for(;;);
}
else {
// Oops!
typeid(poss_child).name()
);
abort();
+ for(;;);
}
}
DEPFILES := $(OBJ:%.o=%.d)\r
BIN = libc.so\r
ifeq ($(ARCHDIR),native)\r
- OBJ := $(filter-out heap.o,$(OBJ))\r
+ OBJ := $(filter-out heap.o,$(OBJ)) heap_native.o\r
#LDFLAGS += -l c\r
BIN = libc_acess.so\r
endif\r
}\r
}\r
\r
-bool _libc_free(void *mem)\r
+// Exported for libc++\r
+EXPORT bool _libc_free(void *mem)\r
{\r
heap_head *head = (heap_head*)mem - 1;\r
\r
--- /dev/null
+#include <stdlib.h>
+#include <stdbool.h>
+
+bool _libc_free(void *addr)
+{
+ free(addr);
+ return true;
+}
*/
#include <unistd.h> // mktemp
#include <stdlib.h> // mkstemp
+#include <stdio.h>
#include <string.h> // str*
#include <errno.h>
for( int i = 0; i < 1000000; i ++ )
{
- sprintf(template+tpl_len-6, "%06d", i);
+ snprintf(template+tpl_len-6, 6+1, "%06d", i);
int fd = open(template, O_EXCL|O_CREAT, 0600);
if(fd == -1) continue ;