aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/internal/goobj
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/internal/goobj
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/internal/goobj')
-rw-r--r--src/cmd/internal/goobj/objfile.go10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/cmd/internal/goobj/objfile.go b/src/cmd/internal/goobj/objfile.go
index 665fa41475..34c5bb97f8 100644
--- a/src/cmd/internal/goobj/objfile.go
+++ b/src/cmd/internal/goobj/objfile.go
@@ -281,10 +281,10 @@ const SymSize = stringRefSize + 2 + 1 + 1 + 1 + 4 + 4
const SymABIstatic = ^uint16(0)
const (
- ObjFlagShared = 1 << iota // this object is built with -shared
- ObjFlagNeedNameExpansion // the linker needs to expand `"".` to package path in symbol names
- ObjFlagFromAssembly // object is from asm src, not go
- ObjFlagUnlinkable // unlinkable package (linker will emit an error)
+ ObjFlagShared = 1 << iota // this object is built with -shared
+ _ // was ObjFlagNeedNameExpansion
+ ObjFlagFromAssembly // object is from asm src, not go
+ ObjFlagUnlinkable // unlinkable package (linker will emit an error)
)
// Sym.Flag
@@ -873,6 +873,6 @@ func (r *Reader) Flags() uint32 {
}
func (r *Reader) Shared() bool { return r.Flags()&ObjFlagShared != 0 }
-func (r *Reader) NeedNameExpansion() bool { return r.Flags()&ObjFlagNeedNameExpansion != 0 }
+func (r *Reader) NeedNameExpansion() bool { return false } // TODO: delete
func (r *Reader) FromAssembly() bool { return r.Flags()&ObjFlagFromAssembly != 0 }
func (r *Reader) Unlinkable() bool { return r.Flags()&ObjFlagUnlinkable != 0 }