make plain old gcc -o foo foo.c work
authorbrian <brian@brianweb.net>
Wed, 5 May 2004 02:31:33 +0000 (19:31 -0700)
committerbrian <brian@brianweb.net>
Wed, 5 May 2004 02:31:33 +0000 (19:31 -0700)
darcs-hash:20040505023133-24bed-1b5b61ce5d9b9d86d7a1d3cb4068f4c3afe86692.gz

Makefile
src/org/ibex/nestedvm/linker.ld
upstream/Makefile

index f5c2a53..e4143dc 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -35,9 +35,7 @@ mips_optflags = -O3 -g \
 
 MIPS_CFLAGS = $(mips_optflags) $(flags) -I. -Wall -Wno-unused -Werror
 MIPS_LD = mips-unknown-elf-gcc
-MIPS_LDFLAGS= \
-       $(flags) -L$(build)/org/ibex/nestedvm --static \
-       -T $(mips2java_root)/src/org/ibex/nestedvm/linker.ld -Wl,--gc-sections
+MIPS_LDFLAGS= $(flags) --static -Wl,--gc-sections
 MIPS_STRIP = mips-unknown-elf-strip
 
 # Java compiler/VM settings
index c12be88..13330f1 100644 (file)
@@ -1,7 +1,6 @@
 ENTRY(_start)
-INPUT(support.o support_aux.o)
 GROUP(-lc -lgcc)
-/*GROUP(-lgcc)*/
+
 __DYNAMIC  =  0;
 
 SECTIONS {
index 73f3a11..5360084 100644 (file)
@@ -36,17 +36,29 @@ export PATH
 PATCH = $(shell test `uname` = SunOS && echo gpatch || echo patch)
 
 tasks/full_toolchain: tasks/build_binutils tasks/build_gcc_step2 tasks/build_libc
+       for f in crt0.o support.o support_aux.o; do \
+               rm -f "$(usr)/mips-unknown-elf/lib/$$f"; \
+               ln -s "$(root)/build/org/ibex/nestedvm/$$f" "$(usr)/mips-unknown-elf/lib/$$f"; \
+       done
+
+       rm -f "$(usr)/mips-unknown-elf/lib/linker.ld"
+       ln -s "$(root)/src/org/ibex/nestedvm/linker.ld" "$(usr)/mips-unknown-elf/lib/linker.ld"
+
+       if [ ! -e "$(usr)/mips-unknown-elf/include/getopt.h" ]; then \
+               echo '#include <unistd.h>' > "$(usr)/mips-unknown-elf/include/getopt.h"; \
+       fi
+       
+       mips-unknown-elf-gcc -dumpspecs \
+               | sed '/startfile:$$/{n;s/crt0%O%s/crt0%O%s support%O%s support_aux%O%s/;};' \
+               | sed '/link_command:$$/{n;s/%{T\*}/%{T*} %{!T:-T linker.ld%s}/;};' \
+               > "$(usr)/lib/gcc-lib/mips-unknown-elf/$(version_gcc)/specs"
+               
        touch $@
 
 tasks/build_gcc: tasks/build_binutils
 tasks/build_newlib: tasks/build_gcc
 
 tasks/build_libc: tasks/build_newlib tasks/build_regex tasks/build_openbsdglob
-       # HACK
-       rm -f $(usr)/mips-unknown-elf/lib/crt0.o
-       ln -s $(root)/build/org/ibex/nestedvm/crt0.o $(usr)/mips-unknown-elf/lib/crt0.o 
-       
-       echo '#include <unistd.h>' > $(usr)/mips-unknown-elf/include/getopt.h
        touch $@
 
 clean_%: