Black Lives Matter. Support the Equal Justice Initiative.

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

Documentation: cmd/link/internal/riscv64

     1  // Copyright 2019 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 riscv64
     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.ArchRISCV64
    15  
    16  	theArch := ld.Arch{
    17  		Funcalign:  funcAlign,
    18  		Maxalign:   maxAlign,
    19  		Minalign:   minAlign,
    20  		Dwarfregsp: dwarfRegSP,
    21  		Dwarfreglr: dwarfRegLR,
    22  
    23  		Archinit:         archinit,
    24  		Archreloc:        archreloc,
    25  		Archrelocvariant: archrelocvariant,
    26  		Extreloc:         extreloc,
    27  		Elfreloc1:        elfreloc1,
    28  		ElfrelocSize:     24,
    29  		Elfsetupplt:      elfsetupplt,
    30  		Gentext:          gentext,
    31  		GenSymsLate:      genSymsLate,
    32  		Machoreloc1:      machoreloc1,
    33  
    34  		Linuxdynld: "/lib/ld.so.1",
    35  
    36  		Freebsddynld:   "XXX",
    37  		Netbsddynld:    "XXX",
    38  		Openbsddynld:   "XXX",
    39  		Dragonflydynld: "XXX",
    40  		Solarisdynld:   "XXX",
    41  	}
    42  
    43  	return arch, theArch
    44  }
    45  
    46  func archinit(ctxt *ld.Link) {
    47  	switch ctxt.HeadType {
    48  	case objabi.Hlinux:
    49  		ld.Elfinit(ctxt)
    50  		ld.HEADR = ld.ELFRESERVE
    51  		if *ld.FlagTextAddr == -1 {
    52  			*ld.FlagTextAddr = 0x10000 + int64(ld.HEADR)
    53  		}
    54  		if *ld.FlagRound == -1 {
    55  			*ld.FlagRound = 0x10000
    56  		}
    57  	default:
    58  		ld.Exitf("unknown -H option: %v", ctxt.HeadType)
    59  	}
    60  }
    61  

View as plain text