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

     1  //go:build go1.16 && !go1.23
     2  // +build go1.16,!go1.23
     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 16
    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 32
    25  	default:
    26  		panic(fmt.Errorf("not support arch:%s", arch.Name))
    27  	}
    28  }