...
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 Gentext: gentext,
56 GenSymsLate: gensymlate,
57 Machoreloc1: machoreloc1,
58 MachorelocSize: 8,
59 PEreloc1: pereloc1,
60 Trampoline: trampoline,
61
62 ELF: ld.ELFArch{
63 Androiddynld: "/system/bin/linker64",
64 Linuxdynld: "/lib/ld-linux-aarch64.so.1",
65 LinuxdynldMusl: "/lib/ld-musl-aarch64.so.1",
66
67 Freebsddynld: "/usr/libexec/ld-elf.so.1",
68 Openbsddynld: "/usr/libexec/ld.so",
69 Netbsddynld: "/libexec/ld.elf_so",
70 Dragonflydynld: "XXX",
71 Solarisdynld: "XXX",
72
73 Reloc1: elfreloc1,
74 RelocSize: 24,
75 SetupPLT: elfsetupplt,
76 },
77 }
78
79 return arch, theArch
80 }
81
82 func archinit(ctxt *ld.Link) {
83 switch ctxt.HeadType {
84 default:
85 ld.Exitf("unknown -H option: %v", ctxt.HeadType)
86
87 case objabi.Hplan9:
88 ld.HEADR = 32
89 if *ld.FlagRound == -1 {
90 *ld.FlagRound = 4096
91 }
92 if *ld.FlagTextAddr == -1 {
93 *ld.FlagTextAddr = ld.Rnd(4096, *ld.FlagRound) + int64(ld.HEADR)
94 }
95
96 case objabi.Hlinux,
97 objabi.Hfreebsd,
98 objabi.Hnetbsd,
99 objabi.Hopenbsd:
100 ld.Elfinit(ctxt)
101 ld.HEADR = ld.ELFRESERVE
102 if *ld.FlagRound == -1 {
103 *ld.FlagRound = 0x10000
104 }
105 if *ld.FlagTextAddr == -1 {
106 *ld.FlagTextAddr = ld.Rnd(0x10000, *ld.FlagRound) + int64(ld.HEADR)
107 }
108
109 case objabi.Hdarwin:
110 ld.HEADR = ld.INITIAL_MACHO_HEADR
111 if *ld.FlagRound == -1 {
112 *ld.FlagRound = 16384
113 }
114 if *ld.FlagTextAddr == -1 {
115 *ld.FlagTextAddr = ld.Rnd(1<<32, *ld.FlagRound) + int64(ld.HEADR)
116 }
117
118 case objabi.Hwindows:
119
120 return
121 }
122 }
123
View as plain text