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

     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  
    31  		// TrampLimit is set such that we always run the trampoline
    32  		// generation code. This is necessary since calls to external
    33  		// symbols require the use of trampolines, regardless of the
    34  		// text size.
    35  		TrampLimit: 1,
    36  		Trampoline: trampoline,
    37  
    38  		Gentext:     gentext,
    39  		GenSymsLate: genSymsLate,
    40  		Machoreloc1: machoreloc1,
    41  
    42  		Linuxdynld: "/lib/ld.so.1",
    43  
    44  		Freebsddynld:   "XXX",
    45  		Netbsddynld:    "XXX",
    46  		Openbsddynld:   "XXX",
    47  		Dragonflydynld: "XXX",
    48  		Solarisdynld:   "XXX",
    49  	}
    50  
    51  	return arch, theArch
    52  }
    53  
    54  func archinit(ctxt *ld.Link) {
    55  	switch ctxt.HeadType {
    56  	case objabi.Hlinux:
    57  		ld.Elfinit(ctxt)
    58  		ld.HEADR = ld.ELFRESERVE
    59  		if *ld.FlagTextAddr == -1 {
    60  			*ld.FlagTextAddr = 0x10000 + int64(ld.HEADR)
    61  		}
    62  		if *ld.FlagRound == -1 {
    63  			*ld.FlagRound = 0x10000
    64  		}
    65  	default:
    66  		ld.Exitf("unknown -H option: %v", ctxt.HeadType)
    67  	}
    68  }
    69  

View as plain text