diff options
Diffstat (limited to 'src/cmd/internal')
| -rw-r--r-- | src/cmd/internal/obj/loong64/asm.go | 9 | ||||
| -rw-r--r-- | src/cmd/internal/sys/arch.go | 1 |
2 files changed, 10 insertions, 0 deletions
diff --git a/src/cmd/internal/obj/loong64/asm.go b/src/cmd/internal/obj/loong64/asm.go index e20ceaae95..ca6e2be4aa 100644 --- a/src/cmd/internal/obj/loong64/asm.go +++ b/src/cmd/internal/obj/loong64/asm.go @@ -707,6 +707,15 @@ func span0(ctxt *obj.Link, cursym *obj.LSym, newprog obj.ProgAlloc) { // so instruction sequences that use REGTMP are unsafe to // preempt asynchronously. obj.MarkUnsafePoints(c.ctxt, c.cursym.Func().Text, c.newprog, c.isUnsafePoint, c.isRestartable) + + // Now that we know byte offsets, we can generate jump table entries. + for _, jt := range cursym.Func().JumpTables { + for i, p := range jt.Targets { + // The ith jumptable entry points to the p.Pc'th + // byte in the function symbol s. + jt.Sym.WriteAddr(ctxt, int64(i)*8, 8, cursym, p.Pc) + } + } } // isUnsafePoint returns whether p is an unsafe point. diff --git a/src/cmd/internal/sys/arch.go b/src/cmd/internal/sys/arch.go index 484538f28f..3c92a6bbf2 100644 --- a/src/cmd/internal/sys/arch.go +++ b/src/cmd/internal/sys/arch.go @@ -145,6 +145,7 @@ var ArchLoong64 = &Arch{ MinLC: 4, Alignment: 8, // Unaligned accesses are not guaranteed to be fast CanMergeLoads: true, + CanJumpTable: true, HasLR: true, FixedFrameSize: 8, // LR } |
