8l 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271
  1. .TH 8L 1
  2. .SH NAME
  3. 0l, 5l, 6l, 8l, 9l, il, jl, 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. .TP
  168. .B -c
  169. (\c
  170. .I il
  171. and
  172. .I jl
  173. only)
  174. don't generate compressed instructions
  175. .br
  176. .ne 6
  177. .TP
  178. .BI -H n
  179. Executable header is type
  180. .IR n .
  181. The meaning of the types is architecture-dependent; typically
  182. type 1 is Plan 9 boot format and type 2 is the
  183. regular Plan 9 format, the default. These are reversed on the MIPS.
  184. The Next boot format is 3. Type 4 in
  185. .I vl
  186. creates a MIPS executable for an SGI Unix system.
  187. There is often a type that produces ELF or ELF64 format;
  188. 5 for ELF is common.
  189. See
  190. .B obj.c
  191. in the source directory for a complete list.
  192. .TP
  193. .B -k
  194. (ELF only)
  195. Executable is a standalone boot image or kernel.
  196. .TP
  197. .BI -T t
  198. The text segment starts at (virtual) address
  199. .IR t .
  200. .TP
  201. .BI -P t
  202. (ELF only)
  203. The text segment starts at physical address
  204. .I t
  205. (by default the text segment's virtual start address).
  206. .TP
  207. .BI -D d
  208. The data segment starts at address
  209. .IR d .
  210. .TP
  211. .BI -R r
  212. The text segment is rounded to a multiple of
  213. .I r
  214. (if
  215. .I r
  216. is nonzero).
  217. .TP
  218. .BI -L dir
  219. For a library reference
  220. .BI -l ext,
  221. search
  222. .I dir
  223. before looking in the standard library directory.
  224. If more than one
  225. .B -L
  226. option is given,
  227. directories will be searched in order of appearance.
  228. .PP
  229. The numbers in the above options can begin with
  230. .L 0x
  231. or
  232. .L 0
  233. to change the default base from decimal to hexadecimal or octal.
  234. The defaults for the values depend on the compiler and the
  235. header type.
  236. .PP
  237. The loaded image has several symbols inserted by the loader:
  238. .B etext
  239. is the address of the end of the text segment;
  240. .B bdata
  241. is the address of the beginning of the data segment;
  242. .B edata
  243. is the address of the end of the data segment;
  244. and
  245. .B end
  246. is the address of the end of the bss segment, and of the program.
  247. .SH FILES
  248. .TF /$objtype/lib
  249. .TP
  250. .B /$objtype/lib
  251. for
  252. .BI -l lib
  253. arguments.
  254. .SH SOURCE
  255. .BR /sys/src/cmd/8l ,
  256. etc.
  257. .SH "SEE ALSO"
  258. .IR 8c (1),
  259. .IR 8a (1),
  260. .IR ar (1),
  261. .IR nm (1),
  262. .IR db (1),
  263. .IR prof (1)
  264. .PP
  265. Rob Pike,
  266. ``How to Use the Plan 9 C Compiler''
  267. .SH BUGS
  268. The list of loaders given above is only partial,
  269. not all architectures are supported on all systems,
  270. some have been retired and some
  271. are provided by third parties.