Skip to content

cmd/compile, cmd/link: c-shared not supported on linux/loong64  #53301

@xiaobai394

Description

@xiaobai394

What version of Go are you using (go version)?

$ go version
go version go1.18 linux/loong64

Does this issue reproduce with the latest release?

yes

What operating system and processor architecture are you using (go env)?

go env Output
$ go env
GO111MODULE="on"
GOARCH="loong64"
GOBIN=""
GOCACHE="/home/uos/.cache/go-build"
GOENV="/home/uos/.config/go/env"
GOEXE=""
GOEXPERIMENT=""
GOFLAGS=""
GOHOSTARCH="loong64"
GOHOSTOS="linux"
GOINSECURE=""
GOMODCACHE="/home/uos/go/pkg/mod"
GONOPROXY="*.uniontech.com"
GONOSUMDB="*.uniontech.com"
GOOS="linux"
GOPATH="/home/uos/go"
GOPRIVATE=""
GOPROXY="https://goproxy.cn,direct"
GOROOT="/usr/share/ubxgo/go"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/usr/share/ubxgo/go/pkg/tool/linux_loong64"
GOVCS=""
GOVERSION="go1.18"
GCCGO="gccgo"
AR="ar"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD="/dev/null"
GOWORK=""
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -mabi=lp64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build1139878000=/tmp/go-build -gno-record-gcc-switches"

What did you do?

go build -x -buildmode=c-shared -o hello.so hello.go

-buildmode=c-shared not supported on linux/loong64

I tried modified source code to support c-shared

/usr/share/ubxgo/go/pkg/tool/linux_loong64/link -o $WORK/b001/exe/a.out -importcfg $WORK/b001/importcfg.link -installsuffix shared -buildmode=c-shared -buildid=VjSGCzgmjjJmng4hvW1p/WO5bAXmxALTE53mSBcMM/lLTTU0AieOjUvcGiNFbI/VjSGCzgmjjJmng4hvW1p -extld=gcc /home/uos/.cache/go-build/8a/8a684f2f6e11d470d52b1497952c1f44669b428ec4b5cbe654f378ab7a078f2b-d
#command-line-arguments
/usr/share/ubxgo/go/pkg/tool/linux_loong64/link: running gcc failed: exit status 1
collect2: fatal error: ld terminated with signal 11 [segfault]
compilation terminated.
package main
import "C"
//export hello
func hello(value string) *C.char {
        return C.CString("hello"+value)
}

func main() {

}

What did you expect to see?

What did you see instead?

Why doesn't loongarch supported c-shared mode?


Modified into English (origin Chinese)

Metadata

Metadata

Assignees

Labels

FeatureRequestIssues asking for a new feature that does not need a proposal.FrozenDueToAgeNeedsFixThe path to resolution is known, but the work has not been done.arch-loong64Issues solely affecting the loongson architecture.compiler/runtimeIssues related to the Go compiler and/or runtime.

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions