...

Source file src/cmd/link/internal/loong64/obj.go

Documentation: cmd/link/internal/loong64

     1  // Copyright 2022 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 loong64
     6  
     7  import (
     8  	"cmd/internal/objabi"
     9  	"cmd/internal/sys"
    10  	"cmd/link/internal/ld"
    11  )
    12  
    13  func Init() (*sys.Arch, ld.Arch) {
    14  	arch := sys.ArchLoong64
    15  
    16  	theArch := ld.Arch{
    17  		Funcalign:        funcAlign,
    18  		Maxalign:         maxAlign,
    19  		Minalign:         minAlign,
    20  		Dwarfregsp:       dwarfRegSP,
    21  		Dwarfreglr:       dwarfRegLR,
    22  		CodePad:          []byte{0x00, 0x00, 0x2a, 0x00}, // BREAK 0
    23  		Adddynrel:        adddynrel,
    24  		Archinit:         archinit,
    25  		Archreloc:        archreloc,
    26  		Archrelocvariant: archrelocvariant,
    27  		Extreloc:         extreloc,
    28  		Machoreloc1:      machoreloc1,
    29  		Gentext:          gentext,
    30  
    31  		ELF: ld.ELFArch{
    32  			Linuxdynld:     "/lib64/ld-linux-loongarch-lp64d.so.1",
    33  			LinuxdynldMusl: "/lib/ld-musl-loongarch64.so.1",
    34  			Freebsddynld:   "XXX",
    35  			Openbsddynld:   "XXX",
    36  			Netbsddynld:    "XXX",
    37  			Dragonflydynld: "XXX",
    38  			Solarisdynld:   "XXX",
    39  
    40  			Reloc1:    elfreloc1,
    41  			RelocSize: 24,
    42  			SetupPLT:  elfsetupplt,
    43  		},
    44  	}
    45  
    46  	return arch, theArch
    47  }
    48  
    49  func archinit(ctxt *ld.Link) {
    50  	switch ctxt.HeadType {
    51  	default:
    52  		ld.Exitf("unknown -H option: %v", ctxt.HeadType)
    53  	case objabi.Hlinux: /* loong64 elf */
    54  		ld.Elfinit(ctxt)
    55  		ld.HEADR = ld.ELFRESERVE
    56  		if *ld.FlagRound == -1 {
    57  			*ld.FlagRound = 0x10000
    58  		}
    59  		if *ld.FlagTextAddr == -1 {
    60  			*ld.FlagTextAddr = ld.Rnd(0x10000, *ld.FlagRound) + int64(ld.HEADR)
    61  		}
    62  	}
    63  }
    64  

View as plain text