OpenHarmony开发者论坛
标题:
用官方SDK交叉编译go语言项目报汇编语法错误,如gcc_arm64.S:68:19: error: expected ']' in brackets expression ldp x21, x22, [sp, #64]
[打印本页]
作者:
Goplush233
时间:
2024-4-10 20:49
标题:
用官方SDK交叉编译go语言项目报汇编语法错误,如gcc_arm64.S:68:19: error: expected ']' in brackets expression ldp x21, x22, [sp, #64]
[md]SDK用的是每日构建的ohos-sdk-full(链接:
https://ci.openharmony.cn/workbench/cicd/dailybuild/dailylist
go env如下:
```
GO111MODULE=''
GOARCH='arm64'
GOBIN=''
GOCACHE='/root/.cache/go-build'
GOENV='/root/.config/go/env'
GOEXE=''
GOEXPERIMENT=''
GOFLAGS=''
GOHOSTARCH='amd64'
GOHOSTOS='linux'
GOINSECURE=''
GOMODCACHE='/root/.gvm/pkgsets/go1.22.2/global/pkg/mod'
GONOPROXY=''
GONOSUMDB=''
GOOS='linux'
GOPATH='/root/.gvm/pkgsets/go1.22.2/global'
GOPRIVATE=''
GOPROXY='https://proxy.golang.org,direct'
GOROOT='/root/.gvm/gos/go1.22.2'
GOSUMDB='sum.golang.org'
GOTMPDIR=''
GOTOOLCHAIN='auto'
GOTOOLDIR='/root/.gvm/gos/go1.22.2/pkg/tool/linux_amd64'
GOVCS=''
GOVERSION='go1.22.2'
GCCGO='gccgo'
AR='/root/ohsdk/ohos-sdk/linux/native/llvm/bin/llvm-ar'
CC='/root/ohsdk/ohos-sdk/linux/native/llvm/bin/clang'
CXX='g++'
CGO_ENABLED='1'
GOMOD='/root/.gvm/pkgsets/go1.22.2/global/pkg/mod/github.com/!giorgos-!p/!hash!graph!b!f!
t@v0.0.0
-20210614211555-b5ed5205ea1e/go.mod'
GOWORK=''
CGO_CFLAGS='-O2 -g'
CGO_CPPFLAGS=''
CGO_CXXFLAGS='-O2 -g'
CGO_FFLAGS='-O2 -g'
CGO_LDFLAGS='-O2 -g'
PKG_CONFIG='pkg-config'
GOGCCFLAGS='-fPIC -pthread -fno-caret-diagnostics -Qunused-arguments -Wl,--no-gc-sections -fmessage-length=0 -ffile-prefix-map=/tmp/go-build1739006907=/tmp/go-build -gno-record-gcc-switches'
```
报错信息如下:
```
#runtime/cgo
gcc_arm64.S:30:19: error: expected ']' in brackets expression
stp x29, x30, [sp, #-96]!
^
gcc_arm64.S:34:2: error: unknown use of instruction mnemonic without a size suffix
mov x29, sp
^
gcc_arm64.S:36:19: error: expected ']' in brackets expression
stp x19, x20, [sp, #80]
^
gcc_arm64.S:39:19: error: expected ']' in brackets expression
stp x21, x22, [sp, #64]
^
gcc_arm64.S:42:19: error: expected ']' in brackets expression
stp x23, x24, [sp, #48]
^
gcc_arm64.S:45:19: error: expected ']' in brackets expression
stp x25, x26, [sp, #32]
^
gcc_arm64.S:48:19: error: expected ']' in brackets expression
stp x27, x28, [sp, #16]
^
gcc_arm64.S:52:2: error: unknown use of instruction mnemonic without a size suffix
mov x19, x0
^
gcc_arm64.S:53:2: error: unknown use of instruction mnemonic without a size suffix
mov x20, x1
^
gcc_arm64.S:54:2: error: unknown use of instruction mnemonic without a size suffix
mov x0, x2
^
gcc_arm64.S:56:2: error: invalid instruction mnemonic 'blr'
blr x20
^~~
gcc_arm64.S:57:2: error: invalid instruction mnemonic 'blr'
blr x19
^~~
gcc_arm64.S:59:19: error: expected ']' in brackets expression
ldp x27, x28, [sp, #16]
^
gcc_arm64.S:62:19: error: expected ']' in brackets expression
ldp x25, x26, [sp, #32]
^
gcc_arm64.S:65:19: error: expected ']' in brackets expression
ldp x23, x24, [sp, #48]
^
gcc_arm64.S:68:19: error: expected ']' in brackets expression
ldp x21, x22, [sp, #64]
^
gcc_arm64.S:71:19: error: expected ']' in brackets expression
ldp x19, x20, [sp, #80]
^
gcc_arm64.S:74:22: error: unknown token in expression
ldp x29, x30, [sp], #96
```
在交叉编译中不止一次出现类似问题,可能是什么原因导致的,有什么解决方法吗
[/md]
作者:
论坛小助手
时间:
2024-4-16 10:05
检查以下汇编指令的使用是否正确,或者看看与目标架构是否兼容
欢迎光临 OpenHarmony开发者论坛 (https://forums.openharmony.cn/)
Powered by Discuz! X3.5