From: John Hodge Date: Sun, 3 Mar 2013 11:51:39 +0000 (+0800) Subject: Externals/cross-compiler - Patching to get things compiling X-Git-Tag: rel0.15~545 X-Git-Url: https://git.ucc.asn.au/?a=commitdiff_plain;h=bdefac5f54668fcccff11a69619ff31b25595eeb;p=tpg%2Facess2.git Externals/cross-compiler - Patching to get things compiling - Needed to fix up stdio.h and a couple of other headers --- diff --git a/Externals/cross-compiler/Makefile b/Externals/cross-compiler/Makefile index 0326b449..60c94d28 100644 --- a/Externals/cross-compiler/Makefile +++ b/Externals/cross-compiler/Makefile @@ -9,10 +9,17 @@ BINUTILS_DIR:=$(BINUTILS_ARCHIVE:%.tar.bz2=%) BINUTILS_CHANGES := config.sub bfd/config.bfd gas/configure.tgt ld/configure.tgt ld/emulparams/acess2_i386.sh ld/Makefile.in GCC_CHANGES := config.sub gcc/config.gcc gcc/config/acess2.h libgcc/config.host -ARCH?=i586 -PARLEVEL ?= 3 +ifeq ($(ARCH),x86) + BFDARCH:=i586 +else ifeq ($(ARCH),x86_64) + BFDARCH:=x86_64 +else + $(error Arch $(ARCH) is not supported by magic gcc makfile) +endif -TARGET=$(ARCH)-pc-acess2 +PARLEVEL ?= 1 + +TARGET=$(BFDARCH)-pc-acess2 PREFIX=$(shell pwd)/cross .PHONY: all clean binutils gcc include @@ -23,13 +30,14 @@ include: mkdir -p $(PREFIX) rm -r $(PREFIX)/include ln -s $(ACESSDIR)/Usermode/include $(PREFIX)/include + cd $(PREFIX) && (test \! -e usr && ln -s . usr); true gcc: $(GCC_DIR) $(PREFIX)/bin/$(TARGET)-gcc binutils: $(BINUTILS_DIR) $(PREFIX)/bin/$(TARGET)-ld clean: - $(RM) -rf $(BINUTILS_DIR) build-*-$(ARCH) + $(RM) -rf $(BINUTILS_DIR) $(GCC_DIR) build-$(ARCH) $(BINUTILS_DIR) $(GCC_DIR): %: %.tar.bz2 tar -xf $< @@ -51,14 +59,21 @@ $(BINUTILS_DIR)/%: patches/binutils/% @echo [CP] $@ @cp $< $@ -$(PREFIX)/bin/$(TARGET)-ld: $(addprefix $(BINUTILS_DIR)/,$(BINUTILS_CHANGES)) - @mkdir -p build-binutils-$(ARCH) - @cd build-binutils-$(ARCH) && ../$(BINUTILS_DIR)/configure --target=$(TARGET) --prefix=$(PREFIX) --disable-nls - @cd build-binutils-$(ARCH) && make all install -j $(PARLEVEL) +BDIR_GCC := build-$(ARCH)/gcc +BDIR_BINUTILS := build-$(ARCH)/binutils + +$(BDIR_BINUTILS)/Makefile: $(addprefix $(BINUTILS_DIR)/,$(BINUTILS_CHANGES)) + @mkdir -p $(BDIR_BINUTILS) + @cd $(BDIR_BINUTILS) && ../../$(BINUTILS_DIR)/configure --target=$(TARGET) --prefix=$(PREFIX) --disable-nls + +$(PREFIX)/bin/$(TARGET)-ld: $(BDIR_BINUTILS)/Makefile + @cd $(BDIR_BINUTILS) && make all install -j $(PARLEVEL) + +$(BDIR_GCC)/Makefile: Makefile $(addprefix $(GCC_DIR)/,$(GCC_CHANGES)) + @mkdir -p $(BDIR_GCC) + @cd $(BDIR_GCC) && PATH=$(PREFIX)/bin:$$PATH ../../$(GCC_DIR)/configure --target=$(TARGET) --prefix=$(PREFIX) --disable-nls --enable-langs=c,c++ --includedir=$(ACESSDIR)/Usermode/include --libdir=$(ACESSDIR)/Usermode/Output/$(ARCH)/Lib "--with-sysroot=$(PREFIX)" -$(PREFIX)/bin/$(TARGET)-gcc: $(addprefix $(GCC_DIR)/,$(GCC_CHANGES)) - @mkdir -p build-gcc-$(ARCH) - cd build-gcc-$(ARCH) && PATH=$(PREFIX)/bin:$$PATH ../$(GCC_DIR)/configure --target=$(TARGET) --prefix=$(PREFIX) --disable-nls --enable-langs=c,c++ --includedir=$(ACESSDIR)/Usermode/include --libdir=$(ACESSDIR)/Usermode/Output/$(ARCH)/Lib - @cd build-gcc-$(ARCH) && PATH=$(PREFIX)/bin:$$PATH make all-gcc all-target-libgcc install-gcc install-target-libgcc -j $(PARLEVEL) +$(PREFIX)/bin/$(TARGET)-gcc: $(BDIR_GCC)/Makefile + @cd $(BDIR_GCC) && PATH=$(PREFIX)/bin:$$PATH make all-gcc all-target-libgcc install-gcc install-target-libgcc -j $(PARLEVEL) diff --git a/Externals/cross-compiler/patches/gcc/gcc/config.gcc.patch b/Externals/cross-compiler/patches/gcc/gcc/config.gcc.patch index c304125d..833fafa4 100644 --- a/Externals/cross-compiler/patches/gcc/gcc/config.gcc.patch +++ b/Externals/cross-compiler/patches/gcc/gcc/config.gcc.patch @@ -1,6 +1,6 @@ --- gcc/config.gcc +++ gcc/config.gcc -@@ -519,3 +519,9 @@ +@@ -519,3 +519,10 @@ # Common parts for widely ported systems. case ${target} in +*-*-acess2*) @@ -8,6 +8,7 @@ + gas=yes + gnu_ld=yes + default_use_cxa_atexit=yes ++ use_gcc_stdint=provide + ;; *-*-darwin*) diff --git a/Usermode/Applications/telnet_src/main.c b/Usermode/Applications/telnet_src/main.c index 708935d1..2658548e 100644 --- a/Usermode/Applications/telnet_src/main.c +++ b/Usermode/Applications/telnet_src/main.c @@ -3,6 +3,7 @@ */ #include #include +#include #include #include #include diff --git a/Usermode/Applications/telnetd_src/main.c b/Usermode/Applications/telnetd_src/main.c index bf6de999..16dac830 100644 --- a/Usermode/Applications/telnetd_src/main.c +++ b/Usermode/Applications/telnetd_src/main.c @@ -8,6 +8,7 @@ #include #include #include +#include #include // === TYPES === diff --git a/Usermode/Libraries/Makefile.tpl b/Usermode/Libraries/Makefile.tpl index c18d04f7..bc5edf8e 100644 --- a/Usermode/Libraries/Makefile.tpl +++ b/Usermode/Libraries/Makefile.tpl @@ -17,7 +17,17 @@ DEPFILES := $(addsuffix .dep,$(OBJ)) .PHONY: all clean install postbuild -all: $(_BIN) $(_XBIN) +all: _libs $(_BIN) $(_XBIN) + +.PHONY: _libs + + +HEADERS := $(patsubst include_exp/%,../../include/%,$(shell find include_exp/ -name \*.h)) +_libs: $(HEADERS) + +../../include/%: include_exp/% + @mkdir -p $(dir $@) + @ln -s $(shell pwd)/$< $@ .PHONY: utest utest-build utest-run $(UTESTS:%=runtest-%) diff --git a/Usermode/Libraries/libc.so_src/include_exp/assert.h b/Usermode/Libraries/libc.so_src/include_exp/assert.h index 07b20b3a..060f10ad 100644 --- a/Usermode/Libraries/libc.so_src/include_exp/assert.h +++ b/Usermode/Libraries/libc.so_src/include_exp/assert.h @@ -8,6 +8,8 @@ #ifndef _LIBC__ASSERT_H_ #define _LIBC__ASSERT_H_ +extern void exit(int status); + #ifdef NDEBUG # define assert(expr) do{}while(0) #else diff --git a/Usermode/Libraries/libc.so_src/include_exp/stdio.h b/Usermode/Libraries/libc.so_src/include_exp/stdio.h index 4a81c18b..074cd254 100644 --- a/Usermode/Libraries/libc.so_src/include_exp/stdio.h +++ b/Usermode/Libraries/libc.so_src/include_exp/stdio.h @@ -5,8 +5,9 @@ #ifndef __STDIO_H #define __STDIO_H -#include +#include #include +#include // size_t /* === Types === */ typedef struct sFILE FILE; @@ -15,6 +16,12 @@ typedef struct sFILE FILE; #define EOF (-1) #define BUFSIZ 1024 +#ifndef SEEK_CUR +#define SEEK_CUR 1 +#define SEEK_SET 0 +#define SEEK_END (-1) +#endif + /* --- Standard IO --- */ extern int printf(const char *format, ...); extern int vsnprintf(char *buf, size_t __maxlen, const char *format, va_list args); diff --git a/Usermode/Libraries/libc.so_src/include_exp/time.h b/Usermode/Libraries/libc.so_src/include_exp/time.h index bd7afce9..5d728cea 100644 --- a/Usermode/Libraries/libc.so_src/include_exp/time.h +++ b/Usermode/Libraries/libc.so_src/include_exp/time.h @@ -8,7 +8,7 @@ #ifndef _TIME_H_ #define _TIME_H_ -#include +//#include #include // time_t struct tm diff --git a/Usermode/Libraries/libc.so_src/stub.c b/Usermode/Libraries/libc.so_src/stub.c index 20e796ee..6b64fb6b 100644 --- a/Usermode/Libraries/libc.so_src/stub.c +++ b/Usermode/Libraries/libc.so_src/stub.c @@ -4,6 +4,7 @@ #include "stdio_int.h" #include "lib.h" #include +#include #include #define USE_CPUID 0 diff --git a/Usermode/Libraries/libposix.so_src/include_exp/sys/types.h b/Usermode/Libraries/libposix.so_src/include_exp/sys/types.h index 9b7aac0f..03e24ddc 100644 --- a/Usermode/Libraries/libposix.so_src/include_exp/sys/types.h +++ b/Usermode/Libraries/libposix.so_src/include_exp/sys/types.h @@ -3,8 +3,6 @@ #ifndef _SYS_TYPES_H #define _SYS_TYPES_H -#include - //typedef signed int ssize_t; //#ifdef __USE_BSD typedef unsigned int u_int; @@ -21,7 +19,7 @@ typedef long long int off_t; typedef unsigned int uint; -#include "stat.h" +//#include "stat.h" #include #endif diff --git a/Usermode/Libraries/libpsocket.so_src/include_exp/sys/socket.h b/Usermode/Libraries/libpsocket.so_src/include_exp/sys/socket.h index dc44ec68..4d2a1c23 100644 --- a/Usermode/Libraries/libpsocket.so_src/include_exp/sys/socket.h +++ b/Usermode/Libraries/libpsocket.so_src/include_exp/sys/socket.h @@ -10,6 +10,7 @@ #include #include // size_t +#include // uint32_t typedef uint32_t socklen_t;