2003/12/31 23:42:51
authorbrian <brian@xwt.org>
Fri, 30 Jan 2004 07:43:59 +0000 (07:43 +0000)
committerbrian <brian@xwt.org>
Fri, 30 Jan 2004 07:43:59 +0000 (07:43 +0000)
darcs-hash:20040130074359-aa32f-f532ce0e01cf13eb16a5138d5bd1f10f31395e99.gz

Makefile
Makefile.upstream
src/org/xwt/mips/linker.ld
src/org/xwt/translators/Freetype.c

index c18d3f1..07304a1 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -50,7 +50,6 @@ include Makefile.upstream
 
 # figure out what stuff in org.xwt.plat.* this platform requires (its superclasses)
 java_sources      := $(patsubst src/%.java,     build/java/%.java, $(shell find src -name '*.java' \! -path 'src/org/xwt/mips/*'))
-java_sources      += build/java/org/xwt/translators/MIPSApps.java
 all_java_sources  := $(java_sources)
 
 nonplat_java_sources      := $(filter-out build/java/org/xwt/plat/%, $(java_sources))
@@ -75,9 +74,9 @@ build/c/jpeg/%.c:     upstream/jpeg-6b/src/%.c
        @echo linking $@; mkdir -p $(@D); ln -fs `echo $(@D)/ | sed 's_[^/]*//*_../_g'`/$< $@
 build/res/%:       src/%      ; @echo linking $@; mkdir -p $(@D); ln -fs `echo $(@D)/ | sed 's_[^/]*//*_../_g'`/$< $@
 
-build/java/org/xwt/translators/MIPSApps.class: build/java/org/xwt/translators/MIPSApps.java .jikes
+build/class/org/xwt/translators/MIPSApps.class: build/java/org/xwt/translators/MIPSApps.java .jikes
        @echo -e "\n\033[1mcompiling          .java -> .class: $<\033[0m"
-       mkdir -p build/class/org/xwt/util/
+       mkdir -p build/class/org/xwt/translators
        ./.jikes -g:none $<
 
 build/class/org/xwt/util/Preprocessor.class: src/org/xwt/util/Preprocessor.java .jikes
@@ -94,7 +93,7 @@ build/class/org/xwt/mips/Compiler.class: src/org/xwt/mips/*.java
 # this forces a clean build every time because jikes is so damn buggy
 preprocess: $(java_sources)
 compile: .compile
-.compile: $(java_sources) .jikes 
+.compile: build/class/org/xwt/translators/MIPSApps.class $(java_sources) .jikes 
        @echo -e "\n\033[1mcompiling          .java -> .class: src/**/*.java\033[0m"
        @rm -f $(java_sources:build/java/%.java=build/class/%.class)
        mkdir -p build/class
@@ -188,7 +187,9 @@ build/JVM/xwt.jar: .compile build/res/builtin.jar
        mkdir -p build/JVM
        echo -e "Manifest-Version: 1.0\nMain-Class: org.xwt.Main\n" > build/JVM/.manifest
        cd build/class/org/xwt; ln -sf ../../../res/builtin.jar
-       cd build/class; $(jar) cfm ../JVM/xwt.jar ../JVM/.manifest `find . \! -type d`;
+       cd build/class; $(jar) cfm ../JVM/xwt.jar ../JVM/.manifest \
+               `find . \! -type d \! -path './org/xwt/mips/*'` \
+               $(patsubst %,org/xwt/mips/%*.class, Runtime Registers Syscalls Errno)
 
 
 
@@ -198,6 +199,7 @@ build/JVM/xwt.jar: .compile build/res/builtin.jar
 
 build/mips/%.c.o: src/%.c .download_libmspack-20030726
        make .install_freetype-2.1.4_mips-unknown-elf target=mips-unknown-elf
+       make .install_libmspack-20030726_mips-unknown-elf target=mips-unknown-elf
        mkdir -p $(@D)
        echo -e "\n\033[1mcompiling $< -> $@ (mips)\033[0m"
        upstream/install/bin/mips-unknown-elf-gcc -march=r3000 \
@@ -221,8 +223,8 @@ build/mips/mipsapps.mips: build/mips/org/xwt/translators/Freetype.c.o build/mips
                -o $@ \
                $^ \
                -lfreetype \
-               -lmspack
-
+               -lmspack \
+               -Wl,--gc-sections
 
 ##############################################################################
 # Maintainer stuff: generating numbered builds, proposing patches
index a281337..03a1fb8 100644 (file)
@@ -84,6 +84,8 @@ configure_gcc-3.3_mips-unknown-elf      += --with-gnu-ld=$(shell pwd)/upstream/i
 configure_gcc-3.3_mips-unknown-elf      += --with-as=$(shell pwd)/upstream/install/bin/$(target)-as
 configure_gcc-3.3_mips-unknown-elf      += --enable-languages=c --nfp --enable-multilib --disable-threads
 
+environment_newlib-1.11.0_mips-unknown-elf += TARGET_CFLAGS="-O3 -ffunction-sections -fdata-sections"
+
 # libjpeg's configury doesn't obey --target
 environment_jpeg-6b_$(target)           += PATH=$(shell pwd)/upstream/install/$(target)/bin:$$PATH
 environment_jpeg-6b_$(target)           += CC=$(shell pwd)/upstream/install/bin/$(target)-gcc
@@ -95,6 +97,8 @@ environment_libmspack-20030726_$(target) += PATH=$(shell pwd)/upstream/install/$
 environment_libmspack-20030726_$(target) += CC=$(shell pwd)/upstream/install/bin/$(target)-gcc
 environment_libmspack-20030726_$(target) += AR="$(shell pwd)/upstream/install/$(target)/bin/ar"
 environment_libmspack-20030726_$(target) += AR2=$(shell pwd)/upstream/install/$(target)/bin/ranlib
+environment_libmspack-20030726_$(target) += OPTIM="-ffunction-sections -fdata-sections -O3"
+
 
 environment_gcc_3.3_$(target)           += PATH=$(shell pwd)/upstream/install/bin:$$PATH
 
@@ -141,7 +145,12 @@ endif
        touch $@
 
 .install_freetype-2.1.4_mips-unknown-elf: .install_gcc-3.3_mips-unknown-elf .install_newlib-1.11.0_mips-unknown-elf .download_freetype-2.1.4
-       cd upstream/freetype-2.1.4/src; make setup ansi; PATH=$$PATH:`pwd`/../../install/bin make CC=mips-unknown-elf-gcc AR=mips-unknown-elf-ar
+       cd upstream/freetype-2.1.4/src; \
+          make setup ansi; \
+          PATH=$$PATH:`pwd`/../../install/bin make \
+             CC=mips-unknown-elf-gcc \
+             AR=mips-unknown-elf-ar \
+             CFLAGS="-c -ffunction-sections -fdata-sections -O3"
        upstream/install/bin/mips-unknown-elf-ranlib upstream/freetype-2.1.4/src/objs/libfreetype.a
        touch $@
 
@@ -168,7 +177,7 @@ endif
        @echo -e "\n\033[1mdetecting your jikes installation...\033[0m"
        echo "#!/bin/sh" > .jikes
        #echo 'for A in `find build/class -name \*.class`; do mv $$A $$A.old; done;' >> .jikes
-       echo -n 'PATH=upstream/install/bin:$$PATH jikes -classpath lib/libgcj-minimal.jar $$@ -d build/class/ -sourcepath build/java/ ' >> .jikes
+       echo -n 'PATH=upstream/install/bin:$$PATH jikes -classpath lib/libgcj-minimal.jar:build/class $$@ -d build/class/ -sourcepath build/java/ ' >> .jikes
        (type jikes && (jikes --version | grep "Version 1.18")) || make .install_jikes-1.18_ target=
        echo -n "$(jikes_flags) -bootclasspath " >> .jikes
        echo "public class GetBootClassPath { public static void main(String[] s) { " > GetBootClassPath.java
index 5b8ab8b..75a179e 100644 (file)
@@ -1,15 +1,20 @@
 ENTRY(_start)
+/*INPUT(support.o support_aux.o)*/
 GROUP(-lc -lgcc)
+/*GROUP(-lgcc)*/
 __DYNAMIC  =  0;
 
 SECTIONS {
   . = 0x10000;
   .text : {
-    *(.init)
-    *(.text) *(.text.*) 
-    *(.fini)
+    KEEP(*(.init))
+    KEEP(*(.fini))
+    KEEP(*(.text))
+    *(.text.*) 
   }
 
+  _etext = .;
+
   .ctors :
   {
     KEEP (*crtbegin.o(.ctors))
@@ -29,23 +34,24 @@ SECTIONS {
   . = ALIGN(4k);
 
   .rodata : {
-    *(.rodata) *(.rodata.*) *(.eh_frame) *(.jcr)
+    *(.rodata*) *(.eh_frame) *(.jcr)
   }
 
   .data : {
-    *(.data)
+    *(.data*)
   }
 
   . = ALIGN(16);
-   PROVIDE(_gp = . + 0x8000);
+   _gp = . + 0x8000;
   .sdata : {
-    *(.rosdata) *(.sdata)
+    *(.rosdata*) *(.sdata*)
   }
   .sbss : {
-    *(.sbss) *(.scommon)
+    *(.sbss*) *(.scommon*)
   }
   .bss : {
-    *(.bss) *(COMMON)
+    *(.bss*) *(COMMON)
   }
+
   _end = .;
 }
index 50fe6fd..f8172d9 100644 (file)
@@ -1,5 +1,6 @@
 // Copyright 2003 Adam Megacz, see the COPYING file for licensing [GPL]
 
+#include <unistd.h>
 #include <freetype/freetype.h>
 
 /* NOTE: _user_info is defined in crt0.c. It points to a 4096 byte
@@ -44,7 +45,7 @@ extern char **_user_info;
 
 #define FT_Check(expr) do { \
     if((expr) != 0) { \
-        fprintf(stderr, #expr " failed\n"); \
+        errprint(#expr " failed\n"); \
         exit(EXIT_FAILURE); \
     } \
 } while(0)
@@ -52,6 +53,18 @@ extern char **_user_info;
 #define max(a, b) ((a) > (b) ? (a) : (b))
 #define min(a, b) ((a) < (b) ? (a) : (b))
 
+static int errprint(const char *s) {
+    int l = strlen(s);
+    int n;
+    while(l) {
+        n = write(STDERR_FILENO,s,l);
+        if(n < 0) return n;
+        l -= n;
+        s += n;
+    }
+    return 0;
+}
+
 extern void _pause();
 
 int freetype_main() {