Nie możesz wybrać więcej, niż 25 tematów Tematy muszą się zaczynać od litery lub cyfry, mogą zawierać myślniki ('-') i mogą mieć do 35 znaków.

1239 lines
54KB

  1. .\" Automatically generated by Pod::Man 2.27 (Pod::Simple 3.28)
  2. .\"
  3. .\" Standard preamble:
  4. .\" ========================================================================
  5. .de Sp \" Vertical space (when we can't use .PP)
  6. .if t .sp .5v
  7. .if n .sp
  8. ..
  9. .de Vb \" Begin verbatim text
  10. .ft CW
  11. .nf
  12. .ne \\$1
  13. ..
  14. .de Ve \" End verbatim text
  15. .ft R
  16. .fi
  17. ..
  18. .\" Set up some character translations and predefined strings. \*(-- will
  19. .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
  20. .\" double quote, and \*(R" will give a right double quote. \*(C+ will
  21. .\" give a nicer C++. Capital omega is used to do unbreakable dashes and
  22. .\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff,
  23. .\" nothing in troff, for use with C<>.
  24. .tr \(*W-
  25. .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
  26. .ie n \{\
  27. . ds -- \(*W-
  28. . ds PI pi
  29. . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch
  30. . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch
  31. . ds L" ""
  32. . ds R" ""
  33. . ds C` ""
  34. . ds C' ""
  35. 'br\}
  36. .el\{\
  37. . ds -- \|\(em\|
  38. . ds PI \(*p
  39. . ds L" ``
  40. . ds R" ''
  41. . ds C`
  42. . ds C'
  43. 'br\}
  44. .\"
  45. .\" Escape single quotes in literal strings from groff's Unicode transform.
  46. .ie \n(.g .ds Aq \(aq
  47. .el .ds Aq '
  48. .\"
  49. .\" If the F register is turned on, we'll generate index entries on stderr for
  50. .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index
  51. .\" entries marked with X<> in POD. Of course, you'll have to process the
  52. .\" output yourself in some meaningful fashion.
  53. .\"
  54. .\" Avoid warning from groff about undefined register 'F'.
  55. .de IX
  56. ..
  57. .nr rF 0
  58. .if \n(.g .if rF .nr rF 1
  59. .if (\n(rF:(\n(.g==0)) \{
  60. . if \nF \{
  61. . de IX
  62. . tm Index:\\$1\t\\n%\t"\\$2"
  63. ..
  64. . if !\nF==2 \{
  65. . nr % 0
  66. . nr F 2
  67. . \}
  68. . \}
  69. .\}
  70. .rr rF
  71. .\"
  72. .\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
  73. .\" Fear. Run. Save yourself. No user-serviceable parts.
  74. . \" fudge factors for nroff and troff
  75. .if n \{\
  76. . ds #H 0
  77. . ds #V .8m
  78. . ds #F .3m
  79. . ds #[ \f1
  80. . ds #] \fP
  81. .\}
  82. .if t \{\
  83. . ds #H ((1u-(\\\\n(.fu%2u))*.13m)
  84. . ds #V .6m
  85. . ds #F 0
  86. . ds #[ \&
  87. . ds #] \&
  88. .\}
  89. . \" simple accents for nroff and troff
  90. .if n \{\
  91. . ds ' \&
  92. . ds ` \&
  93. . ds ^ \&
  94. . ds , \&
  95. . ds ~ ~
  96. . ds /
  97. .\}
  98. .if t \{\
  99. . ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u"
  100. . ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'
  101. . ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'
  102. . ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'
  103. . ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'
  104. . ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'
  105. .\}
  106. . \" troff and (daisy-wheel) nroff accents
  107. .ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V'
  108. .ds 8 \h'\*(#H'\(*b\h'-\*(#H'
  109. .ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#]
  110. .ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'
  111. .ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'
  112. .ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#]
  113. .ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#]
  114. .ds ae a\h'-(\w'a'u*4/10)'e
  115. .ds Ae A\h'-(\w'A'u*4/10)'E
  116. . \" corrections for vroff
  117. .if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'
  118. .if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'
  119. . \" for low resolution devices (crt and lpr)
  120. .if \n(.H>23 .if \n(.V>19 \
  121. \{\
  122. . ds : e
  123. . ds 8 ss
  124. . ds o a
  125. . ds d- d\h'-1'\(ga
  126. . ds D- D\h'-1'\(hy
  127. . ds th \o'bp'
  128. . ds Th \o'LP'
  129. . ds ae ae
  130. . ds Ae AE
  131. .\}
  132. .rm #[ #] #H #V #F C
  133. .\" ========================================================================
  134. .\"
  135. .IX Title "OBJCOPY 1"
  136. .TH OBJCOPY 1 "2020-11-24" "binutils-2.35.1" "GNU Development Tools"
  137. .\" For nroff, turn off justification. Always turn off hyphenation; it makes
  138. .\" way too many mistakes in technical documents.
  139. .if n .ad l
  140. .nh
  141. .SH "NAME"
  142. objcopy \- copy and translate object files
  143. .SH "SYNOPSIS"
  144. .IX Header "SYNOPSIS"
  145. objcopy [\fB\-F\fR \fIbfdname\fR|\fB\-\-target=\fR\fIbfdname\fR]
  146. [\fB\-I\fR \fIbfdname\fR|\fB\-\-input\-target=\fR\fIbfdname\fR]
  147. [\fB\-O\fR \fIbfdname\fR|\fB\-\-output\-target=\fR\fIbfdname\fR]
  148. [\fB\-B\fR \fIbfdarch\fR|\fB\-\-binary\-architecture=\fR\fIbfdarch\fR]
  149. [\fB\-S\fR|\fB\-\-strip\-all\fR]
  150. [\fB\-g\fR|\fB\-\-strip\-debug\fR]
  151. [\fB\-\-strip\-unneeded\fR]
  152. [\fB\-K\fR \fIsymbolname\fR|\fB\-\-keep\-symbol=\fR\fIsymbolname\fR]
  153. [\fB\-N\fR \fIsymbolname\fR|\fB\-\-strip\-symbol=\fR\fIsymbolname\fR]
  154. [\fB\-\-strip\-unneeded\-symbol=\fR\fIsymbolname\fR]
  155. [\fB\-G\fR \fIsymbolname\fR|\fB\-\-keep\-global\-symbol=\fR\fIsymbolname\fR]
  156. [\fB\-\-localize\-hidden\fR]
  157. [\fB\-L\fR \fIsymbolname\fR|\fB\-\-localize\-symbol=\fR\fIsymbolname\fR]
  158. [\fB\-\-globalize\-symbol=\fR\fIsymbolname\fR]
  159. [\fB\-\-globalize\-symbols=\fR\fIfilename\fR]
  160. [\fB\-W\fR \fIsymbolname\fR|\fB\-\-weaken\-symbol=\fR\fIsymbolname\fR]
  161. [\fB\-w\fR|\fB\-\-wildcard\fR]
  162. [\fB\-x\fR|\fB\-\-discard\-all\fR]
  163. [\fB\-X\fR|\fB\-\-discard\-locals\fR]
  164. [\fB\-b\fR \fIbyte\fR|\fB\-\-byte=\fR\fIbyte\fR]
  165. [\fB\-i\fR [\fIbreadth\fR]|\fB\-\-interleave\fR[=\fIbreadth\fR]]
  166. [\fB\-\-interleave\-width=\fR\fIwidth\fR]
  167. [\fB\-j\fR \fIsectionpattern\fR|\fB\-\-only\-section=\fR\fIsectionpattern\fR]
  168. [\fB\-R\fR \fIsectionpattern\fR|\fB\-\-remove\-section=\fR\fIsectionpattern\fR]
  169. [\fB\-\-keep\-section=\fR\fIsectionpattern\fR]
  170. [\fB\-\-remove\-relocations=\fR\fIsectionpattern\fR]
  171. [\fB\-p\fR|\fB\-\-preserve\-dates\fR]
  172. [\fB\-D\fR|\fB\-\-enable\-deterministic\-archives\fR]
  173. [\fB\-U\fR|\fB\-\-disable\-deterministic\-archives\fR]
  174. [\fB\-\-debugging\fR]
  175. [\fB\-\-gap\-fill=\fR\fIval\fR]
  176. [\fB\-\-pad\-to=\fR\fIaddress\fR]
  177. [\fB\-\-set\-start=\fR\fIval\fR]
  178. [\fB\-\-adjust\-start=\fR\fIincr\fR]
  179. [\fB\-\-change\-addresses=\fR\fIincr\fR]
  180. [\fB\-\-change\-section\-address\fR \fIsectionpattern\fR{=,+,\-}\fIval\fR]
  181. [\fB\-\-change\-section\-lma\fR \fIsectionpattern\fR{=,+,\-}\fIval\fR]
  182. [\fB\-\-change\-section\-vma\fR \fIsectionpattern\fR{=,+,\-}\fIval\fR]
  183. [\fB\-\-change\-warnings\fR] [\fB\-\-no\-change\-warnings\fR]
  184. [\fB\-\-set\-section\-flags\fR \fIsectionpattern\fR=\fIflags\fR]
  185. [\fB\-\-set\-section\-alignment\fR \fIsectionpattern\fR=\fIalign\fR]
  186. [\fB\-\-add\-section\fR \fIsectionname\fR=\fIfilename\fR]
  187. [\fB\-\-dump\-section\fR \fIsectionname\fR=\fIfilename\fR]
  188. [\fB\-\-update\-section\fR \fIsectionname\fR=\fIfilename\fR]
  189. [\fB\-\-rename\-section\fR \fIoldname\fR=\fInewname\fR[,\fIflags\fR]]
  190. [\fB\-\-long\-section\-names\fR {enable,disable,keep}]
  191. [\fB\-\-change\-leading\-char\fR] [\fB\-\-remove\-leading\-char\fR]
  192. [\fB\-\-reverse\-bytes=\fR\fInum\fR]
  193. [\fB\-\-srec\-len=\fR\fIival\fR] [\fB\-\-srec\-forceS3\fR]
  194. [\fB\-\-redefine\-sym\fR \fIold\fR=\fInew\fR]
  195. [\fB\-\-redefine\-syms=\fR\fIfilename\fR]
  196. [\fB\-\-weaken\fR]
  197. [\fB\-\-keep\-symbols=\fR\fIfilename\fR]
  198. [\fB\-\-strip\-symbols=\fR\fIfilename\fR]
  199. [\fB\-\-strip\-unneeded\-symbols=\fR\fIfilename\fR]
  200. [\fB\-\-keep\-global\-symbols=\fR\fIfilename\fR]
  201. [\fB\-\-localize\-symbols=\fR\fIfilename\fR]
  202. [\fB\-\-weaken\-symbols=\fR\fIfilename\fR]
  203. [\fB\-\-add\-symbol\fR \fIname\fR=[\fIsection\fR:]\fIvalue\fR[,\fIflags\fR]]
  204. [\fB\-\-alt\-machine\-code=\fR\fIindex\fR]
  205. [\fB\-\-prefix\-symbols=\fR\fIstring\fR]
  206. [\fB\-\-prefix\-sections=\fR\fIstring\fR]
  207. [\fB\-\-prefix\-alloc\-sections=\fR\fIstring\fR]
  208. [\fB\-\-add\-gnu\-debuglink=\fR\fIpath-to-file\fR]
  209. [\fB\-\-keep\-file\-symbols\fR]
  210. [\fB\-\-only\-keep\-debug\fR]
  211. [\fB\-\-strip\-dwo\fR]
  212. [\fB\-\-extract\-dwo\fR]
  213. [\fB\-\-extract\-symbol\fR]
  214. [\fB\-\-writable\-text\fR]
  215. [\fB\-\-readonly\-text\fR]
  216. [\fB\-\-pure\fR]
  217. [\fB\-\-impure\fR]
  218. [\fB\-\-file\-alignment=\fR\fInum\fR]
  219. [\fB\-\-heap=\fR\fIsize\fR]
  220. [\fB\-\-image\-base=\fR\fIaddress\fR]
  221. [\fB\-\-section\-alignment=\fR\fInum\fR]
  222. [\fB\-\-stack=\fR\fIsize\fR]
  223. [\fB\-\-subsystem=\fR\fIwhich\fR:\fImajor\fR.\fIminor\fR]
  224. [\fB\-\-compress\-debug\-sections\fR]
  225. [\fB\-\-decompress\-debug\-sections\fR]
  226. [\fB\-\-elf\-stt\-common=\fR\fIval\fR]
  227. [\fB\-\-merge\-notes\fR]
  228. [\fB\-\-no\-merge\-notes\fR]
  229. [\fB\-\-verilog\-data\-width=\fR\fIval\fR]
  230. [\fB\-v\fR|\fB\-\-verbose\fR]
  231. [\fB\-V\fR|\fB\-\-version\fR]
  232. [\fB\-\-help\fR] [\fB\-\-info\fR]
  233. \fIinfile\fR [\fIoutfile\fR]
  234. .SH "DESCRIPTION"
  235. .IX Header "DESCRIPTION"
  236. The \s-1GNU \s0\fBobjcopy\fR utility copies the contents of an object
  237. file to another. \fBobjcopy\fR uses the \s-1GNU BFD\s0 Library to
  238. read and write the object files. It can write the destination object
  239. file in a format different from that of the source object file. The
  240. exact behavior of \fBobjcopy\fR is controlled by command-line options.
  241. Note that \fBobjcopy\fR should be able to copy a fully linked file
  242. between any two formats. However, copying a relocatable object file
  243. between any two formats may not work as expected.
  244. .PP
  245. \&\fBobjcopy\fR creates temporary files to do its translations and
  246. deletes them afterward. \fBobjcopy\fR uses \s-1BFD\s0 to do all its
  247. translation work; it has access to all the formats described in \s-1BFD\s0
  248. and thus is able to recognize most formats without being told
  249. explicitly.
  250. .PP
  251. \&\fBobjcopy\fR can be used to generate S\-records by using an output
  252. target of \fBsrec\fR (e.g., use \fB\-O srec\fR).
  253. .PP
  254. \&\fBobjcopy\fR can be used to generate a raw binary file by using an
  255. output target of \fBbinary\fR (e.g., use \fB\-O binary\fR). When
  256. \&\fBobjcopy\fR generates a raw binary file, it will essentially produce
  257. a memory dump of the contents of the input object file. All symbols and
  258. relocation information will be discarded. The memory dump will start at
  259. the load address of the lowest section copied into the output file.
  260. .PP
  261. When generating an S\-record or a raw binary file, it may be helpful to
  262. use \fB\-S\fR to remove sections containing debugging information. In
  263. some cases \fB\-R\fR will be useful to remove sections which contain
  264. information that is not needed by the binary file.
  265. .PP
  266. Note\-\-\-\fBobjcopy\fR is not able to change the endianness of its input
  267. files. If the input format has an endianness (some formats do not),
  268. \&\fBobjcopy\fR can only copy the inputs into file formats that have the
  269. same endianness or which have no endianness (e.g., \fBsrec\fR).
  270. (However, see the \fB\-\-reverse\-bytes\fR option.)
  271. .SH "OPTIONS"
  272. .IX Header "OPTIONS"
  273. .IP "\fIinfile\fR" 4
  274. .IX Item "infile"
  275. .PD 0
  276. .IP "\fIoutfile\fR" 4
  277. .IX Item "outfile"
  278. .PD
  279. The input and output files, respectively.
  280. If you do not specify \fIoutfile\fR, \fBobjcopy\fR creates a
  281. temporary file and destructively renames the result with
  282. the name of \fIinfile\fR.
  283. .IP "\fB\-I\fR \fIbfdname\fR" 4
  284. .IX Item "-I bfdname"
  285. .PD 0
  286. .IP "\fB\-\-input\-target=\fR\fIbfdname\fR" 4
  287. .IX Item "--input-target=bfdname"
  288. .PD
  289. Consider the source file's object format to be \fIbfdname\fR, rather than
  290. attempting to deduce it.
  291. .IP "\fB\-O\fR \fIbfdname\fR" 4
  292. .IX Item "-O bfdname"
  293. .PD 0
  294. .IP "\fB\-\-output\-target=\fR\fIbfdname\fR" 4
  295. .IX Item "--output-target=bfdname"
  296. .PD
  297. Write the output file using the object format \fIbfdname\fR.
  298. .IP "\fB\-F\fR \fIbfdname\fR" 4
  299. .IX Item "-F bfdname"
  300. .PD 0
  301. .IP "\fB\-\-target=\fR\fIbfdname\fR" 4
  302. .IX Item "--target=bfdname"
  303. .PD
  304. Use \fIbfdname\fR as the object format for both the input and the output
  305. file; i.e., simply transfer data from source to destination with no
  306. translation.
  307. .IP "\fB\-B\fR \fIbfdarch\fR" 4
  308. .IX Item "-B bfdarch"
  309. .PD 0
  310. .IP "\fB\-\-binary\-architecture=\fR\fIbfdarch\fR" 4
  311. .IX Item "--binary-architecture=bfdarch"
  312. .PD
  313. Useful when transforming a architecture-less input file into an object file.
  314. In this case the output architecture can be set to \fIbfdarch\fR. This
  315. option will be ignored if the input file has a known \fIbfdarch\fR. You
  316. can access this binary data inside a program by referencing the special
  317. symbols that are created by the conversion process. These symbols are
  318. called _binary_\fIobjfile\fR_start, _binary_\fIobjfile\fR_end and
  319. _binary_\fIobjfile\fR_size. e.g. you can transform a picture file into
  320. an object file and then access it in your code using these symbols.
  321. .IP "\fB\-j\fR \fIsectionpattern\fR" 4
  322. .IX Item "-j sectionpattern"
  323. .PD 0
  324. .IP "\fB\-\-only\-section=\fR\fIsectionpattern\fR" 4
  325. .IX Item "--only-section=sectionpattern"
  326. .PD
  327. Copy only the indicated sections from the input file to the output file.
  328. This option may be given more than once. Note that using this option
  329. inappropriately may make the output file unusable. Wildcard
  330. characters are accepted in \fIsectionpattern\fR.
  331. .Sp
  332. If the first character of \fIsectionpattern\fR is the exclamation
  333. point (!) then matching sections will not be copied, even if earlier
  334. use of \fB\-\-only\-section\fR on the same command line would
  335. otherwise copy it. For example:
  336. .Sp
  337. .Vb 1
  338. \& \-\-only\-section=.text.* \-\-only\-section=!.text.foo
  339. .Ve
  340. .Sp
  341. will copy all sectinos maching '.text.*' but not the section
  342. \&'.text.foo'.
  343. .IP "\fB\-R\fR \fIsectionpattern\fR" 4
  344. .IX Item "-R sectionpattern"
  345. .PD 0
  346. .IP "\fB\-\-remove\-section=\fR\fIsectionpattern\fR" 4
  347. .IX Item "--remove-section=sectionpattern"
  348. .PD
  349. Remove any section matching \fIsectionpattern\fR from the output file.
  350. This option may be given more than once. Note that using this option
  351. inappropriately may make the output file unusable. Wildcard
  352. characters are accepted in \fIsectionpattern\fR. Using both the
  353. \&\fB\-j\fR and \fB\-R\fR options together results in undefined
  354. behaviour.
  355. .Sp
  356. If the first character of \fIsectionpattern\fR is the exclamation
  357. point (!) then matching sections will not be removed even if an
  358. earlier use of \fB\-\-remove\-section\fR on the same command line
  359. would otherwise remove it. For example:
  360. .Sp
  361. .Vb 1
  362. \& \-\-remove\-section=.text.* \-\-remove\-section=!.text.foo
  363. .Ve
  364. .Sp
  365. will remove all sections matching the pattern '.text.*', but will not
  366. remove the section '.text.foo'.
  367. .IP "\fB\-\-keep\-section=\fR\fIsectionpattern\fR" 4
  368. .IX Item "--keep-section=sectionpattern"
  369. When removing sections from the output file, keep sections that match
  370. \&\fIsectionpattern\fR.
  371. .IP "\fB\-\-remove\-relocations=\fR\fIsectionpattern\fR" 4
  372. .IX Item "--remove-relocations=sectionpattern"
  373. Remove non-dynamic relocations from the output file for any section
  374. matching \fIsectionpattern\fR. This option may be given more than
  375. once. Note that using this option inappropriately may make the output
  376. file unusable, and attempting to remove a dynamic relocation section
  377. such as \fB.rela.plt\fR from an executable or shared library with
  378. \&\fB\-\-remove\-relocations=.plt\fR will not work. Wildcard characters
  379. are accepted in \fIsectionpattern\fR.
  380. For example:
  381. .Sp
  382. .Vb 1
  383. \& \-\-remove\-relocations=.text.*
  384. .Ve
  385. .Sp
  386. will remove the relocations for all sections matching the pattern
  387. \&'.text.*'.
  388. .Sp
  389. If the first character of \fIsectionpattern\fR is the exclamation
  390. point (!) then matching sections will not have their relocation
  391. removed even if an earlier use of \fB\-\-remove\-relocations\fR on the
  392. same command line would otherwise cause the relocations to be removed.
  393. For example:
  394. .Sp
  395. .Vb 1
  396. \& \-\-remove\-relocations=.text.* \-\-remove\-relocations=!.text.foo
  397. .Ve
  398. .Sp
  399. will remove all relocations for sections matching the pattern
  400. \&'.text.*', but will not remove relocations for the section
  401. \&'.text.foo'.
  402. .IP "\fB\-S\fR" 4
  403. .IX Item "-S"
  404. .PD 0
  405. .IP "\fB\-\-strip\-all\fR" 4
  406. .IX Item "--strip-all"
  407. .PD
  408. Do not copy relocation and symbol information from the source file.
  409. .IP "\fB\-g\fR" 4
  410. .IX Item "-g"
  411. .PD 0
  412. .IP "\fB\-\-strip\-debug\fR" 4
  413. .IX Item "--strip-debug"
  414. .PD
  415. Do not copy debugging symbols or sections from the source file.
  416. .IP "\fB\-\-strip\-unneeded\fR" 4
  417. .IX Item "--strip-unneeded"
  418. Strip all symbols that are not needed for relocation processing.
  419. .IP "\fB\-K\fR \fIsymbolname\fR" 4
  420. .IX Item "-K symbolname"
  421. .PD 0
  422. .IP "\fB\-\-keep\-symbol=\fR\fIsymbolname\fR" 4
  423. .IX Item "--keep-symbol=symbolname"
  424. .PD
  425. When stripping symbols, keep symbol \fIsymbolname\fR even if it would
  426. normally be stripped. This option may be given more than once.
  427. .IP "\fB\-N\fR \fIsymbolname\fR" 4
  428. .IX Item "-N symbolname"
  429. .PD 0
  430. .IP "\fB\-\-strip\-symbol=\fR\fIsymbolname\fR" 4
  431. .IX Item "--strip-symbol=symbolname"
  432. .PD
  433. Do not copy symbol \fIsymbolname\fR from the source file. This option
  434. may be given more than once.
  435. .IP "\fB\-\-strip\-unneeded\-symbol=\fR\fIsymbolname\fR" 4
  436. .IX Item "--strip-unneeded-symbol=symbolname"
  437. Do not copy symbol \fIsymbolname\fR from the source file unless it is needed
  438. by a relocation. This option may be given more than once.
  439. .IP "\fB\-G\fR \fIsymbolname\fR" 4
  440. .IX Item "-G symbolname"
  441. .PD 0
  442. .IP "\fB\-\-keep\-global\-symbol=\fR\fIsymbolname\fR" 4
  443. .IX Item "--keep-global-symbol=symbolname"
  444. .PD
  445. Keep only symbol \fIsymbolname\fR global. Make all other symbols local
  446. to the file, so that they are not visible externally. This option may
  447. be given more than once. Note: this option cannot be used in
  448. conjunction with the \fB\-\-globalize\-symbol\fR or
  449. \&\fB\-\-globalize\-symbols\fR options.
  450. .IP "\fB\-\-localize\-hidden\fR" 4
  451. .IX Item "--localize-hidden"
  452. In an \s-1ELF\s0 object, mark all symbols that have hidden or internal visibility
  453. as local. This option applies on top of symbol-specific localization options
  454. such as \fB\-L\fR.
  455. .IP "\fB\-L\fR \fIsymbolname\fR" 4
  456. .IX Item "-L symbolname"
  457. .PD 0
  458. .IP "\fB\-\-localize\-symbol=\fR\fIsymbolname\fR" 4
  459. .IX Item "--localize-symbol=symbolname"
  460. .PD
  461. Convert a global or weak symbol called \fIsymbolname\fR into a local
  462. symbol, so that it is not visible externally. This option may be
  463. given more than once. Note \- unique symbols are not converted.
  464. .IP "\fB\-W\fR \fIsymbolname\fR" 4
  465. .IX Item "-W symbolname"
  466. .PD 0
  467. .IP "\fB\-\-weaken\-symbol=\fR\fIsymbolname\fR" 4
  468. .IX Item "--weaken-symbol=symbolname"
  469. .PD
  470. Make symbol \fIsymbolname\fR weak. This option may be given more than once.
  471. .IP "\fB\-\-globalize\-symbol=\fR\fIsymbolname\fR" 4
  472. .IX Item "--globalize-symbol=symbolname"
  473. Give symbol \fIsymbolname\fR global scoping so that it is visible
  474. outside of the file in which it is defined. This option may be given
  475. more than once. Note: this option cannot be used in conjunction with
  476. the \fB\-G\fR or \fB\-\-keep\-global\-symbol\fR options.
  477. .IP "\fB\-w\fR" 4
  478. .IX Item "-w"
  479. .PD 0
  480. .IP "\fB\-\-wildcard\fR" 4
  481. .IX Item "--wildcard"
  482. .PD
  483. Permit regular expressions in \fIsymbolname\fRs used in other command
  484. line options. The question mark (?), asterisk (*), backslash (\e) and
  485. square brackets ([]) operators can be used anywhere in the symbol
  486. name. If the first character of the symbol name is the exclamation
  487. point (!) then the sense of the switch is reversed for that symbol.
  488. For example:
  489. .Sp
  490. .Vb 1
  491. \& \-w \-W !foo \-W fo*
  492. .Ve
  493. .Sp
  494. would cause objcopy to weaken all symbols that start with \*(L"fo\*(R"
  495. except for the symbol \*(L"foo\*(R".
  496. .IP "\fB\-x\fR" 4
  497. .IX Item "-x"
  498. .PD 0
  499. .IP "\fB\-\-discard\-all\fR" 4
  500. .IX Item "--discard-all"
  501. .PD
  502. Do not copy non-global symbols from the source file.
  503. .IP "\fB\-X\fR" 4
  504. .IX Item "-X"
  505. .PD 0
  506. .IP "\fB\-\-discard\-locals\fR" 4
  507. .IX Item "--discard-locals"
  508. .PD
  509. Do not copy compiler-generated local symbols.
  510. (These usually start with \fBL\fR or \fB.\fR.)
  511. .IP "\fB\-b\fR \fIbyte\fR" 4
  512. .IX Item "-b byte"
  513. .PD 0
  514. .IP "\fB\-\-byte=\fR\fIbyte\fR" 4
  515. .IX Item "--byte=byte"
  516. .PD
  517. If interleaving has been enabled via the \fB\-\-interleave\fR option
  518. then start the range of bytes to keep at the \fIbyte\fRth byte.
  519. \&\fIbyte\fR can be in the range from 0 to \fIbreadth\fR\-1, where
  520. \&\fIbreadth\fR is the value given by the \fB\-\-interleave\fR option.
  521. .IP "\fB\-i [\fR\fIbreadth\fR\fB]\fR" 4
  522. .IX Item "-i [breadth]"
  523. .PD 0
  524. .IP "\fB\-\-interleave[=\fR\fIbreadth\fR\fB]\fR" 4
  525. .IX Item "--interleave[=breadth]"
  526. .PD
  527. Only copy a range out of every \fIbreadth\fR bytes. (Header data is
  528. not affected). Select which byte in the range begins the copy with
  529. the \fB\-\-byte\fR option. Select the width of the range with the
  530. \&\fB\-\-interleave\-width\fR option.
  531. .Sp
  532. This option is useful for creating files to program \s-1ROM. \s0 It is
  533. typically used with an \f(CW\*(C`srec\*(C'\fR output target. Note that
  534. \&\fBobjcopy\fR will complain if you do not specify the
  535. \&\fB\-\-byte\fR option as well.
  536. .Sp
  537. The default interleave breadth is 4, so with \fB\-\-byte\fR set to 0,
  538. \&\fBobjcopy\fR would copy the first byte out of every four bytes
  539. from the input to the output.
  540. .IP "\fB\-\-interleave\-width=\fR\fIwidth\fR" 4
  541. .IX Item "--interleave-width=width"
  542. When used with the \fB\-\-interleave\fR option, copy \fIwidth\fR
  543. bytes at a time. The start of the range of bytes to be copied is set
  544. by the \fB\-\-byte\fR option, and the extent of the range is set with
  545. the \fB\-\-interleave\fR option.
  546. .Sp
  547. The default value for this option is 1. The value of \fIwidth\fR plus
  548. the \fIbyte\fR value set by the \fB\-\-byte\fR option must not exceed
  549. the interleave breadth set by the \fB\-\-interleave\fR option.
  550. .Sp
  551. This option can be used to create images for two 16\-bit flashes interleaved
  552. in a 32\-bit bus by passing \fB\-b 0 \-i 4 \-\-interleave\-width=2\fR
  553. and \fB\-b 2 \-i 4 \-\-interleave\-width=2\fR to two \fBobjcopy\fR
  554. commands. If the input was '12345678' then the outputs would be
  555. \&'1256' and '3478' respectively.
  556. .IP "\fB\-p\fR" 4
  557. .IX Item "-p"
  558. .PD 0
  559. .IP "\fB\-\-preserve\-dates\fR" 4
  560. .IX Item "--preserve-dates"
  561. .PD
  562. Set the access and modification dates of the output file to be the same
  563. as those of the input file.
  564. .IP "\fB\-D\fR" 4
  565. .IX Item "-D"
  566. .PD 0
  567. .IP "\fB\-\-enable\-deterministic\-archives\fR" 4
  568. .IX Item "--enable-deterministic-archives"
  569. .PD
  570. Operate in \fIdeterministic\fR mode. When copying archive members
  571. and writing the archive index, use zero for UIDs, GIDs, timestamps,
  572. and use consistent file modes for all files.
  573. .Sp
  574. If \fIbinutils\fR was configured with
  575. \&\fB\-\-enable\-deterministic\-archives\fR, then this mode is on by default.
  576. It can be disabled with the \fB\-U\fR option, below.
  577. .IP "\fB\-U\fR" 4
  578. .IX Item "-U"
  579. .PD 0
  580. .IP "\fB\-\-disable\-deterministic\-archives\fR" 4
  581. .IX Item "--disable-deterministic-archives"
  582. .PD
  583. Do \fInot\fR operate in \fIdeterministic\fR mode. This is the
  584. inverse of the \fB\-D\fR option, above: when copying archive members
  585. and writing the archive index, use their actual \s-1UID, GID,\s0 timestamp,
  586. and file mode values.
  587. .Sp
  588. This is the default unless \fIbinutils\fR was configured with
  589. \&\fB\-\-enable\-deterministic\-archives\fR.
  590. .IP "\fB\-\-debugging\fR" 4
  591. .IX Item "--debugging"
  592. Convert debugging information, if possible. This is not the default
  593. because only certain debugging formats are supported, and the
  594. conversion process can be time consuming.
  595. .IP "\fB\-\-gap\-fill\fR \fIval\fR" 4
  596. .IX Item "--gap-fill val"
  597. Fill gaps between sections with \fIval\fR. This operation applies to
  598. the \fIload address\fR (\s-1LMA\s0) of the sections. It is done by increasing
  599. the size of the section with the lower address, and filling in the extra
  600. space created with \fIval\fR.
  601. .IP "\fB\-\-pad\-to\fR \fIaddress\fR" 4
  602. .IX Item "--pad-to address"
  603. Pad the output file up to the load address \fIaddress\fR. This is
  604. done by increasing the size of the last section. The extra space is
  605. filled in with the value specified by \fB\-\-gap\-fill\fR (default zero).
  606. .IP "\fB\-\-set\-start\fR \fIval\fR" 4
  607. .IX Item "--set-start val"
  608. Set the start address (also known as the entry address) of the new
  609. file to \fIval\fR. Not all object file formats support setting the
  610. start address.
  611. .IP "\fB\-\-change\-start\fR \fIincr\fR" 4
  612. .IX Item "--change-start incr"
  613. .PD 0
  614. .IP "\fB\-\-adjust\-start\fR \fIincr\fR" 4
  615. .IX Item "--adjust-start incr"
  616. .PD
  617. Change the start address (also known as the entry address) by adding
  618. \&\fIincr\fR. Not all object file formats support setting the start
  619. address.
  620. .IP "\fB\-\-change\-addresses\fR \fIincr\fR" 4
  621. .IX Item "--change-addresses incr"
  622. .PD 0
  623. .IP "\fB\-\-adjust\-vma\fR \fIincr\fR" 4
  624. .IX Item "--adjust-vma incr"
  625. .PD
  626. Change the \s-1VMA\s0 and \s-1LMA\s0 addresses of all sections, as well as the start
  627. address, by adding \fIincr\fR. Some object file formats do not permit
  628. section addresses to be changed arbitrarily. Note that this does not
  629. relocate the sections; if the program expects sections to be loaded at a
  630. certain address, and this option is used to change the sections such
  631. that they are loaded at a different address, the program may fail.
  632. .IP "\fB\-\-change\-section\-address\fR \fIsectionpattern\fR\fB{=,+,\-}\fR\fIval\fR" 4
  633. .IX Item "--change-section-address sectionpattern{=,+,-}val"
  634. .PD 0
  635. .IP "\fB\-\-adjust\-section\-vma\fR \fIsectionpattern\fR\fB{=,+,\-}\fR\fIval\fR" 4
  636. .IX Item "--adjust-section-vma sectionpattern{=,+,-}val"
  637. .PD
  638. Set or change both the \s-1VMA\s0 address and the \s-1LMA\s0 address of any section
  639. matching \fIsectionpattern\fR. If \fB=\fR is used, the section
  640. address is set to \fIval\fR. Otherwise, \fIval\fR is added to or
  641. subtracted from the section address. See the comments under
  642. \&\fB\-\-change\-addresses\fR, above. If \fIsectionpattern\fR does not
  643. match any sections in the input file, a warning will be issued, unless
  644. \&\fB\-\-no\-change\-warnings\fR is used.
  645. .IP "\fB\-\-change\-section\-lma\fR \fIsectionpattern\fR\fB{=,+,\-}\fR\fIval\fR" 4
  646. .IX Item "--change-section-lma sectionpattern{=,+,-}val"
  647. Set or change the \s-1LMA\s0 address of any sections matching
  648. \&\fIsectionpattern\fR. The \s-1LMA\s0 address is the address where the
  649. section will be loaded into memory at program load time. Normally
  650. this is the same as the \s-1VMA\s0 address, which is the address of the
  651. section at program run time, but on some systems, especially those
  652. where a program is held in \s-1ROM,\s0 the two can be different. If \fB=\fR
  653. is used, the section address is set to \fIval\fR. Otherwise,
  654. \&\fIval\fR is added to or subtracted from the section address. See the
  655. comments under \fB\-\-change\-addresses\fR, above. If
  656. \&\fIsectionpattern\fR does not match any sections in the input file, a
  657. warning will be issued, unless \fB\-\-no\-change\-warnings\fR is used.
  658. .IP "\fB\-\-change\-section\-vma\fR \fIsectionpattern\fR\fB{=,+,\-}\fR\fIval\fR" 4
  659. .IX Item "--change-section-vma sectionpattern{=,+,-}val"
  660. Set or change the \s-1VMA\s0 address of any section matching
  661. \&\fIsectionpattern\fR. The \s-1VMA\s0 address is the address where the
  662. section will be located once the program has started executing.
  663. Normally this is the same as the \s-1LMA\s0 address, which is the address
  664. where the section will be loaded into memory, but on some systems,
  665. especially those where a program is held in \s-1ROM,\s0 the two can be
  666. different. If \fB=\fR is used, the section address is set to
  667. \&\fIval\fR. Otherwise, \fIval\fR is added to or subtracted from the
  668. section address. See the comments under \fB\-\-change\-addresses\fR,
  669. above. If \fIsectionpattern\fR does not match any sections in the
  670. input file, a warning will be issued, unless
  671. \&\fB\-\-no\-change\-warnings\fR is used.
  672. .IP "\fB\-\-change\-warnings\fR" 4
  673. .IX Item "--change-warnings"
  674. .PD 0
  675. .IP "\fB\-\-adjust\-warnings\fR" 4
  676. .IX Item "--adjust-warnings"
  677. .PD
  678. If \fB\-\-change\-section\-address\fR or \fB\-\-change\-section\-lma\fR or
  679. \&\fB\-\-change\-section\-vma\fR is used, and the section pattern does not
  680. match any sections, issue a warning. This is the default.
  681. .IP "\fB\-\-no\-change\-warnings\fR" 4
  682. .IX Item "--no-change-warnings"
  683. .PD 0
  684. .IP "\fB\-\-no\-adjust\-warnings\fR" 4
  685. .IX Item "--no-adjust-warnings"
  686. .PD
  687. Do not issue a warning if \fB\-\-change\-section\-address\fR or
  688. \&\fB\-\-adjust\-section\-lma\fR or \fB\-\-adjust\-section\-vma\fR is used, even
  689. if the section pattern does not match any sections.
  690. .IP "\fB\-\-set\-section\-flags\fR \fIsectionpattern\fR\fB=\fR\fIflags\fR" 4
  691. .IX Item "--set-section-flags sectionpattern=flags"
  692. Set the flags for any sections matching \fIsectionpattern\fR. The
  693. \&\fIflags\fR argument is a comma separated string of flag names. The
  694. recognized names are \fBalloc\fR, \fBcontents\fR, \fBload\fR,
  695. \&\fBnoload\fR, \fBreadonly\fR, \fBcode\fR, \fBdata\fR, \fBrom\fR,
  696. \&\fBexclude\fR, \fBshare\fR, and \fBdebug\fR. You can set the
  697. \&\fBcontents\fR flag for a section which does not have contents, but it
  698. is not meaningful to clear the \fBcontents\fR flag of a section which
  699. does have contents\*(--just remove the section instead. Not all flags are
  700. meaningful for all object file formats. In particular the
  701. \&\fBshare\fR flag is only meaningful for \s-1COFF\s0 format files and not for
  702. \&\s-1ELF\s0 format files.
  703. .IP "\fB\-\-set\-section\-alignment\fR \fIsectionpattern\fR\fB=\fR\fIalign\fR" 4
  704. .IX Item "--set-section-alignment sectionpattern=align"
  705. Set the alignment for any sections matching \fIsectionpattern\fR.
  706. \&\fIalign\fR specifies the alignment in bytes and must be a power of
  707. two, i.e. 1, 2, 4, 8....
  708. .IP "\fB\-\-add\-section\fR \fIsectionname\fR\fB=\fR\fIfilename\fR" 4
  709. .IX Item "--add-section sectionname=filename"
  710. Add a new section named \fIsectionname\fR while copying the file. The
  711. contents of the new section are taken from the file \fIfilename\fR. The
  712. size of the section will be the size of the file. This option only
  713. works on file formats which can support sections with arbitrary names.
  714. Note \- it may be necessary to use the \fB\-\-set\-section\-flags\fR
  715. option to set the attributes of the newly created section.
  716. .IP "\fB\-\-dump\-section\fR \fIsectionname\fR\fB=\fR\fIfilename\fR" 4
  717. .IX Item "--dump-section sectionname=filename"
  718. Place the contents of section named \fIsectionname\fR into the file
  719. \&\fIfilename\fR, overwriting any contents that may have been there
  720. previously. This option is the inverse of \fB\-\-add\-section\fR.
  721. This option is similar to the \fB\-\-only\-section\fR option except
  722. that it does not create a formatted file, it just dumps the contents
  723. as raw binary data, without applying any relocations. The option can
  724. be specified more than once.
  725. .IP "\fB\-\-update\-section\fR \fIsectionname\fR\fB=\fR\fIfilename\fR" 4
  726. .IX Item "--update-section sectionname=filename"
  727. Replace the existing contents of a section named \fIsectionname\fR
  728. with the contents of file \fIfilename\fR. The size of the section
  729. will be adjusted to the size of the file. The section flags for
  730. \&\fIsectionname\fR will be unchanged. For \s-1ELF\s0 format files the section
  731. to segment mapping will also remain unchanged, something which is not
  732. possible using \fB\-\-remove\-section\fR followed by
  733. \&\fB\-\-add\-section\fR. The option can be specified more than once.
  734. .Sp
  735. Note \- it is possible to use \fB\-\-rename\-section\fR and
  736. \&\fB\-\-update\-section\fR to both update and rename a section from one
  737. command line. In this case, pass the original section name to
  738. \&\fB\-\-update\-section\fR, and the original and new section names to
  739. \&\fB\-\-rename\-section\fR.
  740. .IP "\fB\-\-add\-symbol\fR \fIname\fR\fB=[\fR\fIsection\fR\fB:]\fR\fIvalue\fR\fB[,\fR\fIflags\fR\fB]\fR" 4
  741. .IX Item "--add-symbol name=[section:]value[,flags]"
  742. Add a new symbol named \fIname\fR while copying the file. This option may be
  743. specified multiple times. If the \fIsection\fR is given, the symbol will be
  744. associated with and relative to that section, otherwise it will be an \s-1ABS\s0
  745. symbol. Specifying an undefined section will result in a fatal error. There
  746. is no check for the value, it will be taken as specified. Symbol flags can
  747. be specified and not all flags will be meaningful for all object file
  748. formats. By default, the symbol will be global. The special flag
  749. \&'before=\fIothersym\fR' will insert the new symbol in front of the specified
  750. \&\fIothersym\fR, otherwise the symbol(s) will be added at the end of the
  751. symbol table in the order they appear.
  752. .IP "\fB\-\-rename\-section\fR \fIoldname\fR\fB=\fR\fInewname\fR\fB[,\fR\fIflags\fR\fB]\fR" 4
  753. .IX Item "--rename-section oldname=newname[,flags]"
  754. Rename a section from \fIoldname\fR to \fInewname\fR, optionally
  755. changing the section's flags to \fIflags\fR in the process. This has
  756. the advantage over using a linker script to perform the rename in that
  757. the output stays as an object file and does not become a linked
  758. executable. This option accepts the same set of flags as the
  759. \&\fB\-\-sect\-section\-flags\fR option.
  760. .Sp
  761. This option is particularly helpful when the input format is binary,
  762. since this will always create a section called .data. If for example,
  763. you wanted instead to create a section called .rodata containing binary
  764. data you could use the following command line to achieve it:
  765. .Sp
  766. .Vb 3
  767. \& objcopy \-I binary \-O <output_format> \-B <architecture> \e
  768. \& \-\-rename\-section .data=.rodata,alloc,load,readonly,data,contents \e
  769. \& <input_binary_file> <output_object_file>
  770. .Ve
  771. .IP "\fB\-\-long\-section\-names {enable,disable,keep}\fR" 4
  772. .IX Item "--long-section-names {enable,disable,keep}"
  773. Controls the handling of long section names when processing \f(CW\*(C`COFF\*(C'\fR
  774. and \f(CW\*(C`PE\-COFF\*(C'\fR object formats. The default behaviour, \fBkeep\fR,
  775. is to preserve long section names if any are present in the input file.
  776. The \fBenable\fR and \fBdisable\fR options forcibly enable or disable
  777. the use of long section names in the output object; when \fBdisable\fR
  778. is in effect, any long section names in the input object will be truncated.
  779. The \fBenable\fR option will only emit long section names if any are
  780. present in the inputs; this is mostly the same as \fBkeep\fR, but it
  781. is left undefined whether the \fBenable\fR option might force the
  782. creation of an empty string table in the output file.
  783. .IP "\fB\-\-change\-leading\-char\fR" 4
  784. .IX Item "--change-leading-char"
  785. Some object file formats use special characters at the start of
  786. symbols. The most common such character is underscore, which compilers
  787. often add before every symbol. This option tells \fBobjcopy\fR to
  788. change the leading character of every symbol when it converts between
  789. object file formats. If the object file formats use the same leading
  790. character, this option has no effect. Otherwise, it will add a
  791. character, or remove a character, or change a character, as
  792. appropriate.
  793. .IP "\fB\-\-remove\-leading\-char\fR" 4
  794. .IX Item "--remove-leading-char"
  795. If the first character of a global symbol is a special symbol leading
  796. character used by the object file format, remove the character. The
  797. most common symbol leading character is underscore. This option will
  798. remove a leading underscore from all global symbols. This can be useful
  799. if you want to link together objects of different file formats with
  800. different conventions for symbol names. This is different from
  801. \&\fB\-\-change\-leading\-char\fR because it always changes the symbol name
  802. when appropriate, regardless of the object file format of the output
  803. file.
  804. .IP "\fB\-\-reverse\-bytes=\fR\fInum\fR" 4
  805. .IX Item "--reverse-bytes=num"
  806. Reverse the bytes in a section with output contents. A section length must
  807. be evenly divisible by the value given in order for the swap to be able to
  808. take place. Reversing takes place before the interleaving is performed.
  809. .Sp
  810. This option is used typically in generating \s-1ROM\s0 images for problematic
  811. target systems. For example, on some target boards, the 32\-bit words
  812. fetched from 8\-bit ROMs are re-assembled in little-endian byte order
  813. regardless of the \s-1CPU\s0 byte order. Depending on the programming model, the
  814. endianness of the \s-1ROM\s0 may need to be modified.
  815. .Sp
  816. Consider a simple file with a section containing the following eight
  817. bytes: \f(CW12345678\fR.
  818. .Sp
  819. Using \fB\-\-reverse\-bytes=2\fR for the above example, the bytes in the
  820. output file would be ordered \f(CW21436587\fR.
  821. .Sp
  822. Using \fB\-\-reverse\-bytes=4\fR for the above example, the bytes in the
  823. output file would be ordered \f(CW43218765\fR.
  824. .Sp
  825. By using \fB\-\-reverse\-bytes=2\fR for the above example, followed by
  826. \&\fB\-\-reverse\-bytes=4\fR on the output file, the bytes in the second
  827. output file would be ordered \f(CW34127856\fR.
  828. .IP "\fB\-\-srec\-len=\fR\fIival\fR" 4
  829. .IX Item "--srec-len=ival"
  830. Meaningful only for srec output. Set the maximum length of the Srecords
  831. being produced to \fIival\fR. This length covers both address, data and
  832. crc fields.
  833. .IP "\fB\-\-srec\-forceS3\fR" 4
  834. .IX Item "--srec-forceS3"
  835. Meaningful only for srec output. Avoid generation of S1/S2 records,
  836. creating S3\-only record format.
  837. .IP "\fB\-\-redefine\-sym\fR \fIold\fR\fB=\fR\fInew\fR" 4
  838. .IX Item "--redefine-sym old=new"
  839. Change the name of a symbol \fIold\fR, to \fInew\fR. This can be useful
  840. when one is trying link two things together for which you have no
  841. source, and there are name collisions.
  842. .IP "\fB\-\-redefine\-syms=\fR\fIfilename\fR" 4
  843. .IX Item "--redefine-syms=filename"
  844. Apply \fB\-\-redefine\-sym\fR to each symbol pair "\fIold\fR \fInew\fR"
  845. listed in the file \fIfilename\fR. \fIfilename\fR is simply a flat file,
  846. with one symbol pair per line. Line comments may be introduced by the hash
  847. character. This option may be given more than once.
  848. .IP "\fB\-\-weaken\fR" 4
  849. .IX Item "--weaken"
  850. Change all global symbols in the file to be weak. This can be useful
  851. when building an object which will be linked against other objects using
  852. the \fB\-R\fR option to the linker. This option is only effective when
  853. using an object file format which supports weak symbols.
  854. .IP "\fB\-\-keep\-symbols=\fR\fIfilename\fR" 4
  855. .IX Item "--keep-symbols=filename"
  856. Apply \fB\-\-keep\-symbol\fR option to each symbol listed in the file
  857. \&\fIfilename\fR. \fIfilename\fR is simply a flat file, with one symbol
  858. name per line. Line comments may be introduced by the hash character.
  859. This option may be given more than once.
  860. .IP "\fB\-\-strip\-symbols=\fR\fIfilename\fR" 4
  861. .IX Item "--strip-symbols=filename"
  862. Apply \fB\-\-strip\-symbol\fR option to each symbol listed in the file
  863. \&\fIfilename\fR. \fIfilename\fR is simply a flat file, with one symbol
  864. name per line. Line comments may be introduced by the hash character.
  865. This option may be given more than once.
  866. .IP "\fB\-\-strip\-unneeded\-symbols=\fR\fIfilename\fR" 4
  867. .IX Item "--strip-unneeded-symbols=filename"
  868. Apply \fB\-\-strip\-unneeded\-symbol\fR option to each symbol listed in
  869. the file \fIfilename\fR. \fIfilename\fR is simply a flat file, with one
  870. symbol name per line. Line comments may be introduced by the hash
  871. character. This option may be given more than once.
  872. .IP "\fB\-\-keep\-global\-symbols=\fR\fIfilename\fR" 4
  873. .IX Item "--keep-global-symbols=filename"
  874. Apply \fB\-\-keep\-global\-symbol\fR option to each symbol listed in the
  875. file \fIfilename\fR. \fIfilename\fR is simply a flat file, with one
  876. symbol name per line. Line comments may be introduced by the hash
  877. character. This option may be given more than once.
  878. .IP "\fB\-\-localize\-symbols=\fR\fIfilename\fR" 4
  879. .IX Item "--localize-symbols=filename"
  880. Apply \fB\-\-localize\-symbol\fR option to each symbol listed in the file
  881. \&\fIfilename\fR. \fIfilename\fR is simply a flat file, with one symbol
  882. name per line. Line comments may be introduced by the hash character.
  883. This option may be given more than once.
  884. .IP "\fB\-\-globalize\-symbols=\fR\fIfilename\fR" 4
  885. .IX Item "--globalize-symbols=filename"
  886. Apply \fB\-\-globalize\-symbol\fR option to each symbol listed in the file
  887. \&\fIfilename\fR. \fIfilename\fR is simply a flat file, with one symbol
  888. name per line. Line comments may be introduced by the hash character.
  889. This option may be given more than once. Note: this option cannot be
  890. used in conjunction with the \fB\-G\fR or \fB\-\-keep\-global\-symbol\fR
  891. options.
  892. .IP "\fB\-\-weaken\-symbols=\fR\fIfilename\fR" 4
  893. .IX Item "--weaken-symbols=filename"
  894. Apply \fB\-\-weaken\-symbol\fR option to each symbol listed in the file
  895. \&\fIfilename\fR. \fIfilename\fR is simply a flat file, with one symbol
  896. name per line. Line comments may be introduced by the hash character.
  897. This option may be given more than once.
  898. .IP "\fB\-\-alt\-machine\-code=\fR\fIindex\fR" 4
  899. .IX Item "--alt-machine-code=index"
  900. If the output architecture has alternate machine codes, use the
  901. \&\fIindex\fRth code instead of the default one. This is useful in case
  902. a machine is assigned an official code and the tool-chain adopts the
  903. new code, but other applications still depend on the original code
  904. being used. For \s-1ELF\s0 based architectures if the \fIindex\fR
  905. alternative does not exist then the value is treated as an absolute
  906. number to be stored in the e_machine field of the \s-1ELF\s0 header.
  907. .IP "\fB\-\-writable\-text\fR" 4
  908. .IX Item "--writable-text"
  909. Mark the output text as writable. This option isn't meaningful for all
  910. object file formats.
  911. .IP "\fB\-\-readonly\-text\fR" 4
  912. .IX Item "--readonly-text"
  913. Make the output text write protected. This option isn't meaningful for all
  914. object file formats.
  915. .IP "\fB\-\-pure\fR" 4
  916. .IX Item "--pure"
  917. Mark the output file as demand paged. This option isn't meaningful for all
  918. object file formats.
  919. .IP "\fB\-\-impure\fR" 4
  920. .IX Item "--impure"
  921. Mark the output file as impure. This option isn't meaningful for all
  922. object file formats.
  923. .IP "\fB\-\-prefix\-symbols=\fR\fIstring\fR" 4
  924. .IX Item "--prefix-symbols=string"
  925. Prefix all symbols in the output file with \fIstring\fR.
  926. .IP "\fB\-\-prefix\-sections=\fR\fIstring\fR" 4
  927. .IX Item "--prefix-sections=string"
  928. Prefix all section names in the output file with \fIstring\fR.
  929. .IP "\fB\-\-prefix\-alloc\-sections=\fR\fIstring\fR" 4
  930. .IX Item "--prefix-alloc-sections=string"
  931. Prefix all the names of all allocated sections in the output file with
  932. \&\fIstring\fR.
  933. .IP "\fB\-\-add\-gnu\-debuglink=\fR\fIpath-to-file\fR" 4
  934. .IX Item "--add-gnu-debuglink=path-to-file"
  935. Creates a .gnu_debuglink section which contains a reference to
  936. \&\fIpath-to-file\fR and adds it to the output file. Note: the file at
  937. \&\fIpath-to-file\fR must exist. Part of the process of adding the
  938. \&.gnu_debuglink section involves embedding a checksum of the contents
  939. of the debug info file into the section.
  940. .Sp
  941. If the debug info file is built in one location but it is going to be
  942. installed at a later time into a different location then do not use
  943. the path to the installed location. The \fB\-\-add\-gnu\-debuglink\fR
  944. option will fail because the installed file does not exist yet.
  945. Instead put the debug info file in the current directory and use the
  946. \&\fB\-\-add\-gnu\-debuglink\fR option without any directory components,
  947. like this:
  948. .Sp
  949. .Vb 1
  950. \& objcopy \-\-add\-gnu\-debuglink=foo.debug
  951. .Ve
  952. .Sp
  953. At debug time the debugger will attempt to look for the separate debug
  954. info file in a set of known locations. The exact set of these
  955. locations varies depending upon the distribution being used, but it
  956. typically includes:
  957. .RS 4
  958. .ie n .IP """* The same directory as the executable.""" 4
  959. .el .IP "\f(CW* The same directory as the executable.\fR" 4
  960. .IX Item "* The same directory as the executable."
  961. .PD 0
  962. .ie n .IP """* A sub\-directory of the directory containing the executable""" 4
  963. .el .IP "\f(CW* A sub\-directory of the directory containing the executable\fR" 4
  964. .IX Item "* A sub-directory of the directory containing the executable"
  965. .PD
  966. called .debug
  967. .ie n .IP """* A global debug directory such as /usr/lib/debug.""" 4
  968. .el .IP "\f(CW* A global debug directory such as /usr/lib/debug.\fR" 4
  969. .IX Item "* A global debug directory such as /usr/lib/debug."
  970. .RE
  971. .RS 4
  972. .Sp
  973. As long as the debug info file has been installed into one of these
  974. locations before the debugger is run everything should work
  975. correctly.
  976. .RE
  977. .IP "\fB\-\-keep\-file\-symbols\fR" 4
  978. .IX Item "--keep-file-symbols"
  979. When stripping a file, perhaps with \fB\-\-strip\-debug\fR or
  980. \&\fB\-\-strip\-unneeded\fR, retain any symbols specifying source file names,
  981. which would otherwise get stripped.
  982. .IP "\fB\-\-only\-keep\-debug\fR" 4
  983. .IX Item "--only-keep-debug"
  984. Strip a file, removing contents of any sections that would not be
  985. stripped by \fB\-\-strip\-debug\fR and leaving the debugging sections
  986. intact. In \s-1ELF\s0 files, this preserves all note sections in the output.
  987. .Sp
  988. Note \- the section headers of the stripped sections are preserved,
  989. including their sizes, but the contents of the section are discarded.
  990. The section headers are preserved so that other tools can match up the
  991. debuginfo file with the real executable, even if that executable has
  992. been relocated to a different address space.
  993. .Sp
  994. The intention is that this option will be used in conjunction with
  995. \&\fB\-\-add\-gnu\-debuglink\fR to create a two part executable. One a
  996. stripped binary which will occupy less space in \s-1RAM\s0 and in a
  997. distribution and the second a debugging information file which is only
  998. needed if debugging abilities are required. The suggested procedure
  999. to create these files is as follows:
  1000. .RS 4
  1001. .IP "1.<Link the executable as normal. Assuming that it is called>" 4
  1002. .IX Item "1.<Link the executable as normal. Assuming that it is called>"
  1003. \&\f(CW\*(C`foo\*(C'\fR then...
  1004. .ie n .IP "1.<Run ""objcopy \-\-only\-keep\-debug foo foo.dbg"" to>" 4
  1005. .el .IP "1.<Run \f(CWobjcopy \-\-only\-keep\-debug foo foo.dbg\fR to>" 4
  1006. .IX Item "1.<Run objcopy --only-keep-debug foo foo.dbg to>"
  1007. create a file containing the debugging info.
  1008. .ie n .IP "1.<Run ""objcopy \-\-strip\-debug foo"" to create a>" 4
  1009. .el .IP "1.<Run \f(CWobjcopy \-\-strip\-debug foo\fR to create a>" 4
  1010. .IX Item "1.<Run objcopy --strip-debug foo to create a>"
  1011. stripped executable.
  1012. .ie n .IP "1.<Run ""objcopy \-\-add\-gnu\-debuglink=foo.dbg foo"">" 4
  1013. .el .IP "1.<Run \f(CWobjcopy \-\-add\-gnu\-debuglink=foo.dbg foo\fR>" 4
  1014. .IX Item "1.<Run objcopy --add-gnu-debuglink=foo.dbg foo>"
  1015. to add a link to the debugging info into the stripped executable.
  1016. .RE
  1017. .RS 4
  1018. .Sp
  1019. Note\-\-\-the choice of \f(CW\*(C`.dbg\*(C'\fR as an extension for the debug info
  1020. file is arbitrary. Also the \f(CW\*(C`\-\-only\-keep\-debug\*(C'\fR step is
  1021. optional. You could instead do this:
  1022. .IP "1.<Link the executable as normal.>" 4
  1023. .IX Item "1.<Link the executable as normal.>"
  1024. .PD 0
  1025. .ie n .IP "1.<Copy ""foo"" to ""foo.full"">" 4
  1026. .el .IP "1.<Copy \f(CWfoo\fR to \f(CWfoo.full\fR>" 4
  1027. .IX Item "1.<Copy foo to foo.full>"
  1028. .ie n .IP "1.<Run ""objcopy \-\-strip\-debug foo"">" 4
  1029. .el .IP "1.<Run \f(CWobjcopy \-\-strip\-debug foo\fR>" 4
  1030. .IX Item "1.<Run objcopy --strip-debug foo>"
  1031. .ie n .IP "1.<Run ""objcopy \-\-add\-gnu\-debuglink=foo.full foo"">" 4
  1032. .el .IP "1.<Run \f(CWobjcopy \-\-add\-gnu\-debuglink=foo.full foo\fR>" 4
  1033. .IX Item "1.<Run objcopy --add-gnu-debuglink=foo.full foo>"
  1034. .RE
  1035. .RS 4
  1036. .PD
  1037. .Sp
  1038. i.e., the file pointed to by the \fB\-\-add\-gnu\-debuglink\fR can be the
  1039. full executable. It does not have to be a file created by the
  1040. \&\fB\-\-only\-keep\-debug\fR switch.
  1041. .Sp
  1042. Note\-\-\-this switch is only intended for use on fully linked files. It
  1043. does not make sense to use it on object files where the debugging
  1044. information may be incomplete. Besides the gnu_debuglink feature
  1045. currently only supports the presence of one filename containing
  1046. debugging information, not multiple filenames on a one-per-object-file
  1047. basis.
  1048. .RE
  1049. .IP "\fB\-\-strip\-dwo\fR" 4
  1050. .IX Item "--strip-dwo"
  1051. Remove the contents of all \s-1DWARF \s0.dwo sections, leaving the
  1052. remaining debugging sections and all symbols intact.
  1053. This option is intended for use by the compiler as part of
  1054. the \fB\-gsplit\-dwarf\fR option, which splits debug information
  1055. between the .o file and a separate .dwo file. The compiler
  1056. generates all debug information in the same file, then uses
  1057. the \fB\-\-extract\-dwo\fR option to copy the .dwo sections to
  1058. the .dwo file, then the \fB\-\-strip\-dwo\fR option to remove
  1059. those sections from the original .o file.
  1060. .IP "\fB\-\-extract\-dwo\fR" 4
  1061. .IX Item "--extract-dwo"
  1062. Extract the contents of all \s-1DWARF \s0.dwo sections. See the
  1063. \&\fB\-\-strip\-dwo\fR option for more information.
  1064. .IP "\fB\-\-file\-alignment\fR \fInum\fR" 4
  1065. .IX Item "--file-alignment num"
  1066. Specify the file alignment. Sections in the file will always begin at
  1067. file offsets which are multiples of this number. This defaults to
  1068. 512.
  1069. [This option is specific to \s-1PE\s0 targets.]
  1070. .IP "\fB\-\-heap\fR \fIreserve\fR" 4
  1071. .IX Item "--heap reserve"
  1072. .PD 0
  1073. .IP "\fB\-\-heap\fR \fIreserve\fR\fB,\fR\fIcommit\fR" 4
  1074. .IX Item "--heap reserve,commit"
  1075. .PD
  1076. Specify the number of bytes of memory to reserve (and optionally commit)
  1077. to be used as heap for this program.
  1078. [This option is specific to \s-1PE\s0 targets.]
  1079. .IP "\fB\-\-image\-base\fR \fIvalue\fR" 4
  1080. .IX Item "--image-base value"
  1081. Use \fIvalue\fR as the base address of your program or dll. This is
  1082. the lowest memory location that will be used when your program or dll
  1083. is loaded. To reduce the need to relocate and improve performance of
  1084. your dlls, each should have a unique base address and not overlap any
  1085. other dlls. The default is 0x400000 for executables, and 0x10000000
  1086. for dlls.
  1087. [This option is specific to \s-1PE\s0 targets.]
  1088. .IP "\fB\-\-section\-alignment\fR \fInum\fR" 4
  1089. .IX Item "--section-alignment num"
  1090. Sets the section alignment field in the \s-1PE\s0 header. Sections in memory
  1091. will always begin at addresses which are a multiple of this number.
  1092. Defaults to 0x1000.
  1093. [This option is specific to \s-1PE\s0 targets.]
  1094. .IP "\fB\-\-stack\fR \fIreserve\fR" 4
  1095. .IX Item "--stack reserve"
  1096. .PD 0
  1097. .IP "\fB\-\-stack\fR \fIreserve\fR\fB,\fR\fIcommit\fR" 4
  1098. .IX Item "--stack reserve,commit"
  1099. .PD
  1100. Specify the number of bytes of memory to reserve (and optionally commit)
  1101. to be used as stack for this program.
  1102. [This option is specific to \s-1PE\s0 targets.]
  1103. .IP "\fB\-\-subsystem\fR \fIwhich\fR" 4
  1104. .IX Item "--subsystem which"
  1105. .PD 0
  1106. .IP "\fB\-\-subsystem\fR \fIwhich\fR\fB:\fR\fImajor\fR" 4
  1107. .IX Item "--subsystem which:major"
  1108. .IP "\fB\-\-subsystem\fR \fIwhich\fR\fB:\fR\fImajor\fR\fB.\fR\fIminor\fR" 4
  1109. .IX Item "--subsystem which:major.minor"
  1110. .PD
  1111. Specifies the subsystem under which your program will execute. The
  1112. legal values for \fIwhich\fR are \f(CW\*(C`native\*(C'\fR, \f(CW\*(C`windows\*(C'\fR,
  1113. \&\f(CW\*(C`console\*(C'\fR, \f(CW\*(C`posix\*(C'\fR, \f(CW\*(C`efi\-app\*(C'\fR, \f(CW\*(C`efi\-bsd\*(C'\fR,
  1114. \&\f(CW\*(C`efi\-rtd\*(C'\fR, \f(CW\*(C`sal\-rtd\*(C'\fR, and \f(CW\*(C`xbox\*(C'\fR. You may optionally set
  1115. the subsystem version also. Numeric values are also accepted for
  1116. \&\fIwhich\fR.
  1117. [This option is specific to \s-1PE\s0 targets.]
  1118. .IP "\fB\-\-extract\-symbol\fR" 4
  1119. .IX Item "--extract-symbol"
  1120. Keep the file's section flags and symbols but remove all section data.
  1121. Specifically, the option:
  1122. .RS 4
  1123. .IP "*<removes the contents of all sections;>" 4
  1124. .IX Item "*<removes the contents of all sections;>"
  1125. .PD 0
  1126. .IP "*<sets the size of every section to zero; and>" 4
  1127. .IX Item "*<sets the size of every section to zero; and>"
  1128. .IP "*<sets the file's start address to zero.>" 4
  1129. .IX Item "*<sets the file's start address to zero.>"
  1130. .RE
  1131. .RS 4
  1132. .PD
  1133. .Sp
  1134. This option is used to build a \fI.sym\fR file for a VxWorks kernel.
  1135. It can also be a useful way of reducing the size of a \fB\-\-just\-symbols\fR
  1136. linker input file.
  1137. .RE
  1138. .IP "\fB\-\-compress\-debug\-sections\fR" 4
  1139. .IX Item "--compress-debug-sections"
  1140. Compress \s-1DWARF\s0 debug sections using zlib with \s-1SHF_COMPRESSED\s0 from the
  1141. \&\s-1ELF ABI. \s0 Note \- if compression would actually make a section
  1142. \&\fIlarger\fR, then it is not compressed.
  1143. .IP "\fB\-\-compress\-debug\-sections=none\fR" 4
  1144. .IX Item "--compress-debug-sections=none"
  1145. .PD 0
  1146. .IP "\fB\-\-compress\-debug\-sections=zlib\fR" 4
  1147. .IX Item "--compress-debug-sections=zlib"
  1148. .IP "\fB\-\-compress\-debug\-sections=zlib\-gnu\fR" 4
  1149. .IX Item "--compress-debug-sections=zlib-gnu"
  1150. .IP "\fB\-\-compress\-debug\-sections=zlib\-gabi\fR" 4
  1151. .IX Item "--compress-debug-sections=zlib-gabi"
  1152. .PD
  1153. For \s-1ELF\s0 files, these options control how \s-1DWARF\s0 debug sections are
  1154. compressed. \fB\-\-compress\-debug\-sections=none\fR is equivalent
  1155. to \fB\-\-decompress\-debug\-sections\fR.
  1156. \&\fB\-\-compress\-debug\-sections=zlib\fR and
  1157. \&\fB\-\-compress\-debug\-sections=zlib\-gabi\fR are equivalent to
  1158. \&\fB\-\-compress\-debug\-sections\fR.
  1159. \&\fB\-\-compress\-debug\-sections=zlib\-gnu\fR compresses \s-1DWARF\s0 debug
  1160. sections using zlib. The debug sections are renamed to begin with
  1161. \&\fB.zdebug\fR instead of \fB.debug\fR. Note \- if compression would
  1162. actually make a section \fIlarger\fR, then it is not compressed nor
  1163. renamed.
  1164. .IP "\fB\-\-decompress\-debug\-sections\fR" 4
  1165. .IX Item "--decompress-debug-sections"
  1166. Decompress \s-1DWARF\s0 debug sections using zlib. The original section
  1167. names of the compressed sections are restored.
  1168. .IP "\fB\-\-elf\-stt\-common=yes\fR" 4
  1169. .IX Item "--elf-stt-common=yes"
  1170. .PD 0
  1171. .IP "\fB\-\-elf\-stt\-common=no\fR" 4
  1172. .IX Item "--elf-stt-common=no"
  1173. .PD
  1174. For \s-1ELF\s0 files, these options control whether common symbols should be
  1175. converted to the \f(CW\*(C`STT_COMMON\*(C'\fR or \f(CW\*(C`STT_OBJECT\*(C'\fR type.
  1176. \&\fB\-\-elf\-stt\-common=yes\fR converts common symbol type to
  1177. \&\f(CW\*(C`STT_COMMON\*(C'\fR. \fB\-\-elf\-stt\-common=no\fR converts common symbol
  1178. type to \f(CW\*(C`STT_OBJECT\*(C'\fR.
  1179. .IP "\fB\-\-merge\-notes\fR" 4
  1180. .IX Item "--merge-notes"
  1181. .PD 0
  1182. .IP "\fB\-\-no\-merge\-notes\fR" 4
  1183. .IX Item "--no-merge-notes"
  1184. .PD
  1185. For \s-1ELF\s0 files, attempt (or do not attempt) to reduce the size of any
  1186. \&\s-1SHT_NOTE\s0 type sections by removing duplicate notes.
  1187. .IP "\fB\-V\fR" 4
  1188. .IX Item "-V"
  1189. .PD 0
  1190. .IP "\fB\-\-version\fR" 4
  1191. .IX Item "--version"
  1192. .PD
  1193. Show the version number of \fBobjcopy\fR.
  1194. .IP "\fB\-\-verilog\-data\-width=\fR\fIbytes\fR" 4
  1195. .IX Item "--verilog-data-width=bytes"
  1196. For Verilog output, this options controls the number of bytes
  1197. converted for each output data element. The input target controls the
  1198. endianness of the conversion.
  1199. .IP "\fB\-v\fR" 4
  1200. .IX Item "-v"
  1201. .PD 0
  1202. .IP "\fB\-\-verbose\fR" 4
  1203. .IX Item "--verbose"
  1204. .PD
  1205. Verbose output: list all object files modified. In the case of
  1206. archives, \fBobjcopy \-V\fR lists all members of the archive.
  1207. .IP "\fB\-\-help\fR" 4
  1208. .IX Item "--help"
  1209. Show a summary of the options to \fBobjcopy\fR.
  1210. .IP "\fB\-\-info\fR" 4
  1211. .IX Item "--info"
  1212. Display a list showing all architectures and object formats available.
  1213. .IP "\fB@\fR\fIfile\fR" 4
  1214. .IX Item "@file"
  1215. Read command-line options from \fIfile\fR. The options read are
  1216. inserted in place of the original @\fIfile\fR option. If \fIfile\fR
  1217. does not exist, or cannot be read, then the option will be treated
  1218. literally, and not removed.
  1219. .Sp
  1220. Options in \fIfile\fR are separated by whitespace. A whitespace
  1221. character may be included in an option by surrounding the entire
  1222. option in either single or double quotes. Any character (including a
  1223. backslash) may be included by prefixing the character to be included
  1224. with a backslash. The \fIfile\fR may itself contain additional
  1225. @\fIfile\fR options; any such options will be processed recursively.
  1226. .SH "SEE ALSO"
  1227. .IX Header "SEE ALSO"
  1228. \&\fIld\fR\|(1), \fIobjdump\fR\|(1), and the Info entries for \fIbinutils\fR.
  1229. .SH "COPYRIGHT"
  1230. .IX Header "COPYRIGHT"
  1231. Copyright (c) 1991\-2020 Free Software Foundation, Inc.
  1232. .PP
  1233. Permission is granted to copy, distribute and/or modify this document
  1234. under the terms of the \s-1GNU\s0 Free Documentation License, Version 1.3
  1235. or any later version published by the Free Software Foundation;
  1236. with no Invariant Sections, with no Front-Cover Texts, and with no
  1237. Back-Cover Texts. A copy of the license is included in the
  1238. section entitled \*(L"\s-1GNU\s0 Free Documentation License\*(R".