github.com/pkujhd/goloader@v0.0.0-20240411034752-1a28096bd7bd/objabi/funcalign/funcalign.1.8.go (about)

     1  //go:build go1.8 && !go1.15
     2  // +build go1.8,!go1.15
     3  
     4  package funcalign
     5  
     6  import (
     7  	"cmd/objfile/sys"
     8  	"fmt"
     9  )
    10  
    11  func GetFuncAlign(arch *sys.Arch) int {
    12  	switch arch.Name {
    13  	//see:^cmd/linker/internal/arm/l.go
    14  	case sys.ArchARM.Name:
    15  		return 4
    16  	//see:^cmd/linker/internal/arm64/l.go
    17  	case sys.ArchARM64.Name:
    18  		return 8
    19  	//see:^cmd/linker/internal/x86/l.go
    20  	case sys.Arch386.Name:
    21  		return 16
    22  	// see:^cmd/linker/internal/amd64/l.go
    23  	case sys.ArchAMD64.Name:
    24  		return 16
    25  	default:
    26  		panic(fmt.Errorf("not support arch:%s", arch.Name))
    27  	}
    28  }