]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/internal/obj: add IsAsm flag
authorDavid Chase <drchase@google.com>
Thu, 23 Apr 2020 23:52:31 +0000 (19:52 -0400)
committerDavid Chase <drchase@google.com>
Fri, 24 Apr 2020 01:48:48 +0000 (01:48 +0000)
This allows more exciting changes to compiler-generated assembly
language that might not be correct for tricky hand-crafted
assembly (e.g., nop padding breaking tables of call or branch
instructions).

Updates #35881

Change-Id: I842b811796076c160180a364564f2844604df3fb
Reviewed-on: https://go-review.googlesource.com/c/go/+/229708
Run-TryBot: David Chase <drchase@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
src/cmd/asm/main.go
src/cmd/internal/obj/link.go

index a927de854b3e4015ee5511d3e42cce196974d664..9ca9797a45f4d4ca8b7406c286599922505aab90 100644 (file)
@@ -41,6 +41,7 @@ func main() {
        ctxt.Flag_dynlink = *flags.Dynlink
        ctxt.Flag_shared = *flags.Shared || *flags.Dynlink
        ctxt.Flag_go115newobj = *flags.Go115Newobj
+       ctxt.IsAsm = true
        switch *flags.Spectre {
        default:
                log.Printf("unknown setting -spectre=%s", *flags.Spectre)
index 046ad53ac7af0b8591d6a92cd9ac91866ae10a8d..c7bab6a2ca6351906092b67d1c2d3ce7dc290e8f 100644 (file)
@@ -675,7 +675,8 @@ type Link struct {
 
        InParallel           bool // parallel backend phase in effect
        Framepointer_enabled bool
-       UseBASEntries        bool // Use Base Address Selection Entries in location lists and PC ranges
+       UseBASEntries        bool // use Base Address Selection Entries in location lists and PC ranges
+       IsAsm                bool // is the source assembly language, which may contain surprising idioms (e.g., call tables)
 
        // state for writing objects
        Text []*LSym