Subversion Repositories planix.SVN

Rev

Rev 2 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
2 - 1
.TH 8L 1 
2
.SH NAME
3
0l, 5l, 6l, 8l, 9l, kl, ql, vl \- loaders
4
.SH SYNOPSIS
5
.B 8l
6
[
7
.I option ...
8
]
9
[
10
.I file ...
11
]
12
.br
13
etc.
14
.SH DESCRIPTION
15
These commands
16
load the named
17
.I files
18
into executable files for the corresponding architectures; see
19
.IR 8c (1)
20
for the correspondence between an architecture and the character
21
.RB ( 6 ,
22
.RB 8 ,
23
etc.) that specifies it.
24
The files should be object files or libraries (archives of object files)
25
for the appropriate architecture.
26
Also, a name like
27
.BI -l ext
28
represents the library
29
.BI lib ext .a
30
in
31
.BR /$objtype/lib ,
32
where
33
.I objtype
34
is one of
35
.BR 386 ,
36
etc. as listed in
37
.IR 8c (1).
38
If the environment variable
39
.B ccroot
40
is defined, the library is sought in
41
.BR $ccroot/$objtype/lib
42
instead.
43
The libraries must have tables of contents
44
(see
45
.IR ar (1)).
46
.PP
47
In practice, 
48
.B -l
49
options are rarely necessary as the header files for
50
the libraries cause their archives to be included automatically in the load
51
(see
52
.IR 8c (1)).
53
For example, any program that includes header file
54
.B libc.h
55
causes the loader
56
to search the C library
57
.BR /$objtype/lib/libc.a .
58
Also, the loader creates an undefined symbol
59
.B _main
60
(or
61
.B _mainp
62
if profiling is enabled) to force loading of the
63
startup linkage from the C library.
64
.PP
65
The order of search to resolve undefined symbols is to load all files and libraries
66
mentioned explicitly on the command line, and then to resolve remaining symbols
67
by searching in topological order
68
libraries mentioned in header files included by files already loaded.
69
When scanning such libraries, the algorithm is to scan each library repeatedly until
70
no new undefined symbols are picked up, then to start on the next library.  Thus if library
71
.I A
72
needs
73
.I B
74
which needs
75
.I A
76
again, it may be necessary to mention
77
.I A
78
explicitly so it will be read a second time.
79
.PP
80
The loader options are:
81
.TP 0.75i
82
.B -l
83
(As a bare option.)
84
Suppress the default loading of the startup linkage and libraries
85
specified by header files.
86
.TP
87
.BI -o " out"
88
Place output in file
89
.IR out .
90
Default is
91
.IB O .out\f1,
92
where
93
.I O
94
is the first letter of the loader name.
95
.TP
96
.B -p
97
Insert profiling code into the executable output; no special action is needed
98
during compilation or assembly.
99
.TP
100
.B -e
101
Insert (\fLe\fPmbedded) tracing code into the executable output; no special action is needed
102
during compilation or assembly.
103
The added code calls
104
.L _tracein
105
at function entries
106
and
107
.L _traceout
108
at function exits.
109
.TP
110
.B -s
111
Strip the symbol tables from the output file.
112
.TP
113
.B -a
114
Print the object code in assembly language, with addresses.
115
.TP
116
.B -v
117
Print debugging output that annotates the activities of the load.
118
.TP
119
.BI -M
120
.RI ( Kl
121
only) Generate instructions rather than calls to emulation routines
122
for multiply and divide.
123
.TP
124
.BI -E symbol
125
The entry point for the binary is
126
.I symbol
127
(default
128
.BR _main ;
129
.B _mainp
130
under
131
.BR -p ).
132
.TP
133
.BI -x " [ file ]"
134
Produce an export table in the executable.
135
The optional
136
.I file
137
restricts the exported symbols to those listed in the file.
138
See
139
.IR dynld (2).
140
.TP
141
.BI -u " [ file ]"
142
Produce an export table, import table
143
and a dynamic load section in the executable.
144
The optional
145
.I file
146
restricts the imported symbols to those listed in the file.
147
See
148
.IR dynld (2).
149
.TP
150
.B -t
151
(\c
152
.I 5l
153
and
154
.I vl
155
only)
156
Move strings into the text segment.
157
.TP
158
.B -f
159
(\c
160
.I 5l
161
only)
162
Generate VFP hardware floating-point instructions.
163
Without this option,
164
.I 5l
165
generates arm7500 floating-point
166
instructions which are emulated in the kernel.
167
.br
168
.ne 6
169
.TP
170
.BI -H n
171
Executable header is type
172
.IR n .
173
The meaning of the types is architecture-dependent; typically
174
type 1 is Plan 9 boot format and type 2 is the
175
regular Plan 9 format, the default.  These are reversed on the MIPS.
176
The Next boot format is 3.  Type 4 in
177
.I vl
178
creates a MIPS executable for an SGI Unix system.
179
There is often a type that produces ELF or ELF64 format;
180
5 for ELF is common.
181
See
182
.B obj.c
183
in the source directory for a complete list.
184
.TP
185
.B -k
186
(ELF only)
187
Executable is a standalone boot image or kernel.
188
.TP
189
.BI -T t
190
The text segment starts at (virtual) address
191
.IR t .
192
.TP
193
.BI -P t
194
(ELF only)
195
The text segment starts at physical address
196
.I t
197
(by default the text segment's virtual start address).
198
.TP
199
.BI -D d
200
The data segment starts at address
201
.IR d .
202
.TP
203
.BI -R r
204
The text segment is rounded to a multiple of
205
.I r
206
(if
207
.I r
208
is nonzero).
209
.TP
210
.BI -L dir
211
For a library reference
212
.BI -l ext,
213
search
214
.I dir
215
before looking in the standard library directory.
216
If more than one
217
.B -L
218
option is given,
219
directories will be searched in order of appearance.
220
.PP
221
The numbers in the above options can begin with
222
.L 0x
223
or
224
.L 0
225
to change the default base from decimal to hexadecimal or octal.
226
The defaults for the values depend on the compiler and the
227
header type.
228
.PP
229
The loaded image has several symbols inserted by the loader:
230
.B etext
231
is the address of the end of the text segment;
232
.B bdata
233
is the address of the beginning of the data segment;
234
.B edata
235
is the address of the end of the data segment;
236
and
237
.B end
238
is the address of the end of the bss segment, and of the program.
239
.SH FILES
240
.TF /$objtype/lib
241
.TP
242
.B /$objtype/lib
243
for
244
.BI -l lib
245
arguments.
246
.SH SOURCE
247
.BR /sys/src/cmd/8l ,
248
etc.
249
.SH "SEE ALSO"
250
.IR 8c (1),
251
.IR 8a (1),
252
.IR ar (1),
253
.IR nm (1),
254
.IR db (1),
255
.IR prof (1)
256
.PP
257
Rob Pike,
258
``How to Use the Plan 9 C Compiler''
259
.SH BUGS
260
The list of loaders given above is only partial,
261
not all architectures are supported on all systems,
262
some have been retired and some
263
are provided by third parties.