1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31 package arm64
32
33 import (
34 "cmd/internal/objabi"
35 "cmd/internal/sys"
36 "cmd/link/internal/ld"
37 )
38
39 func Init() (*sys.Arch, ld.Arch) {
40 arch := sys.ArchARM64
41
42 theArch := ld.Arch{
43 Funcalign: funcAlign,
44 Maxalign: maxAlign,
45 Minalign: minAlign,
46 Dwarfregsp: dwarfRegSP,
47 Dwarfreglr: dwarfRegLR,
48 TrampLimit: 0x7c00000,
49
50 Adddynrel: adddynrel,
51 Archinit: archinit,
52 Archreloc: archreloc,
53 Archrelocvariant: archrelocvariant,
54 Extreloc: extreloc,
55 Elfreloc1: elfreloc1,
56 ElfrelocSize: 24,
57 Elfsetupplt: elfsetupplt,
58 Gentext: gentext,
59 GenSymsLate: gensymlate,
60 Machoreloc1: machoreloc1,
61 MachorelocSize: 8,
62 PEreloc1: pereloc1,
63 Trampoline: trampoline,
64
65 Androiddynld: "/system/bin/linker64",
66 Linuxdynld: "/lib/ld-linux-aarch64.so.1",
67
68 Freebsddynld: "/usr/libexec/ld-elf.so.1",
69 Openbsddynld: "/usr/libexec/ld.so",
70 Netbsddynld: "/libexec/ld.elf_so",
71 Dragonflydynld: "XXX",
72 Solarisdynld: "XXX",
73 }
74
75 return arch, theArch
76 }
77
78 func archinit(ctxt *ld.Link) {
79 switch ctxt.HeadType {
80 default:
81 ld.Exitf("unknown -H option: %v", ctxt.HeadType)
82
83 case objabi.Hplan9:
84 ld.HEADR = 32
85
86 if *ld.FlagTextAddr == -1 {
87 *ld.FlagTextAddr = 4096 + int64(ld.HEADR)
88 }
89 if *ld.FlagRound == -1 {
90 *ld.FlagRound = 4096
91 }
92
93 case objabi.Hlinux,
94 objabi.Hfreebsd,
95 objabi.Hnetbsd,
96 objabi.Hopenbsd:
97 ld.Elfinit(ctxt)
98 ld.HEADR = ld.ELFRESERVE
99 if *ld.FlagTextAddr == -1 {
100 *ld.FlagTextAddr = 0x10000 + int64(ld.HEADR)
101 }
102 if *ld.FlagRound == -1 {
103 *ld.FlagRound = 0x10000
104 }
105
106 case objabi.Hdarwin:
107 ld.HEADR = ld.INITIAL_MACHO_HEADR
108 if *ld.FlagTextAddr == -1 {
109 *ld.FlagTextAddr = 1<<32 + int64(ld.HEADR)
110 }
111 if *ld.FlagRound == -1 {
112 *ld.FlagRound = 16384
113 }
114
115 case objabi.Hwindows:
116
117 return
118 }
119 }
120
View as plain text