github.com/megatontech/mynoteforgo@v0.0.0-20200507084910-5d0c6ea6e890/源码/cmd/link/internal/wasm/obj.go (about)

     1  // Copyright 2018 The Go Authors. All rights reserved.
     2  // Use of this source code is governed by a BSD-style
     3  // license that can be found in the LICENSE file.
     4  
     5  package wasm
     6  
     7  import (
     8  	"cmd/internal/sys"
     9  	"cmd/link/internal/ld"
    10  )
    11  
    12  func Init() (*sys.Arch, ld.Arch) {
    13  	theArch := ld.Arch{
    14  		Funcalign: 16,
    15  		Maxalign:  32,
    16  		Minalign:  1,
    17  
    18  		Archinit:      archinit,
    19  		AssignAddress: assignAddress,
    20  		Asmb:          asmb,
    21  		Gentext:       gentext,
    22  	}
    23  
    24  	return sys.ArchWasm, theArch
    25  }
    26  
    27  func archinit(ctxt *ld.Link) {
    28  	if *ld.FlagRound == -1 {
    29  		*ld.FlagRound = 4096
    30  	}
    31  	if *ld.FlagTextAddr == -1 {
    32  		*ld.FlagTextAddr = 0
    33  	}
    34  }