*: mark riscv64 port as experimental (#3835)

Delete non-working prologue detection code and mark port as experimental.

Updates #3832
This commit is contained in:
Alessandro Arzilli 2024-10-14 20:04:03 +02:00 committed by GitHub
parent 75c41f2b64
commit 05dc760877
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 27 additions and 65 deletions

@ -51,9 +51,9 @@ func NewMakeCommands() *cobra.Command {
envflags = append(envflags, "GOOS="+OS) envflags = append(envflags, "GOOS="+OS)
} }
if len(envflags) > 0 { if len(envflags) > 0 {
executeEnv(envflags, "go", "build", "-ldflags", "-extldflags -static", tagFlags(), buildFlags(), DelveMainPackagePath) executeEnv(envflags, "go", "build", "-ldflags", "-extldflags -static", tagFlags(false), buildFlags(), DelveMainPackagePath)
} else { } else {
execute("go", "build", "-ldflags", "-extldflags -static", tagFlags(), buildFlags(), DelveMainPackagePath) execute("go", "build", "-ldflags", "-extldflags -static", tagFlags(false), buildFlags(), DelveMainPackagePath)
} }
if runtime.GOOS == "darwin" && os.Getenv("CERT") != "" && canMacnative() && !isCodesigned("./dlv") { if runtime.GOOS == "darwin" && os.Getenv("CERT") != "" && canMacnative() && !isCodesigned("./dlv") {
codesign("./dlv") codesign("./dlv")
@ -70,7 +70,7 @@ func NewMakeCommands() *cobra.Command {
Use: "install", Use: "install",
Short: "Installs delve", Short: "Installs delve",
Run: func(cmd *cobra.Command, args []string) { Run: func(cmd *cobra.Command, args []string) {
execute("go", "install", tagFlags(), buildFlags(), DelveMainPackagePath) execute("go", "install", tagFlags(false), buildFlags(), DelveMainPackagePath)
if runtime.GOOS == "darwin" && os.Getenv("CERT") != "" && canMacnative() && !isCodesigned(installedExecutablePath()) { if runtime.GOOS == "darwin" && os.Getenv("CERT") != "" && canMacnative() && !isCodesigned(installedExecutablePath()) {
codesign(installedExecutablePath()) codesign(installedExecutablePath())
} }
@ -293,17 +293,22 @@ func prepareMacnative() string {
return "macnative" return "macnative"
} }
func tagFlags() string { func tagFlags(isTest bool) string {
var tags []string var tags []string
if mactags := prepareMacnative(); mactags != "" { if mactags := prepareMacnative(); mactags != "" {
tags = append(tags, mactags) tags = append(tags, mactags)
} }
if isTest {
if runtime.GOOS == "windows" && runtime.GOARCH == "arm64" { if runtime.GOOS == "windows" && runtime.GOARCH == "arm64" {
tags = append(tags, "exp.winarm64") tags = append(tags, "exp.winarm64")
} }
if runtime.GOOS == "linux" && runtime.GOARCH == "ppc64le" { if runtime.GOOS == "linux" && runtime.GOARCH == "ppc64le" {
tags = append(tags, "exp.linuxppc64le") tags = append(tags, "exp.linuxppc64le")
} }
if runtime.GOOS == "linux" && runtime.GOARCH == "riscv64" {
tags = append(tags, "exp.linuxriscv64")
}
}
if Tags != nil && len(*Tags) > 0 { if Tags != nil && len(*Tags) > 0 {
tags = append(tags, *Tags...) tags = append(tags, *Tags...)
} }
@ -462,11 +467,11 @@ func testCmdIntl(testSet, testRegex, testBackend, testBuildMode string) {
} }
if len(testPackages) > 3 { if len(testPackages) > 3 {
executeq(env, "go", "test", testFlags(), buildFlags(), tagFlags(), testPackages, backendFlag, buildModeFlag) executeq(env, "go", "test", testFlags(), buildFlags(), tagFlags(true), testPackages, backendFlag, buildModeFlag)
} else if testRegex != "" { } else if testRegex != "" {
executeq(env, "go", "test", testFlags(), buildFlags(), tagFlags(), testPackages, "-run="+testRegex, backendFlag, buildModeFlag) executeq(env, "go", "test", testFlags(), buildFlags(), tagFlags(true), testPackages, "-run="+testRegex, backendFlag, buildModeFlag)
} else { } else {
executeq(env, "go", "test", testFlags(), buildFlags(), tagFlags(), testPackages, backendFlag, buildModeFlag) executeq(env, "go", "test", testFlags(), buildFlags(), tagFlags(true), testPackages, backendFlag, buildModeFlag)
} }
} }
@ -505,7 +510,7 @@ func inpath(exe string) bool {
func allPackages() []string { func allPackages() []string {
r := []string{} r := []string{}
for _, dir := range strings.Split(getoutput("go", "list", "-mod=vendor", tagFlags(), "./..."), "\n") { for _, dir := range strings.Split(getoutput("go", "list", "-mod=vendor", tagFlags(true), "./..."), "\n") {
dir = strings.TrimSpace(dir) dir = strings.TrimSpace(dir)
if dir == "" || strings.Contains(dir, "/vendor/") || strings.Contains(dir, "/_scripts") { if dir == "" || strings.Contains(dir, "/vendor/") || strings.Contains(dir, "/_scripts") {
continue continue

@ -83,23 +83,15 @@ func projectRoot() string {
func TestBuild(t *testing.T) { func TestBuild(t *testing.T) {
const listenAddr = "127.0.0.1:40573" const listenAddr = "127.0.0.1:40573"
var err error
cmd := exec.Command("go", "run", "_scripts/make.go", "build") dlvbin := getDlvBin(t)
cmd.Dir = projectRoot()
out, err := cmd.CombinedOutput()
if err != nil {
t.Fatalf("makefile error: %v\noutput %s\n", err, string(out))
}
dlvbin := filepath.Join(cmd.Dir, "dlv")
defer os.Remove(dlvbin) defer os.Remove(dlvbin)
fixtures := protest.FindFixturesDir() fixtures := protest.FindFixturesDir()
buildtestdir := filepath.Join(fixtures, "buildtest") buildtestdir := filepath.Join(fixtures, "buildtest")
cmd = exec.Command(dlvbin, "debug", "--headless=true", "--listen="+listenAddr, "--api-version=2", "--backend="+testBackend, "--log", "--log-output=debugger,rpc") cmd := exec.Command(dlvbin, "debug", "--headless=true", "--listen="+listenAddr, "--api-version=2", "--backend="+testBackend, "--log", "--log-output=debugger,rpc")
cmd.Dir = buildtestdir cmd.Dir = buildtestdir
stderr, err := cmd.StderrPipe() stderr, err := cmd.StderrPipe()
assertNoError(err, t, "stderr pipe") assertNoError(err, t, "stderr pipe")
@ -215,6 +207,9 @@ func getDlvBin(t *testing.T) string {
if runtime.GOOS == "linux" && runtime.GOARCH == "ppc64le" { if runtime.GOOS == "linux" && runtime.GOARCH == "ppc64le" {
tags = "-tags=exp.linuxppc64le" tags = "-tags=exp.linuxppc64le"
} }
if runtime.GOOS == "linux" && runtime.GOARCH == "riscv64" {
tags = "-tags=exp.linuxriscv64"
}
return getDlvBinInternal(t, tags) return getDlvBinInternal(t, tags)
} }
@ -1483,23 +1478,14 @@ func TestUnixDomainSocket(t *testing.T) {
listenPath := filepath.Join(tmpdir, "delve_test") listenPath := filepath.Join(tmpdir, "delve_test")
var err error dlvbin := getDlvBin(t)
cmd := exec.Command("go", "run", "_scripts/make.go", "build")
cmd.Dir = projectRoot()
out, err := cmd.CombinedOutput()
if err != nil {
t.Fatalf("makefile error: %v\noutput %s\n", err, string(out))
}
dlvbin := filepath.Join(cmd.Dir, "dlv")
defer os.Remove(dlvbin) defer os.Remove(dlvbin)
fixtures := protest.FindFixturesDir() fixtures := protest.FindFixturesDir()
buildtestdir := filepath.Join(fixtures, "buildtest") buildtestdir := filepath.Join(fixtures, "buildtest")
cmd = exec.Command(dlvbin, "debug", "--headless=true", "--listen=unix:"+listenPath, "--api-version=2", "--backend="+testBackend, "--log", "--log-output=debugger,rpc") cmd := exec.Command(dlvbin, "debug", "--headless=true", "--listen=unix:"+listenPath, "--api-version=2", "--backend="+testBackend, "--log", "--log-output=debugger,rpc")
cmd.Dir = buildtestdir cmd.Dir = buildtestdir
stderr, err := cmd.StderrPipe() stderr, err := cmd.StderrPipe()
assertNoError(err, t, "stderr pipe") assertNoError(err, t, "stderr pipe")

@ -1,4 +1,4 @@
//go:build linux && !amd64 && !arm64 && !386 && !(ppc64le && exp.linuxppc64le) && !riscv64 //go:build linux && !amd64 && !arm64 && !386 && !(ppc64le && exp.linuxppc64le) && !(riscv64 && exp.linuxriscv64)
// This file is used to detect build on unsupported GOOS/GOARCH combinations. // This file is used to detect build on unsupported GOOS/GOARCH combinations.

@ -26,7 +26,7 @@ func RISCV64Arch(goos string) *Arch {
altBreakpointInstruction: riscv64BreakInstruction, altBreakpointInstruction: riscv64BreakInstruction,
breakInstrMovesPC: false, breakInstrMovesPC: false,
derefTLS: false, derefTLS: false,
prologues: prologuesRISCV64, prologues: nil,
fixFrameUnwindContext: riscv64FixFrameUnwindContext, fixFrameUnwindContext: riscv64FixFrameUnwindContext,
switchStack: riscv64SwitchStack, switchStack: riscv64SwitchStack,
regSize: riscv64RegSize, regSize: riscv64RegSize,

@ -116,35 +116,6 @@ func resolveCallArgRISCV64(inst *riscv64asm.Inst, instAddr uint64, currentGorout
return &Location{PC: pc, File: file, Line: line, Fn: fn} return &Location{PC: pc, File: file, Line: line, Fn: fn}
} }
// Possible stacksplit prologues are inserted by stacksplit in
// $GOROOT/src/cmd/internal/obj/riscv/obj.go.
var prologuesRISCV64 []opcodeSeq
func init() {
var tinyStacksplit = opcodeSeq{uint64(riscv64asm.ADDI)}
var smallStacksplit = opcodeSeq{}
var bigStacksplit = opcodeSeq{uint64(riscv64asm.LUI),
uint64(riscv64asm.ADDIW),
uint64(riscv64asm.BLTU),
uint64(riscv64asm.LUI),
uint64(riscv64asm.ADDIW),
uint64(riscv64asm.ADD)}
var unixGetG = opcodeSeq{uint64(riscv64asm.LD)}
var tailPrologues = opcodeSeq{uint64(riscv64asm.BLTU),
uint64(riscv64asm.JAL),
uint64(riscv64asm.JAL)}
prologuesRISCV64 = make([]opcodeSeq, 0, 3)
for _, stacksplit := range []opcodeSeq{tinyStacksplit, smallStacksplit, bigStacksplit} {
prologue := make(opcodeSeq, 0, len(unixGetG)+len(stacksplit)+len(tailPrologues))
prologue = append(prologue, unixGetG...)
prologue = append(prologue, stacksplit...)
prologue = append(prologue, tailPrologues...)
prologuesRISCV64 = append(prologuesRISCV64, prologue)
}
}
type riscv64ArchInst riscv64asm.Inst type riscv64ArchInst riscv64asm.Inst
func (inst *riscv64ArchInst) Text(flavour AssemblyFlavour, pc uint64, symLookup func(uint64) (string, uint64)) string { func (inst *riscv64ArchInst) Text(flavour AssemblyFlavour, pc uint64, symLookup func(uint64) (string, uint64)) string {