1
2
3
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 TrampLimit: 0x7c00000,
23 CodePad: []byte{0x00, 0x00, 0x2a, 0x00},
24 Adddynrel: adddynrel,
25 Archinit: archinit,
26 Archreloc: archreloc,
27 Archrelocvariant: archrelocvariant,
28 Extreloc: extreloc,
29 Machoreloc1: machoreloc1,
30 Gentext: gentext,
31 Trampoline: trampoline,
32
33 ELF: ld.ELFArch{
34 Linuxdynld: "/lib64/ld-linux-loongarch-lp64d.so.1",
35 LinuxdynldMusl: "/lib/ld-musl-loongarch64.so.1",
36 Freebsddynld: "XXX",
37 Openbsddynld: "XXX",
38 Netbsddynld: "XXX",
39 Dragonflydynld: "XXX",
40 Solarisdynld: "XXX",
41
42 Reloc1: elfreloc1,
43 RelocSize: 24,
44 SetupPLT: elfsetupplt,
45 },
46 }
47
48 return arch, theArch
49 }
50
51 func archinit(ctxt *ld.Link) {
52 switch ctxt.HeadType {
53 default:
54 ld.Exitf("unknown -H option: %v", ctxt.HeadType)
55 case objabi.Hlinux:
56 ld.Elfinit(ctxt)
57 ld.HEADR = ld.ELFRESERVE
58 if *ld.FlagRound == -1 {
59 *ld.FlagRound = 0x10000
60 }
61 if *ld.FlagTextAddr == -1 {
62 *ld.FlagTextAddr = ld.Rnd(0x10000, *ld.FlagRound) + int64(ld.HEADR)
63 }
64 }
65 }
66
View as plain text