From: brian Date: Wed, 5 May 2004 02:31:33 +0000 (-0700) Subject: make plain old gcc -o foo foo.c work X-Git-Tag: merge~23 X-Git-Url: http://git.megacz.com/?p=nestedvm.git;a=commitdiff_plain;h=efbc1822d80a8fb04447731bb33d64d3537f8121;ds=sidebyside make plain old gcc -o foo foo.c work darcs-hash:20040505023133-24bed-1b5b61ce5d9b9d86d7a1d3cb4068f4c3afe86692.gz --- diff --git a/Makefile b/Makefile index f5c2a53..e4143dc 100644 --- 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 diff --git a/src/org/ibex/nestedvm/linker.ld b/src/org/ibex/nestedvm/linker.ld index c12be88..13330f1 100644 --- a/src/org/ibex/nestedvm/linker.ld +++ b/src/org/ibex/nestedvm/linker.ld @@ -1,7 +1,6 @@ ENTRY(_start) -INPUT(support.o support_aux.o) GROUP(-lc -lgcc) -/*GROUP(-lgcc)*/ + __DYNAMIC = 0; SECTIONS { diff --git a/upstream/Makefile b/upstream/Makefile index 73f3a11..5360084 100644 --- a/upstream/Makefile +++ b/upstream/Makefile @@ -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 ' > "$(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 ' > $(usr)/mips-unknown-elf/include/getopt.h touch $@ clean_%: