Steve Ellcey <sell...@mips.com> writes: > On Mon, 2012-11-05 at 22:55 +0000, Richard Sandiford wrote: >> Steve Ellcey <sell...@mips.com> writes: >> > I am not sure how ld is supposed to find crt0.o in the uninstalled >> > setup, it exists in obj-mips-mti-elf/newlib/mips-mti-elf/libgloss/mips. >> >> The newlib and libgloss flags are usually added by the dejagnu >> baseboard file. E.g. for mips-sim.exp: >> >> set_board_info cflags "[libgloss_include_flags] [newlib_include_flags]" >> set_board_info ldflags "[libgloss_link_flags] [newlib_link_flags]" >> >> Richard > > Yup, I have those in my baseboard file. When you configure GCC for a > mips-*-elf target, do you use --with-sysroot=XXXXX? I don't, and the > build seems to work fine, but I was wondering if this is why GCC > couldn't find crt0.o until after it had been installed (into the same > directory home as newlib was installed to).
No, same here: I don't use --with-sysroot for the newlib targets. Do you build a unified gcc+newlib tree? If not, I don't think the above boilerplate works; you'll have to use something else instead. E.g. install newlib first, change your board files to match your build tree setup, or add links from the gcc build directory to the newlib one. But unified trees are simpler really (i.e. a newlib and libgloss symlink in the gcc tree). FWIW, on mine, the plugin test was: /foo/gcc/xgcc -B/foo/gcc/ linker_plugin24984.c -fno-diagnostics-show-caret -flto -fuse-linker-plugin -isystem /foo/mipsisa64-elf/./newlib/targ-include -isystem /bar/newlib/libc/include -B/foo/mipsisa64-elf/./libgloss/mips/ -L/foo/mipsisa64-elf/./libgloss/mips -L/bar/libgloss/mips -B/foo/mipsisa64-elf/./newlib/ -L/foo/mipsisa64-elf/./newlib -lm -Tidt.ld -o linker_plugin24984.exe where the expected libgloss and newlib flags are there. If you are using a unified tree and those flags aren't showing up in your run, it might be worth sticking a puts after your "set ldflags ..." line to see what setting you have (i.e. to see whether newlib_link_flags is going wrong, or whether the flags are somehow being dropped). Richard