Skip to content

Instantly share code, notes, and snippets.

@dmke
Last active May 28, 2018 06:09
Show Gist options
  • Save dmke/a4f673eb89862ef9dc2724c238480bb9 to your computer and use it in GitHub Desktop.
Save dmke/a4f673eb89862ef9dc2724c238480bb9 to your computer and use it in GitHub Desktop.
OpenWRT/LEDE: toolchain build failure (gccgo for mipsel/soft-float)
#!/bin/sh
echo 2>&1 "this is just a sample, not intended for execution"
exit 1
cd $LEDE_ROOT
git checkout 20d3c118ae # latest commit in master at time of writing
cp $gist["config"] .config
make defconfig
make -j8 || make -j1 V=s
## will fail with:
# libtool: compile: $LEDE_ROOT/build_dir/toolchain-mipsel_24kc_gcc-7.3.0_glibc/gcc-7.3.0-final/./gcc/xgcc -B$LEDE_ROOT/build_dir/toolchain-mipsel_24kc_gcc-7.3.0_glibc/gcc-7.3.0-final/./gcc/ -B$LEDE_ROOT/staging_dir/toolchain-mipsel_24kc_gcc-7.3.0_glibc/mipsel-openwrt-linux-gnu/bin/ -B$LEDE_ROOT/staging_dir/toolchain-mipsel_24kc_gcc-7.3.0_glibc/mipsel-openwrt-linux-gnu/lib/ -isystem $LEDE_ROOT/staging_dir/toolchain-mipsel_24kc_gcc-7.3.0_glibc/mipsel-openwrt-linux-gnu/include -isystem $LEDE_ROOT/staging_dir/toolchain-mipsel_24kc_gcc-7.3.0_glibc/mipsel-openwrt-linux-gnu/sys-include -DHAVE_CONFIG_H -I. -I$LEDE_ROOT/build_dir/toolchain-mipsel_24kc_gcc-7.3.0_glibc/gcc-7.3.0/libffi -I. -I$LEDE_ROOT/build_dir/toolchain-mipsel_24kc_gcc-7.3.0_glibc/gcc-7.3.0/libffi/include -Iinclude -I$LEDE_ROOT/build_dir/toolchain-mipsel_24kc_gcc-7.3.0_glibc/gcc-7.3.0/libffi/src -I. -I$LEDE_ROOT/build_dir/toolchain-mipsel_24kc_gcc-7.3.0_glibc/gcc-7.3.0/libffi/include -Iinclude -I$LEDE_ROOT/build_dir/toolchain-mipsel_24kc_gcc-7.3.0_glibc/gcc-7.3.0/libffi/src -Os -pipe -mno-branch-likely -mips32r2 -mtune=24kc -fno-caller-saves -fno-plt -fhonour-copts -Wno-error=unused-but-set-variable -Wno-error=unused-result -msoft-float -MT src/mips/o32.lo -MD -MP -MF src/mips/.deps/o32.Tpo -c $LEDE_ROOT/build_dir/toolchain-mipsel_24kc_gcc-7.3.0_glibc/gcc-7.3.0/libffi/src/mips/o32.S -fPIC -DPIC -o src/mips/.libs/o32.o
# $LEDE_ROOT/build_dir/toolchain-mipsel_24kc_gcc-7.3.0_glibc/gcc-7.3.0/libffi/src/mips/o32.S: Assembler messages:
# $LEDE_ROOT/build_dir/toolchain-mipsel_24kc_gcc-7.3.0_glibc/gcc-7.3.0/libffi/src/mips/o32.S:94: Error: opcode not supported on this processor: mips32r2 (mips32r2) `l.d $f12,0*4($sp)'
# $LEDE_ROOT/build_dir/toolchain-mipsel_24kc_gcc-7.3.0_glibc/gcc-7.3.0/libffi/src/mips/o32.S:101: Error: opcode not supported on this processor: mips32r2 (mips32r2) `l.s $f12,0*4($sp)'
# $LEDE_ROOT/build_dir/toolchain-mipsel_24kc_gcc-7.3.0_glibc/gcc-7.3.0/libffi/src/mips/o32.S:109: Error: opcode not supported on this processor: mips32r2 (mips32r2) `l.d $f12,0*4($sp)'
# $LEDE_ROOT/build_dir/toolchain-mipsel_24kc_gcc-7.3.0_glibc/gcc-7.3.0/libffi/src/mips/o32.S:110: Error: opcode not supported on this processor: mips32r2 (mips32r2) `l.d $f14,2*4($sp)'
# $LEDE_ROOT/build_dir/toolchain-mipsel_24kc_gcc-7.3.0_glibc/gcc-7.3.0/libffi/src/mips/o32.S:115: Error: opcode not supported on this processor: mips32r2 (mips32r2) `l.s $f12,0*4($sp)'
# $LEDE_ROOT/build_dir/toolchain-mipsel_24kc_gcc-7.3.0_glibc/gcc-7.3.0/libffi/src/mips/o32.S:116: Error: opcode not supported on this processor: mips32r2 (mips32r2) `l.s $f14,1*4($sp)'
# $LEDE_ROOT/build_dir/toolchain-mipsel_24kc_gcc-7.3.0_glibc/gcc-7.3.0/libffi/src/mips/o32.S:123: Error: opcode not supported on this processor: mips32r2 (mips32r2) `l.d $f12,0*4($sp)'
# $LEDE_ROOT/build_dir/toolchain-mipsel_24kc_gcc-7.3.0_glibc/gcc-7.3.0/libffi/src/mips/o32.S:124: Error: opcode not supported on this processor: mips32r2 (mips32r2) `l.s $f14,2*4($sp)'
# $LEDE_ROOT/build_dir/toolchain-mipsel_24kc_gcc-7.3.0_glibc/gcc-7.3.0/libffi/src/mips/o32.S:131: Error: opcode not supported on this processor: mips32r2 (mips32r2) `l.s $f12,0*4($sp)'
# $LEDE_ROOT/build_dir/toolchain-mipsel_24kc_gcc-7.3.0_glibc/gcc-7.3.0/libffi/src/mips/o32.S:132: Error: opcode not supported on this processor: mips32r2 (mips32r2) `l.d $f14,2*4($sp)'
# $LEDE_ROOT/build_dir/toolchain-mipsel_24kc_gcc-7.3.0_glibc/gcc-7.3.0/libffi/src/mips/o32.S:161: Error: opcode not supported on this processor: mips32r2 (mips32r2) `s.s $f0,0($8)'
# $LEDE_ROOT/build_dir/toolchain-mipsel_24kc_gcc-7.3.0_glibc/gcc-7.3.0/libffi/src/mips/o32.S:168: Error: opcode not supported on this processor: mips32r2 (mips32r2) `s.d $f0,0($8)'
# $LEDE_ROOT/build_dir/toolchain-mipsel_24kc_gcc-7.3.0_glibc/gcc-7.3.0/libffi/src/mips/o32.S:265: Error: opcode not supported on this processor: mips32r2 (mips32r2) `s.d $f12,((14*4)-10*4)($fp)'
# $LEDE_ROOT/build_dir/toolchain-mipsel_24kc_gcc-7.3.0_glibc/gcc-7.3.0/libffi/src/mips/o32.S:266: Error: opcode not supported on this processor: mips32r2 (mips32r2) `s.d $f14,((14*4)-8*4)($fp)'
# $LEDE_ROOT/build_dir/toolchain-mipsel_24kc_gcc-7.3.0_glibc/gcc-7.3.0/libffi/src/mips/o32.S:285: Error: opcode not supported on this processor: mips32r2 (mips32r2) `l.s $f0,((14*4)-6*4)($fp)'
# $LEDE_ROOT/build_dir/toolchain-mipsel_24kc_gcc-7.3.0_glibc/gcc-7.3.0/libffi/src/mips/o32.S:289: Error: opcode not supported on this processor: mips32r2 (mips32r2) `l.d $f0,((14*4)-6*4)($fp)'
# Makefile:1214: recipe for target 'src/mips/o32.lo' failed
## apply updated patch from https://github.com/libffi/libffi/commit/7a0d2c83bf2b0422e2d0ed297f847fc1eeb88bb3
cd build_dir/toolchain-mipsel_24kc_gcc-7.3.0_glibc/gcc-7.3.0/
patch -p1 -i $gist["301-fix-mips-fix-MIPS-softfloat-build-issue.patch"]
cd $LEDE_ROOT
make -j8 || make -j1 V=2
## will fail with:
# $LEDE_ROOT/build_dir/toolchain-mipsel_24kc_gcc-7.3.0_glibc/gcc-7.3.0-final/./gcc/gccgo -B$LEDE_ROOT/build_dir/toolchain-mipsel_24kc_gcc-7.3.0_glibc/gcc-7.3.0-final/./gcc/ -B$LEDE_ROOT/staging_dir/toolchain-mipsel_24kc_gcc-7.3.0_glibc/mipsel-openwrt-linux-gnu/bin/ -B$LEDE_ROOT/staging_dir/toolchain-mipsel_24kc_gcc-7.3.0_glibc/mipsel-openwrt-linux-gnu/lib/ -isystem $LEDE_ROOT/staging_dir/toolchain-mipsel_24kc_gcc-7.3.0_glibc/mipsel-openwrt-linux-gnu/include -isystem $LEDE_ROOT/staging_dir/toolchain-mipsel_24kc_gcc-7.3.0_glibc/mipsel-openwrt-linux-gnu/sys-include -Os -pipe -mno-branch-likely -mips32r2 -mtune=24kc -fno-caller-saves -fno-plt -fhonour-copts -Wno-error=unused-but-set-variable -Wno-error=unused-result -msoft-float -static-libstdc++ -static-libgcc -L ../mipsel-openwrt-linux-gnu/libgo -L ../mipsel-openwrt-linux-gnu/libgo/.libs -o go $LEDE_ROOT/build_dir/toolchain-mipsel_24kc_gcc-7.3.0_glibc/gcc-7.3.0/gotools/../libgo/go/cmd/go/alldocs.go $LEDE_ROOT/build_dir/toolchain-mipsel_24kc_gcc-7.3.0_glibc/gcc-7.3.0/gotools/../libgo/go/cmd/go/bug.go $LEDE_ROOT/build_dir/toolchain-mipsel_24kc_gcc-7.3.0_glibc/gcc-7.3.0/gotools/../libgo/go/cmd/go/build.go $LEDE_ROOT/build_dir/toolchain-mipsel_24kc_gcc-7.3.0_glibc/gcc-7.3.0/gotools/../libgo/go/cmd/go/clean.go $LEDE_ROOT/build_dir/toolchain-mipsel_24kc_gcc-7.3.0_glibc/gcc-7.3.0/gotools/../libgo/go/cmd/go/context.go $LEDE_ROOT/build_dir/toolchain-mipsel_24kc_gcc-7.3.0_glibc/gcc-7.3.0/gotools/../libgo/go/cmd/go/discovery.go $LEDE_ROOT/build_dir/toolchain-mipsel_24kc_gcc-7.3.0_glibc/gcc-7.3.0/gotools/../libgo/go/cmd/go/doc.go $LEDE_ROOT/build_dir/toolchain-mipsel_24kc_gcc-7.3.0_glibc/gcc-7.3.0/gotools/../libgo/go/cmd/go/env.go $LEDE_ROOT/build_dir/toolchain-mipsel_24kc_gcc-7.3.0_glibc/gcc-7.3.0/gotools/../libgo/go/cmd/go/fix.go $LEDE_ROOT/build_dir/toolchain-mipsel_24kc_gcc-7.3.0_glibc/gcc-7.3.0/gotools/../libgo/go/cmd/go/fmt.go $LEDE_ROOT/build_dir/toolchain-mipsel_24kc_gcc-7.3.0_glibc/gcc-7.3.0/gotools/../libgo/go/cmd/go/generate.go $LEDE_ROOT/build_dir/toolchain-mipsel_24kc_gcc-7.3.0_glibc/gcc-7.3.0/gotools/../libgo/go/cmd/go/get.go $LEDE_ROOT/build_dir/toolchain-mipsel_24kc_gcc-7.3.0_glibc/gcc-7.3.0/gotools/../libgo/go/cmd/go/go11.go $LEDE_ROOT/build_dir/toolchain-mipsel_24kc_gcc-7.3.0_glibc/gcc-7.3.0/gotools/../libgo/go/cmd/go/help.go $LEDE_ROOT/build_dir/toolchain-mipsel_24kc_gcc-7.3.0_glibc/gcc-7.3.0/gotools/../libgo/go/cmd/go/http.go $LEDE_ROOT/build_dir/toolchain-mipsel_24kc_gcc-7.3.0_glibc/gcc-7.3.0/gotools/../libgo/go/cmd/go/list.go $LEDE_ROOT/build_dir/toolchain-mipsel_24kc_gcc-7.3.0_glibc/gcc-7.3.0/gotools/../libgo/go/cmd/go/main.go $LEDE_ROOT/build_dir/toolchain-mipsel_24kc_gcc-7.3.0_glibc/gcc-7.3.0/gotools/../libgo/go/cmd/go/note.go $LEDE_ROOT/build_dir/toolchain-mipsel_24kc_gcc-7.3.0_glibc/gcc-7.3.0/gotools/../libgo/go/cmd/go/pkg.go $LEDE_ROOT/build_dir/toolchain-mipsel_24kc_gcc-7.3.0_glibc/gcc-7.3.0/gotools/../libgo/go/cmd/go/run.go $LEDE_ROOT/build_dir/toolchain-mipsel_24kc_gcc-7.3.0_glibc/gcc-7.3.0/gotools/../libgo/go/cmd/go/signal.go $LEDE_ROOT/build_dir/toolchain-mipsel_24kc_gcc-7.3.0_glibc/gcc-7.3.0/gotools/../libgo/go/cmd/go/signal_unix.go $LEDE_ROOT/build_dir/toolchain-mipsel_24kc_gcc-7.3.0_glibc/gcc-7.3.0/gotools/../libgo/go/cmd/go/test.go $LEDE_ROOT/build_dir/toolchain-mipsel_24kc_gcc-7.3.0_glibc/gcc-7.3.0/gotools/../libgo/go/cmd/go/testflag.go $LEDE_ROOT/build_dir/toolchain-mipsel_24kc_gcc-7.3.0_glibc/gcc-7.3.0/gotools/../libgo/go/cmd/go/tool.go $LEDE_ROOT/build_dir/toolchain-mipsel_24kc_gcc-7.3.0_glibc/gcc-7.3.0/gotools/../libgo/go/cmd/go/vcs.go $LEDE_ROOT/build_dir/toolchain-mipsel_24kc_gcc-7.3.0_glibc/gcc-7.3.0/gotools/../libgo/go/cmd/go/version.go $LEDE_ROOT/build_dir/toolchain-mipsel_24kc_gcc-7.3.0_glibc/gcc-7.3.0/gotools/../libgo/go/cmd/go/vet.go ../mipsel-openwrt-linux-gnu/libgo/zstdpkglist.go zdefaultcc.go
# $LEDE_ROOT/staging_dir/toolchain-mipsel_24kc_gcc-7.3.0_glibc/mipsel-openwrt-linux-gnu/bin/ld: warning: libgcc_s.so.1, needed by ../mipsel-openwrt-linux-gnu/libgo/.libs/libgo.so, not found (try using -rpath or -rpath-link)
# $LEDE_ROOT/tmp/ccqo4ExW.o: In function `main.httpGET':
# $LEDE_ROOT/build_dir/toolchain-mipsel_24kc_gcc-7.3.0_glibc/gcc-7.3.0/gotools/../libgo/go/cmd/go/http.go:70: undefined reference to `_Unwind_Resume'
# $LEDE_ROOT/tmp/ccqo4ExW.o: In function `main.$nested43':
# $LEDE_ROOT/build_dir/toolchain-mipsel_24kc_gcc-7.3.0_glibc/gcc-7.3.0/gotools/../libgo/go/cmd/go/vcs.go:750: undefined reference to `_Unwind_Resume'
# $LEDE_ROOT/tmp/ccqo4ExW.o: In function `main.showOutput.pN12_main.builder':
# $LEDE_ROOT/build_dir/toolchain-mipsel_24kc_gcc-7.3.0_glibc/gcc-7.3.0/gotools/../libgo/go/cmd/go/build.go:2058: undefined reference to `_Unwind_Resume'
# $LEDE_ROOT/tmp/ccqo4ExW.o: In function `main.showcmd.pN12_main.builder':
# $LEDE_ROOT/build_dir/toolchain-mipsel_24kc_gcc-7.3.0_glibc/gcc-7.3.0/gotools/../libgo/go/cmd/go/build.go:2022: undefined reference to `_Unwind_Resume'
# $LEDE_ROOT/tmp/ccqo4ExW.o: In function `main.mkdir.pN12_main.builder':
# $LEDE_ROOT/build_dir/toolchain-mipsel_24kc_gcc-7.3.0_glibc/gcc-7.3.0/gotools/../libgo/go/cmd/go/build.go:2254: undefined reference to `_Unwind_Resume'
# $LEDE_ROOT/tmp/ccqo4ExW.o:$LEDE_ROOT/build_dir/toolchain-mipsel_24kc_gcc-7.3.0_glibc/gcc-7.3.0/gotools/../libgo/go/cmd/go/build.go:1917: more undefined references to `_Unwind_Resume' follow
# ../mipsel-openwrt-linux-gnu/libgo/.libs/libgo.so: undefined reference to `_Unwind_RaiseException@GCC_3.0'
# ../mipsel-openwrt-linux-gnu/libgo/.libs/libgo.so: undefined reference to `__floatunsidf@GCC_4.2.0'
# ../mipsel-openwrt-linux-gnu/libgo/.libs/libgo.so: undefined reference to `__nedf2@GCC_3.0'
# ../mipsel-openwrt-linux-gnu/libgo/.libs/libgo.so: undefined reference to `__unorddf2@GCC_3.3.4'
# ../mipsel-openwrt-linux-gnu/libgo/.libs/libgo.so: undefined reference to `__floatunsisf@GCC_4.2.0'
# ../mipsel-openwrt-linux-gnu/libgo/.libs/libgo.so: undefined reference to `__fixdfsi@GCC_3.0'
# ../mipsel-openwrt-linux-gnu/libgo/.libs/libgo.so: undefined reference to `_Unwind_GetIPInfo@GCC_4.2.0'
# ../mipsel-openwrt-linux-gnu/libgo/.libs/libgo.so: undefined reference to `__eqdf2@GCC_3.0'
# ../mipsel-openwrt-linux-gnu/libgo/.libs/libgo.so: undefined reference to `__moddi3@GLIBC_2.0'
# ../mipsel-openwrt-linux-gnu/libgo/.libs/libgo.so: undefined reference to `__umoddi3@GLIBC_2.0'
# ../mipsel-openwrt-linux-gnu/libgo/.libs/libgo.so: undefined reference to `__nesf2@GCC_3.0'
# ../mipsel-openwrt-linux-gnu/libgo/.libs/libgo.so: undefined reference to `__floatdidf@GCC_3.0'
# ../mipsel-openwrt-linux-gnu/libgo/.libs/libgo.so: undefined reference to `__floatundidf@GCC_4.2.0'
# ../mipsel-openwrt-linux-gnu/libgo/.libs/libgo.so: undefined reference to `__gtdf2@GCC_3.0'
# ../mipsel-openwrt-linux-gnu/libgo/.libs/libgo.so: undefined reference to `__divsf3@GCC_3.0'
# ../mipsel-openwrt-linux-gnu/libgo/.libs/libgo.so: undefined reference to `__ltsf2@GCC_3.0'
# ../mipsel-openwrt-linux-gnu/libgo/.libs/libgo.so: undefined reference to `__divdf3@GCC_3.0'
# ../mipsel-openwrt-linux-gnu/libgo/.libs/libgo.so: undefined reference to `_Unwind_GetTextRelBase@GCC_3.0'
# ../mipsel-openwrt-linux-gnu/libgo/.libs/libgo.so: undefined reference to `__ctzdi2@GCC_3.4'
# ../mipsel-openwrt-linux-gnu/libgo/.libs/libgo.so: undefined reference to `__mulsf3@GCC_3.0'
# ../mipsel-openwrt-linux-gnu/libgo/.libs/libgo.so: undefined reference to `__gedf2@GCC_3.0'
# ../mipsel-openwrt-linux-gnu/libgo/.libs/libgo.so: undefined reference to `__ucmpdi2@GCC_3.0'
# ../mipsel-openwrt-linux-gnu/libgo/.libs/libgo.so: undefined reference to `__divdi3@GLIBC_2.0'
# ../mipsel-openwrt-linux-gnu/libgo/.libs/libgo.so: undefined reference to `_Unwind_Resume_or_Rethrow@GCC_3.3'
# ../mipsel-openwrt-linux-gnu/libgo/.libs/libgo.so: undefined reference to `__unordsf2@GCC_3.3.4'
# ../mipsel-openwrt-linux-gnu/libgo/.libs/libgo.so: undefined reference to `_Unwind_Resume@GCC_3.0'
# ../mipsel-openwrt-linux-gnu/libgo/.libs/libgo.so: undefined reference to `__floatsidf@GCC_3.0'
# ../mipsel-openwrt-linux-gnu/libgo/.libs/libgo.so: undefined reference to `__ashldi3@GCC_3.0'
# ../mipsel-openwrt-linux-gnu/libgo/.libs/libgo.so: undefined reference to `__truncdfsf2@GCC_3.0'
# ../mipsel-openwrt-linux-gnu/libgo/.libs/libgo.so: undefined reference to `__gesf2@GCC_3.0'
# ../mipsel-openwrt-linux-gnu/libgo/.libs/libgo.so: undefined reference to `__ledf2@GCC_3.0'
# ../mipsel-openwrt-linux-gnu/libgo/.libs/libgo.so: undefined reference to `__addsf3@GCC_3.0'
# ../mipsel-openwrt-linux-gnu/libgo/.libs/libgo.so: undefined reference to `__lshrdi3@GCC_3.0'
# ../mipsel-openwrt-linux-gnu/libgo/.libs/libgo.so: undefined reference to `__ashrdi3@GCC_3.0'
# ../mipsel-openwrt-linux-gnu/libgo/.libs/libgo.so: undefined reference to `__floatdisf@GCC_3.0'
# ../mipsel-openwrt-linux-gnu/libgo/.libs/libgo.so: undefined reference to `__divsc3@GCC_4.0.0'
# ../mipsel-openwrt-linux-gnu/libgo/.libs/libgo.so: undefined reference to `_Unwind_SetGR@GCC_3.0'
# ../mipsel-openwrt-linux-gnu/libgo/.libs/libgo.so: undefined reference to `__udivdi3@GLIBC_2.0'
# ../mipsel-openwrt-linux-gnu/libgo/.libs/libgo.so: undefined reference to `_Unwind_SetIP@GCC_3.0'
# ../mipsel-openwrt-linux-gnu/libgo/.libs/libgo.so: undefined reference to `__fixunsdfdi@GCC_3.0'
# ../mipsel-openwrt-linux-gnu/libgo/.libs/libgo.so: undefined reference to `__extendsfdf2@GCC_3.0'
# ../mipsel-openwrt-linux-gnu/libgo/.libs/libgo.so: undefined reference to `__fixdfdi@GCC_3.0'
# ../mipsel-openwrt-linux-gnu/libgo/.libs/libgo.so: undefined reference to `__fixsfdi@GCC_3.0'
# ../mipsel-openwrt-linux-gnu/libgo/.libs/libgo.so: undefined reference to `_Unwind_GetRegionStart@GCC_3.0'
# ../mipsel-openwrt-linux-gnu/libgo/.libs/libgo.so: undefined reference to `_Unwind_GetLanguageSpecificData@GCC_3.0'
# ../mipsel-openwrt-linux-gnu/libgo/.libs/libgo.so: undefined reference to `__lesf2@GCC_3.0'
# ../mipsel-openwrt-linux-gnu/libgo/.libs/libgo.so: undefined reference to `__subdf3@GCC_3.0'
# ../mipsel-openwrt-linux-gnu/libgo/.libs/libgo.so: undefined reference to `__divdc3@GCC_4.0.0'
# ../mipsel-openwrt-linux-gnu/libgo/.libs/libgo.so: undefined reference to `__muldc3@GCC_4.0.0'
# ../mipsel-openwrt-linux-gnu/libgo/.libs/libgo.so: undefined reference to `__ltdf2@GCC_3.0'
# ../mipsel-openwrt-linux-gnu/libgo/.libs/libgo.so: undefined reference to `_Unwind_GetDataRelBase@GCC_3.0'
# ../mipsel-openwrt-linux-gnu/libgo/.libs/libgo.so: undefined reference to `__floatundisf@GCC_4.2.0'
# ../mipsel-openwrt-linux-gnu/libgo/.libs/libgo.so: undefined reference to `__gtsf2@GCC_3.0'
# ../mipsel-openwrt-linux-gnu/libgo/.libs/libgo.so: undefined reference to `__muldf3@GCC_3.0'
# ../mipsel-openwrt-linux-gnu/libgo/.libs/libgo.so: undefined reference to `_Unwind_Backtrace@GCC_3.3'
# ../mipsel-openwrt-linux-gnu/libgo/.libs/libgo.so: undefined reference to `__adddf3@GCC_3.0'
# ../mipsel-openwrt-linux-gnu/libgo/.libs/libgo.so: undefined reference to `__eqsf2@GCC_3.0'
# ../mipsel-openwrt-linux-gnu/libgo/.libs/libgo.so: undefined reference to `__subsf3@GCC_3.0'
# collect2: error: ld returned 1 exit status
# Makefile:673: recipe for target 'go' failed
## adding `-Xlinker -rpath-link -Xlinker $LEDE_ROOT/build_dir/toolchain-mipsel_24kc_gcc-7.3.0_glibc/gcc-7.3.0-final/mipsel-openwrt-linux-gnu/libgcc/`
$LEDE_ROOT/build_dir/toolchain-mipsel_24kc_gcc-7.3.0_glibc/gcc-7.3.0-final/./gcc/gccgo -Xlinker -rpath-link -Xlinker $LEDE_ROOT/build_dir/toolchain-mipsel_24kc_gcc-7.3.0_glibc/gcc-7.3.0-final/mipsel-openwrt-linux-gnu/libgcc/ -B$LEDE_ROOT/build_dir/toolchain-mipsel_24kc_gcc-7.3.0_glibc/gcc-7.3.0-final/./gcc/ -B$LEDE_ROOT/staging_dir/toolchain-mipsel_24kc_gcc-7.3.0_glibc/mipsel-openwrt-linux-gnu/bin/ -B$LEDE_ROOT/staging_dir/toolchain-mipsel_24kc_gcc-7.3.0_glibc/mipsel-openwrt-linux-gnu/lib/ -isystem $LEDE_ROOT/staging_dir/toolchain-mipsel_24kc_gcc-7.3.0_glibc/mipsel-openwrt-linux-gnu/include -isystem $LEDE_ROOT/staging_dir/toolchain-mipsel_24kc_gcc-7.3.0_glibc/mipsel-openwrt-linux-gnu/sys-include -Os -pipe -mno-branch-likely -mips32r2 -mtune=24kc -fno-caller-saves -fno-plt -fhonour-copts -Wno-error=unused-but-set-variable -Wno-error=unused-result -msoft-float -static-libstdc++ -static-libgcc -L ../mipsel-openwrt-linux-gnu/libgo -L ../mipsel-openwrt-linux-gnu/libgo/.libs -o go $LEDE_ROOT/build_dir/toolchain-mipsel_24kc_gcc-7.3.0_glibc/gcc-7.3.0/gotools/../libgo/go/cmd/go/alldocs.go $LEDE_ROOT/build_dir/toolchain-mipsel_24kc_gcc-7.3.0_glibc/gcc-7.3.0/gotools/../libgo/go/cmd/go/bug.go $LEDE_ROOT/build_dir/toolchain-mipsel_24kc_gcc-7.3.0_glibc/gcc-7.3.0/gotools/../libgo/go/cmd/go/build.go $LEDE_ROOT/build_dir/toolchain-mipsel_24kc_gcc-7.3.0_glibc/gcc-7.3.0/gotools/../libgo/go/cmd/go/clean.go $LEDE_ROOT/build_dir/toolchain-mipsel_24kc_gcc-7.3.0_glibc/gcc-7.3.0/gotools/../libgo/go/cmd/go/context.go $LEDE_ROOT/build_dir/toolchain-mipsel_24kc_gcc-7.3.0_glibc/gcc-7.3.0/gotools/../libgo/go/cmd/go/discovery.go $LEDE_ROOT/build_dir/toolchain-mipsel_24kc_gcc-7.3.0_glibc/gcc-7.3.0/gotools/../libgo/go/cmd/go/doc.go $LEDE_ROOT/build_dir/toolchain-mipsel_24kc_gcc-7.3.0_glibc/gcc-7.3.0/gotools/../libgo/go/cmd/go/env.go $LEDE_ROOT/build_dir/toolchain-mipsel_24kc_gcc-7.3.0_glibc/gcc-7.3.0/gotools/../libgo/go/cmd/go/fix.go $LEDE_ROOT/build_dir/toolchain-mipsel_24kc_gcc-7.3.0_glibc/gcc-7.3.0/gotools/../libgo/go/cmd/go/fmt.go $LEDE_ROOT/build_dir/toolchain-mipsel_24kc_gcc-7.3.0_glibc/gcc-7.3.0/gotools/../libgo/go/cmd/go/generate.go $LEDE_ROOT/build_dir/toolchain-mipsel_24kc_gcc-7.3.0_glibc/gcc-7.3.0/gotools/../libgo/go/cmd/go/get.go $LEDE_ROOT/build_dir/toolchain-mipsel_24kc_gcc-7.3.0_glibc/gcc-7.3.0/gotools/../libgo/go/cmd/go/go11.go $LEDE_ROOT/build_dir/toolchain-mipsel_24kc_gcc-7.3.0_glibc/gcc-7.3.0/gotools/../libgo/go/cmd/go/help.go $LEDE_ROOT/build_dir/toolchain-mipsel_24kc_gcc-7.3.0_glibc/gcc-7.3.0/gotools/../libgo/go/cmd/go/http.go $LEDE_ROOT/build_dir/toolchain-mipsel_24kc_gcc-7.3.0_glibc/gcc-7.3.0/gotools/../libgo/go/cmd/go/list.go $LEDE_ROOT/build_dir/toolchain-mipsel_24kc_gcc-7.3.0_glibc/gcc-7.3.0/gotools/../libgo/go/cmd/go/main.go $LEDE_ROOT/build_dir/toolchain-mipsel_24kc_gcc-7.3.0_glibc/gcc-7.3.0/gotools/../libgo/go/cmd/go/note.go $LEDE_ROOT/build_dir/toolchain-mipsel_24kc_gcc-7.3.0_glibc/gcc-7.3.0/gotools/../libgo/go/cmd/go/pkg.go $LEDE_ROOT/build_dir/toolchain-mipsel_24kc_gcc-7.3.0_glibc/gcc-7.3.0/gotools/../libgo/go/cmd/go/run.go $LEDE_ROOT/build_dir/toolchain-mipsel_24kc_gcc-7.3.0_glibc/gcc-7.3.0/gotools/../libgo/go/cmd/go/signal.go $LEDE_ROOT/build_dir/toolchain-mipsel_24kc_gcc-7.3.0_glibc/gcc-7.3.0/gotools/../libgo/go/cmd/go/signal_unix.go $LEDE_ROOT/build_dir/toolchain-mipsel_24kc_gcc-7.3.0_glibc/gcc-7.3.0/gotools/../libgo/go/cmd/go/test.go $LEDE_ROOT/build_dir/toolchain-mipsel_24kc_gcc-7.3.0_glibc/gcc-7.3.0/gotools/../libgo/go/cmd/go/testflag.go $LEDE_ROOT/build_dir/toolchain-mipsel_24kc_gcc-7.3.0_glibc/gcc-7.3.0/gotools/../libgo/go/cmd/go/tool.go $LEDE_ROOT/build_dir/toolchain-mipsel_24kc_gcc-7.3.0_glibc/gcc-7.3.0/gotools/../libgo/go/cmd/go/vcs.go $LEDE_ROOT/build_dir/toolchain-mipsel_24kc_gcc-7.3.0_glibc/gcc-7.3.0/gotools/../libgo/go/cmd/go/version.go $LEDE_ROOT/build_dir/toolchain-mipsel_24kc_gcc-7.3.0_glibc/gcc-7.3.0/gotools/../libgo/go/cmd/go/vet.go ../mipsel-openwrt-linux-gnu/libgo/zstdpkglist.go zdefaultcc.go
## fails with
# $LEDE_ROOT/staging_dir/toolchain-mipsel_24kc_gcc-7.3.0_glibc/mipsel-openwrt-linux-gnu/bin/ld: /tmp/ccApaPgG.o: undefined reference to symbol '_Unwind_Resume@@GCC_3.0'
# $LEDE_ROOT/build_dir/toolchain-mipsel_24kc_gcc-7.3.0_glibc/gcc-7.3.0-final/mipsel-openwrt-linux-gnu/libgcc//libgcc_s.so.1: error adding symbols: DSO missing from command line
# collect2: error: ld returned 1 exit status
commit: 7a0d2c83bf2b0422e2d0ed297f847fc1eeb88bb3
Subject: mips: fix MIPS softfloat build issue
Author: Yousong Zhou <[email protected]>
The patch for o32.S is taken from OpenWrt packages repo 3a7a4bf "libffi:
fix MIPS softfloat build issue with current binutils"
Signed-off-by: Felix Fietkau <[email protected]>
Signed-off-by: Yousong Zhou <[email protected]>
--- a/libffi/src/mips/n32.S
+++ b/libffi/src/mips/n32.S
@@ -107,6 +107,16 @@ loadregs:
REG_L t6, 3*FFI_SIZEOF_ARG($fp) # load the flags word into t6.
+#ifdef __mips_soft_float
+ REG_L a0, 0*FFI_SIZEOF_ARG(t9)
+ REG_L a1, 1*FFI_SIZEOF_ARG(t9)
+ REG_L a2, 2*FFI_SIZEOF_ARG(t9)
+ REG_L a3, 3*FFI_SIZEOF_ARG(t9)
+ REG_L a4, 4*FFI_SIZEOF_ARG(t9)
+ REG_L a5, 5*FFI_SIZEOF_ARG(t9)
+ REG_L a6, 6*FFI_SIZEOF_ARG(t9)
+ REG_L a7, 7*FFI_SIZEOF_ARG(t9)
+#else
and t4, t6, ((1<<FFI_FLAG_BITS)-1)
REG_L a0, 0*FFI_SIZEOF_ARG(t9)
beqz t4, arg1_next
@@ -193,6 +203,7 @@ arg7_next:
arg8_doublep:
l.d $f19, 7*FFI_SIZEOF_ARG(t9)
arg8_next:
+#endif
callit:
# Load the function pointer
@@ -214,6 +225,7 @@ retint:
b epilogue
retfloat:
+#ifndef __mips_soft_float
bne t6, FFI_TYPE_FLOAT, retdouble
jal t9
REG_L t4, 4*FFI_SIZEOF_ARG($fp)
@@ -272,6 +284,7 @@ retstruct_f_d:
s.s $f0, 0(t4)
s.d $f2, 8(t4)
b epilogue
+#endif
retstruct_d_soft:
bne t6, FFI_TYPE_STRUCT_D_SOFT, retstruct_f_soft
@@ -429,6 +442,7 @@ ffi_closure_N32:
REG_S a6, A6_OFF2($sp)
REG_S a7, A7_OFF2($sp)
+#ifndef __mips_soft_float
# Store all possible float/double registers.
s.d $f12, F12_OFF2($sp)
s.d $f13, F13_OFF2($sp)
@@ -438,6 +452,7 @@ ffi_closure_N32:
s.d $f17, F17_OFF2($sp)
s.d $f18, F18_OFF2($sp)
s.d $f19, F19_OFF2($sp)
+#endif
# Call ffi_closure_mips_inner_N32 to do the real work.
LA t9, ffi_closure_mips_inner_N32
@@ -458,6 +473,7 @@ cls_retint:
b cls_epilogue
cls_retfloat:
+#ifndef __mips_soft_float
bne v0, FFI_TYPE_FLOAT, cls_retdouble
l.s $f0, V0_OFF2($sp)
b cls_epilogue
@@ -500,6 +516,7 @@ cls_retstruct_f_d:
l.s $f0, V0_OFF2($sp)
l.d $f2, V1_OFF2($sp)
b cls_epilogue
+#endif
cls_retstruct_small2:
REG_L v0, V0_OFF2($sp)
--- a/libffi/src/mips/o32.S
+++ b/libffi/src/mips/o32.S
@@ -82,13 +82,16 @@ sixteen:
ADDU $sp, 4 * FFI_SIZEOF_ARG # adjust $sp to new args
+#ifndef __mips_soft_float
bnez t0, pass_d # make it quick for int
+#endif
REG_L a0, 0*FFI_SIZEOF_ARG($sp) # just go ahead and load the
REG_L a1, 1*FFI_SIZEOF_ARG($sp) # four regs.
REG_L a2, 2*FFI_SIZEOF_ARG($sp)
REG_L a3, 3*FFI_SIZEOF_ARG($sp)
b call_it
+#ifndef __mips_soft_float
pass_d:
bne t0, FFI_ARGS_D, pass_f
l.d $f12, 0*FFI_SIZEOF_ARG($sp) # load $fp regs from args
@@ -130,6 +133,7 @@ pass_f_d:
# bne t0, FFI_ARGS_F_D, call_it
l.s $f12, 0*FFI_SIZEOF_ARG($sp) # load $fp regs from args
l.d $f14, 2*FFI_SIZEOF_ARG($sp) # passing double and float
+#endif
call_it:
# Load the function pointer
@@ -158,14 +162,23 @@ retfloat:
bne t2, FFI_TYPE_FLOAT, retdouble
jalr t9
REG_L t0, SIZEOF_FRAME + 4*FFI_SIZEOF_ARG($fp)
+#ifndef __mips_soft_float
s.s $f0, 0(t0)
+#else
+ REG_S v0, 0(t0)
+#endif
b epilogue
retdouble:
bne t2, FFI_TYPE_DOUBLE, noretval
jalr t9
REG_L t0, SIZEOF_FRAME + 4*FFI_SIZEOF_ARG($fp)
+#ifndef __mips_soft_float
s.d $f0, 0(t0)
+#else
+ REG_S v1, 4(t0)
+ REG_S v0, 0(t0)
+#endif
b epilogue
noretval:
@@ -261,9 +274,11 @@ $LCFI7:
li $13, 1 # FFI_O32
bne $16, $13, 1f # Skip fp save if FFI_O32_SOFT_FLOAT
+#ifndef __mips_soft_float
# Store all possible float/double registers.
s.d $f12, FA_0_0_OFF2($fp)
s.d $f14, FA_1_0_OFF2($fp)
+#endif
1:
# Call ffi_closure_mips_inner_O32 to do the work.
la t9, ffi_closure_mips_inner_O32
@@ -281,6 +296,7 @@ $LCFI7:
li $13, 1 # FFI_O32
bne $16, $13, 1f # Skip fp restore if FFI_O32_SOFT_FLOAT
+#ifndef __mips_soft_float
li $9, FFI_TYPE_FLOAT
l.s $f0, V0_OFF2($fp)
beq $8, $9, closure_done
@@ -288,6 +304,7 @@ $LCFI7:
li $9, FFI_TYPE_DOUBLE
l.d $f0, V0_OFF2($fp)
beq $8, $9, closure_done
+#endif
1:
REG_L $3, V1_OFF2($fp)
REG_L $2, V0_OFF2($fp)
CONFIG_TARGET_ramips=y
CONFIG_TARGET_ramips_mt7621=y
CONFIG_TARGET_ramips_mt7621_DEVICE_ubnt-erx=y
CONFIG_DEVEL=y
CONFIG_TOOLCHAINOPTS=y
CONFIG_GCC_LIBSSP=y
CONFIG_INSTALL_GCCGO=y
CONFIG_LIBC="glibc"
CONFIG_LIBC_USE_GLIBC=y
CONFIG_PACKAGE_librt=y
CONFIG_PACKAGE_libssp=y
CONFIG_STRIP_ARGS="--strip-all"
CONFIG_TARGET_SUFFIX="gnu"
CONFIG_USE_GLIBC=y
CONFIG_USE_STRIP=y
CONFIG_USE_UCLIBCXX=y
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment