aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/link
diff options
context:
space:
mode:
authorCherry Mui <cherryyz@google.com>2022-05-05 17:45:27 -0400
committerCherry Mui <cherryyz@google.com>2022-05-11 22:59:46 +0000
commit6e03de7b83426fa2f598c428a19db707a845bf7e (patch)
tree06003a502e04aab9bb03b990b02cc7e95640be45 /src/cmd/link
parentb89a1948893d2c6c04497030eb78addd6fd7daf3 (diff)
downloadgo-6e03de7b83426fa2f598c428a19db707a845bf7e.tar.xz
cmd/asm: require -p flag
CL 391014 requires the compiler to be invoked with the -p flag, to specify the package path. Later, CL 394217 makes the compiler to produce an unlinkable object file, so "go tool compile x.go" can still be used on the command line. This CL does the same for the assembler, requiring -p, otherwise generating an unlinkable object. No special case for the main package, as the main package cannot be only assembly code, and there is no way to tell if it is the main package from an assembly file. Now we guarantee that we always have an expanded package path in the object file. A later CL will delete the name expansion code in the linker. Change-Id: I8c10661aaea2ff794614924ead958d80e7e2487d Reviewed-on: https://go-review.googlesource.com/c/go/+/404298 Run-TryBot: Cherry Mui <cherryyz@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Than McIntosh <thanm@google.com> Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Diffstat (limited to 'src/cmd/link')
-rw-r--r--src/cmd/link/link_test.go4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/cmd/link/link_test.go b/src/cmd/link/link_test.go
index ac68008d8d..d86f81fac8 100644
--- a/src/cmd/link/link_test.go
+++ b/src/cmd/link/link_test.go
@@ -235,9 +235,9 @@ void foo() {
cflags := strings.Fields(runGo("env", "GOGCCFLAGS"))
// Compile, assemble and pack the Go and C code.
- runGo("tool", "asm", "-gensymabis", "-o", "symabis", "x.s")
+ runGo("tool", "asm", "-p=main", "-gensymabis", "-o", "symabis", "x.s")
runGo("tool", "compile", "-symabis", "symabis", "-p=main", "-o", "x1.o", "main.go")
- runGo("tool", "asm", "-o", "x2.o", "x.s")
+ runGo("tool", "asm", "-p=main", "-o", "x2.o", "x.s")
run(cc, append(cflags, "-c", "-o", "x3.o", "x.c")...)
runGo("tool", "pack", "c", "x.a", "x1.o", "x2.o", "x3.o")