[FS#1498] Building gccgo failes

LEDE Bugs lede-bugs at lists.infradead.org
Mon Apr 16 08:18:26 PDT 2018


A new Flyspray task has been opened.  Details are below. 

User who did this - Dominik Menke (dmke) 

Attached to Project - OpenWrt/LEDE Project
Summary - Building gccgo failes
Task Type - Build Failure
Category - Toolchain
Status - Unconfirmed
Assigned To - 
Operating System - All
Severity - Medium
Priority - Very Low
Reported Version - Trunk
Due in Version - Undecided
Due Date - Undecided
Details - Hi,

I'm currently trying to cross-compile Go binaries for MIPS/soft-float.
My target system is an Ubiquiti EdgeRouterX (mt7621 Soc), you can find
my .config here:

https://gist.github.com/dmke/a4f673eb89862ef9dc2724c238480bb9#file-config

I don't need to compile go code on the ERX hardware, I only need the
gccgo compiler from the toolchain for cross-compiling. However,
building the toolchain (toolchain/gcc/final) breaks with some unsupported
processor opcodes:

  $LEDE_ROOT/build_dir/toolchain-mipsel_24kc_gcc-7.3.0_glibc/gcc-7.3.0/libffi/src/mips/o32.S: Assembler messages:
  .../o32.S:94: Error: opcode not supported on this processor: mips32r2 (mips32r2) `l.d $f12,0*4($sp)'
  .../o32.S:101: Error: opcode not supported on this processor: mips32r2 (mips32r2) `l.s $f12,0*4($sp)'
  .../o32.S:109: Error: opcode not supported on this processor: mips32r2 (mips32r2) `l.d $f12,0*4($sp)'
  .../o32.S:110: Error: opcode not supported on this processor: mips32r2 (mips32r2) `l.d $f14,2*4($sp)'
  .../o32.S:115: Error: opcode not supported on this processor: mips32r2 (mips32r2) `l.s $f12,0*4($sp)'
  .../o32.S:116: Error: opcode not supported on this processor: mips32r2 (mips32r2) `l.s $f14,1*4($sp)'
  .../o32.S:123: Error: opcode not supported on this processor: mips32r2 (mips32r2) `l.d $f12,0*4($sp)'
  .../o32.S:124: Error: opcode not supported on this processor: mips32r2 (mips32r2) `l.s $f14,2*4($sp)'
  .../o32.S:131: Error: opcode not supported on this processor: mips32r2 (mips32r2) `l.s $f12,0*4($sp)'
  .../o32.S:132: Error: opcode not supported on this processor: mips32r2 (mips32r2) `l.d $f14,2*4($sp)'
  .../o32.S:161: Error: opcode not supported on this processor: mips32r2 (mips32r2) `s.s $f0,0($8)'
  .../o32.S:168: Error: opcode not supported on this processor: mips32r2 (mips32r2) `s.d $f0,0($8)'
  .../o32.S:265: Error: opcode not supported on this processor: mips32r2 (mips32r2) `s.d $f12,((14*4)-10*4)($fp)'
  .../o32.S:266: Error: opcode not supported on this processor: mips32r2 (mips32r2) `s.d $f14,((14*4)-8*4)($fp)'
  .../o32.S:285: Error: opcode not supported on this processor: mips32r2 (mips32r2) `l.s $f0,((14*4)-6*4)($fp)'
  .../o32.S:289: Error: opcode not supported on this processor: mips32r2 (mips32r2) `l.d $f0,((14*4)-6*4)($fp)'

(the aforementioned gist contains repro code in form of a pseudo shell
script with more output, in case this gets unreadably formatted :-))

I've come accross this a commit in libffi [1], which seems to be
included in the packages repo [2] (which in my case isn't enough).

[1]: https://github.com/libffi/libffi/commit/7a0d2c83bf2b0422e2d0ed297f847fc1eeb88bb3
[2]: https://git.openwrt.org/?p=feed/packages.git;a=commit;h=3a7a4bf

After tinkering with the patch a bit, I've come up with this modified
patch:

https://gist.github.com/dmke/a4f673eb89862ef9dc2724c238480bb9#file-301-fix-mips-fix-mips-softfloat-build-issue-patch

That however fails to compile gccgo's go command:

  $ $LEDE_SOURCE/build_dir/toolchain-mipsel_24kc_gcc-7.3.0_glibc/gcc-7.3.0-final/./gcc/gccgo -B$LEDE_SOURCE/build_dir/toolchain-mipsel_24kc_gcc-7.3.0_glibc/gcc-7.3.0-final/./gcc/ -B$LEDE_SOURCE/staging_dir/toolchain-mipsel_24kc_gcc-7.3.0_glibc/mipsel-openwrt-linux-gnu/bin/ -B$LEDE_SOURCE/staging_dir/toolchain-mipsel_24kc_gcc-7.3.0_glibc/mipsel-openwrt-linux-gnu/lib/ -isystem $LEDE_SOURCE/staging_dir/toolchain-mipsel_24kc_gcc-7.3.0_glibc/mipsel-openwrt-linux-gnu/include -isystem $LEDE_SOURCE/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_SOURCE/build_dir/toolchain-mipsel_24kc_gcc-7.3.0_glibc/gcc-7.3.0/gotools/../libgo/go/cmd/go/alldocs.go $LEDE_SOURCE/build_dir/toolchain-mipsel_24kc_gcc-7.3.0_glibc/gcc-7.3.0/gotools/../libgo/go/cmd/go/bug.go $LEDE_SOURCE/build_dir/toolchain-mipsel_24kc_gcc-7.3.0_glibc/gcc-7.3.0/gotools/../libgo/go/cmd/go/build.go $LEDE_SOURCE/build_dir/toolchain-mipsel_24kc_gcc-7.3.0_glibc/gcc-7.3.0/gotools/../libgo/go/cmd/go/clean.go $LEDE_SOURCE/build_dir/toolchain-mipsel_24kc_gcc-7.3.0_glibc/gcc-7.3.0/gotools/../libgo/go/cmd/go/context.go $LEDE_SOURCE/build_dir/toolchain-mipsel_24kc_gcc-7.3.0_glibc/gcc-7.3.0/gotools/../libgo/go/cmd/go/discovery.go $LEDE_SOURCE/build_dir/toolchain-mipsel_24kc_gcc-7.3.0_glibc/gcc-7.3.0/gotools/../libgo/go/cmd/go/doc.go $LEDE_SOURCE/build_dir/toolchain-mipsel_24kc_gcc-7.3.0_glibc/gcc-7.3.0/gotools/../libgo/go/cmd/go/env.go $LEDE_SOURCE/build_dir/toolchain-mipsel_24kc_gcc-7.3.0_glibc/gcc-7.3.0/gotools/../libgo/go/cmd/go/fix.go $LEDE_SOURCE/build_dir/toolchain-mipsel_24kc_gcc-7.3.0_glibc/gcc-7.3.0/gotools/../libgo/go/cmd/go/fmt.go $LEDE_SOURCE/build_dir/toolchain-mipsel_24kc_gcc-7.3.0_glibc/gcc-7.3.0/gotools/../libgo/go/cmd/go/generate.go $LEDE_SOURCE/build_dir/toolchain-mipsel_24kc_gcc-7.3.0_glibc/gcc-7.3.0/gotools/../libgo/go/cmd/go/get.go $LEDE_SOURCE/build_dir/toolchain-mipsel_24kc_gcc-7.3.0_glibc/gcc-7.3.0/gotools/../libgo/go/cmd/go/go11.go $LEDE_SOURCE/build_dir/toolchain-mipsel_24kc_gcc-7.3.0_glibc/gcc-7.3.0/gotools/../libgo/go/cmd/go/help.go $LEDE_SOURCE/build_dir/toolchain-mipsel_24kc_gcc-7.3.0_glibc/gcc-7.3.0/gotools/../libgo/go/cmd/go/http.go $LEDE_SOURCE/build_dir/toolchain-mipsel_24kc_gcc-7.3.0_glibc/gcc-7.3.0/gotools/../libgo/go/cmd/go/list.go $LEDE_SOURCE/build_dir/toolchain-mipsel_24kc_gcc-7.3.0_glibc/gcc-7.3.0/gotools/../libgo/go/cmd/go/main.go $LEDE_SOURCE/build_dir/toolchain-mipsel_24kc_gcc-7.3.0_glibc/gcc-7.3.0/gotools/../libgo/go/cmd/go/note.go $LEDE_SOURCE/build_dir/toolchain-mipsel_24kc_gcc-7.3.0_glibc/gcc-7.3.0/gotools/../libgo/go/cmd/go/pkg.go $LEDE_SOURCE/build_dir/toolchain-mipsel_24kc_gcc-7.3.0_glibc/gcc-7.3.0/gotools/../libgo/go/cmd/go/run.go $LEDE_SOURCE/build_dir/toolchain-mipsel_24kc_gcc-7.3.0_glibc/gcc-7.3.0/gotools/../libgo/go/cmd/go/signal.go $LEDE_SOURCE/build_dir/toolchain-mipsel_24kc_gcc-7.3.0_glibc/gcc-7.3.0/gotools/../libgo/go/cmd/go/signal_unix.go $LEDE_SOURCE/build_dir/toolchain-mipsel_24kc_gcc-7.3.0_glibc/gcc-7.3.0/gotools/../libgo/go/cmd/go/test.go $LEDE_SOURCE/build_dir/toolchain-mipsel_24kc_gcc-7.3.0_glibc/gcc-7.3.0/gotools/../libgo/go/cmd/go/testflag.go $LEDE_SOURCE/build_dir/toolchain-mipsel_24kc_gcc-7.3.0_glibc/gcc-7.3.0/gotools/../libgo/go/cmd/go/tool.go $LEDE_SOURCE/build_dir/toolchain-mipsel_24kc_gcc-7.3.0_glibc/gcc-7.3.0/gotools/../libgo/go/cmd/go/vcs.go $LEDE_SOURCE/build_dir/toolchain-mipsel_24kc_gcc-7.3.0_glibc/gcc-7.3.0/gotools/../libgo/go/cmd/go/version.go $LEDE_SOURCE/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_SOURCE/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)

I've found you'll need to call gccgo with additional parameters

-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/

which gets me a step closer, but still 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

That's currently way over my head. Where do I continue?

More information can be found at the following URL:
https://bugs.openwrt.org/index.php?do=details&task_id=1498



More information about the lede-bugs mailing list