arm-linux-gnueabihf-objcopy.1 52 KB

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