1OBJCOPY(1)                   GNU Development Tools                  OBJCOPY(1)
2
3
4

NAME

6       objcopy - copy and translate object files
7

SYNOPSIS

9       objcopy [-F bfdname|--target=bfdname]
10               [-I bfdname|--input-target=bfdname]
11               [-O bfdname|--output-target=bfdname]
12               [-B bfdarch|--binary-architecture=bfdarch]
13               [-S|--strip-all]
14               [-g|--strip-debug]
15               [--strip-unneeded]
16               [-K symbolname|--keep-symbol=symbolname]
17               [-N symbolname|--strip-symbol=symbolname]
18               [--strip-unneeded-symbol=symbolname]
19               [-G symbolname|--keep-global-symbol=symbolname]
20               [--localize-hidden]
21               [-L symbolname|--localize-symbol=symbolname]
22               [--globalize-symbol=symbolname]
23               [--globalize-symbols=filename]
24               [-W symbolname|--weaken-symbol=symbolname]
25               [-w|--wildcard]
26               [-x|--discard-all]
27               [-X|--discard-locals]
28               [-b byte|--byte=byte]
29               [-i [breadth]|--interleave[=breadth]]
30               [--interleave-width=width]
31               [-j sectionpattern|--only-section=sectionpattern]
32               [-R sectionpattern|--remove-section=sectionpattern]
33               [--keep-section=sectionpattern]
34               [--remove-relocations=sectionpattern]
35               [-p|--preserve-dates]
36               [-D|--enable-deterministic-archives]
37               [-U|--disable-deterministic-archives]
38               [--debugging]
39               [--gap-fill=val]
40               [--pad-to=address]
41               [--set-start=val]
42               [--adjust-start=incr]
43               [--change-addresses=incr]
44               [--change-section-address sectionpattern{=,+,-}val]
45               [--change-section-lma sectionpattern{=,+,-}val]
46               [--change-section-vma sectionpattern{=,+,-}val]
47               [--change-warnings] [--no-change-warnings]
48               [--set-section-flags sectionpattern=flags]
49               [--set-section-alignment sectionpattern=align]
50               [--add-section sectionname=filename]
51               [--dump-section sectionname=filename]
52               [--update-section sectionname=filename]
53               [--rename-section oldname=newname[,flags]]
54               [--long-section-names {enable,disable,keep}]
55               [--change-leading-char] [--remove-leading-char]
56               [--reverse-bytes=num]
57               [--srec-len=ival] [--srec-forceS3]
58               [--redefine-sym old=new]
59               [--redefine-syms=filename]
60               [--weaken]
61               [--keep-symbols=filename]
62               [--strip-symbols=filename]
63               [--strip-unneeded-symbols=filename]
64               [--keep-global-symbols=filename]
65               [--localize-symbols=filename]
66               [--weaken-symbols=filename]
67               [--add-symbol name=[section:]value[,flags]]
68               [--alt-machine-code=index]
69               [--prefix-symbols=string]
70               [--prefix-sections=string]
71               [--prefix-alloc-sections=string]
72               [--add-gnu-debuglink=path-to-file]
73               [--keep-file-symbols]
74               [--only-keep-debug]
75               [--strip-dwo]
76               [--extract-dwo]
77               [--extract-symbol]
78               [--writable-text]
79               [--readonly-text]
80               [--pure]
81               [--impure]
82               [--file-alignment=num]
83               [--heap=size]
84               [--image-base=address]
85               [--section-alignment=num]
86               [--stack=size]
87               [--subsystem=which:major.minor]
88               [--compress-debug-sections]
89               [--decompress-debug-sections]
90               [--elf-stt-common=val]
91               [--merge-notes]
92               [--no-merge-notes]
93               [--verilog-data-width=val]
94               [-v|--verbose]
95               [-V|--version]
96               [--help] [--info]
97               infile [outfile]
98

DESCRIPTION

100       The GNU objcopy utility copies the contents of an object file to
101       another.  objcopy uses the GNU BFD Library to read and write the object
102       files.  It can write the destination object file in a format different
103       from that of the source object file.  The exact behavior of objcopy is
104       controlled by command-line options.  Note that objcopy should be able
105       to copy a fully linked file between any two formats. However, copying a
106       relocatable object file between any two formats may not work as
107       expected.
108
109       objcopy creates temporary files to do its translations and deletes them
110       afterward.  objcopy uses BFD to do all its translation work; it has
111       access to all the formats described in BFD and thus is able to
112       recognize most formats without being told explicitly.
113
114       objcopy can be used to generate S-records by using an output target of
115       srec (e.g., use -O srec).
116
117       objcopy can be used to generate a raw binary file by using an output
118       target of binary (e.g., use -O binary).  When objcopy generates a raw
119       binary file, it will essentially produce a memory dump of the contents
120       of the input object file.  All symbols and relocation information will
121       be discarded.  The memory dump will start at the load address of the
122       lowest section copied into the output file.
123
124       When generating an S-record or a raw binary file, it may be helpful to
125       use -S to remove sections containing debugging information.  In some
126       cases -R will be useful to remove sections which contain information
127       that is not needed by the binary file.
128
129       Note---objcopy is not able to change the endianness of its input files.
130       If the input format has an endianness (some formats do not), objcopy
131       can only copy the inputs into file formats that have the same
132       endianness or which have no endianness (e.g., srec).  (However, see the
133       --reverse-bytes option.)
134

OPTIONS

136       infile
137       outfile
138           The input and output files, respectively.  If you do not specify
139           outfile, objcopy creates a temporary file and destructively renames
140           the result with the name of infile.
141
142       -I bfdname
143       --input-target=bfdname
144           Consider the source file's object format to be bfdname, rather than
145           attempting to deduce it.
146
147       -O bfdname
148       --output-target=bfdname
149           Write the output file using the object format bfdname.
150
151       -F bfdname
152       --target=bfdname
153           Use bfdname as the object format for both the input and the output
154           file; i.e., simply transfer data from source to destination with no
155           translation.
156
157       -B bfdarch
158       --binary-architecture=bfdarch
159           Useful when transforming a architecture-less input file into an
160           object file.  In this case the output architecture can be set to
161           bfdarch.  This option will be ignored if the input file has a known
162           bfdarch.  You can access this binary data inside a program by
163           referencing the special symbols that are created by the conversion
164           process.  These symbols are called _binary_objfile_start,
165           _binary_objfile_end and _binary_objfile_size.  e.g. you can
166           transform a picture file into an object file and then access it in
167           your code using these symbols.
168
169       -j sectionpattern
170       --only-section=sectionpattern
171           Copy only the indicated sections from the input file to the output
172           file.  This option may be given more than once.  Note that using
173           this option inappropriately may make the output file unusable.
174           Wildcard characters are accepted in sectionpattern.
175
176           If the first character of sectionpattern is the exclamation point
177           (!) then matching sections will not be copied, even if earlier use
178           of --only-section on the same command line would otherwise copy it.
179           For example:
180
181                     --only-section=.text.* --only-section=!.text.foo
182
183           will copy all sectinos maching '.text.*' but not the section
184           '.text.foo'.
185
186       -R sectionpattern
187       --remove-section=sectionpattern
188           Remove any section matching sectionpattern from the output file.
189           This option may be given more than once.  Note that using this
190           option inappropriately may make the output file unusable.  Wildcard
191           characters are accepted in sectionpattern.  Using both the -j and
192           -R options together results in undefined behaviour.
193
194           If the first character of sectionpattern is the exclamation point
195           (!) then matching sections will not be removed even if an earlier
196           use of --remove-section on the same command line would otherwise
197           remove it.  For example:
198
199                     --remove-section=.text.* --remove-section=!.text.foo
200
201           will remove all sections matching the pattern '.text.*', but will
202           not remove the section '.text.foo'.
203
204       --keep-section=sectionpattern
205           When removing sections from the output file, keep sections that
206           match sectionpattern.
207
208       --remove-relocations=sectionpattern
209           Remove non-dynamic relocations from the output file for any section
210           matching sectionpattern.  This option may be given more than once.
211           Note that using this option inappropriately may make the output
212           file unusable, and attempting to remove a dynamic relocation
213           section such as .rela.plt from an executable or shared library with
214           --remove-relocations=.plt will not work.  Wildcard characters are
215           accepted in sectionpattern.  For example:
216
217                     --remove-relocations=.text.*
218
219           will remove the relocations for all sections matching the pattern
220           '.text.*'.
221
222           If the first character of sectionpattern is the exclamation point
223           (!) then matching sections will not have their relocation removed
224           even if an earlier use of --remove-relocations on the same command
225           line would otherwise cause the relocations to be removed.  For
226           example:
227
228                     --remove-relocations=.text.* --remove-relocations=!.text.foo
229
230           will remove all relocations for sections matching the pattern
231           '.text.*', but will not remove relocations for the section
232           '.text.foo'.
233
234       -S
235       --strip-all
236           Do not copy relocation and symbol information from the source file.
237
238       -g
239       --strip-debug
240           Do not copy debugging symbols or sections from the source file.
241
242       --strip-unneeded
243           Strip all symbols that are not needed for relocation processing.
244
245       -K symbolname
246       --keep-symbol=symbolname
247           When stripping symbols, keep symbol symbolname even if it would
248           normally be stripped.  This option may be given more than once.
249
250       -N symbolname
251       --strip-symbol=symbolname
252           Do not copy symbol symbolname from the source file.  This option
253           may be given more than once.
254
255       --strip-unneeded-symbol=symbolname
256           Do not copy symbol symbolname from the source file unless it is
257           needed by a relocation.  This option may be given more than once.
258
259       -G symbolname
260       --keep-global-symbol=symbolname
261           Keep only symbol symbolname global.  Make all other symbols local
262           to the file, so that they are not visible externally.  This option
263           may be given more than once.  Note: this option cannot be used in
264           conjunction with the --globalize-symbol or --globalize-symbols
265           options.
266
267       --localize-hidden
268           In an ELF object, mark all symbols that have hidden or internal
269           visibility as local.  This option applies on top of symbol-specific
270           localization options such as -L.
271
272       -L symbolname
273       --localize-symbol=symbolname
274           Convert a global or weak symbol called symbolname into a local
275           symbol, so that it is not visible externally.  This option may be
276           given more than once.  Note - unique symbols are not converted.
277
278       -W symbolname
279       --weaken-symbol=symbolname
280           Make symbol symbolname weak. This option may be given more than
281           once.
282
283       --globalize-symbol=symbolname
284           Give symbol symbolname global scoping so that it is visible outside
285           of the file in which it is defined.  This option may be given more
286           than once.  Note: this option cannot be used in conjunction with
287           the -G or --keep-global-symbol options.
288
289       -w
290       --wildcard
291           Permit regular expressions in symbolnames used in other command
292           line options.  The question mark (?), asterisk (*), backslash (\)
293           and square brackets ([]) operators can be used anywhere in the
294           symbol name.  If the first character of the symbol name is the
295           exclamation point (!) then the sense of the switch is reversed for
296           that symbol.  For example:
297
298                     -w -W !foo -W fo*
299
300           would cause objcopy to weaken all symbols that start with "fo"
301           except for the symbol "foo".
302
303       -x
304       --discard-all
305           Do not copy non-global symbols from the source file.
306
307       -X
308       --discard-locals
309           Do not copy compiler-generated local symbols.  (These usually start
310           with L or ..)
311
312       -b byte
313       --byte=byte
314           If interleaving has been enabled via the --interleave option then
315           start the range of bytes to keep at the byteth byte.  byte can be
316           in the range from 0 to breadth-1, where breadth is the value given
317           by the --interleave option.
318
319       -i [breadth]
320       --interleave[=breadth]
321           Only copy a range out of every breadth bytes.  (Header data is not
322           affected).  Select which byte in the range begins the copy with the
323           --byte option.  Select the width of the range with the
324           --interleave-width option.
325
326           This option is useful for creating files to program ROM.  It is
327           typically used with an "srec" output target.  Note that objcopy
328           will complain if you do not specify the --byte option as well.
329
330           The default interleave breadth is 4, so with --byte set to 0,
331           objcopy would copy the first byte out of every four bytes from the
332           input to the output.
333
334       --interleave-width=width
335           When used with the --interleave option, copy width bytes at a time.
336           The start of the range of bytes to be copied is set by the --byte
337           option, and the extent of the range is set with the --interleave
338           option.
339
340           The default value for this option is 1.  The value of width plus
341           the byte value set by the --byte option must not exceed the
342           interleave breadth set by the --interleave option.
343
344           This option can be used to create images for two 16-bit flashes
345           interleaved in a 32-bit bus by passing -b 0 -i 4
346           --interleave-width=2 and -b 2 -i 4 --interleave-width=2 to two
347           objcopy commands.  If the input was '12345678' then the outputs
348           would be '1256' and '3478' respectively.
349
350       -p
351       --preserve-dates
352           Set the access and modification dates of the output file to be the
353           same as those of the input file.
354
355       -D
356       --enable-deterministic-archives
357           Operate in deterministic mode.  When copying archive members and
358           writing the archive index, use zero for UIDs, GIDs, timestamps, and
359           use consistent file modes for all files.
360
361           If binutils was configured with --enable-deterministic-archives,
362           then this mode is on by default.  It can be disabled with the -U
363           option, below.
364
365       -U
366       --disable-deterministic-archives
367           Do not operate in deterministic mode.  This is the inverse of the
368           -D option, above: when copying archive members and writing the
369           archive index, use their actual UID, GID, timestamp, and file mode
370           values.
371
372           This is the default unless binutils was configured with
373           --enable-deterministic-archives.
374
375       --debugging
376           Convert debugging information, if possible.  This is not the
377           default because only certain debugging formats are supported, and
378           the conversion process can be time consuming.
379
380       --gap-fill val
381           Fill gaps between sections with val.  This operation applies to the
382           load address (LMA) of the sections.  It is done by increasing the
383           size of the section with the lower address, and filling in the
384           extra space created with val.
385
386       --pad-to address
387           Pad the output file up to the load address address.  This is done
388           by increasing the size of the last section.  The extra space is
389           filled in with the value specified by --gap-fill (default zero).
390
391       --set-start val
392           Set the start address (also known as the entry address) of the new
393           file to val.  Not all object file formats support setting the start
394           address.
395
396       --change-start incr
397       --adjust-start incr
398           Change the start address (also known as the entry address) by
399           adding incr.  Not all object file formats support setting the start
400           address.
401
402       --change-addresses incr
403       --adjust-vma incr
404           Change the VMA and LMA addresses of all sections, as well as the
405           start address, by adding incr.  Some object file formats do not
406           permit section addresses to be changed arbitrarily.  Note that this
407           does not relocate the sections; if the program expects sections to
408           be loaded at a certain address, and this option is used to change
409           the sections such that they are loaded at a different address, the
410           program may fail.
411
412       --change-section-address sectionpattern{=,+,-}val
413       --adjust-section-vma sectionpattern{=,+,-}val
414           Set or change both the VMA address and the LMA address of any
415           section matching sectionpattern.  If = is used, the section address
416           is set to val.  Otherwise, val is added to or subtracted from the
417           section address.  See the comments under --change-addresses, above.
418           If sectionpattern does not match any sections in the input file, a
419           warning will be issued, unless --no-change-warnings is used.
420
421       --change-section-lma sectionpattern{=,+,-}val
422           Set or change the LMA address of any sections matching
423           sectionpattern.  The LMA address is the address where the section
424           will be loaded into memory at program load time.  Normally this is
425           the same as the VMA address, which is the address of the section at
426           program run time, but on some systems, especially those where a
427           program is held in ROM, the two can be different.  If = is used,
428           the section address is set to val.  Otherwise, val is added to or
429           subtracted from the section address.  See the comments under
430           --change-addresses, above.  If sectionpattern does not match any
431           sections in the input file, a warning will be issued, unless
432           --no-change-warnings is used.
433
434       --change-section-vma sectionpattern{=,+,-}val
435           Set or change the VMA address of any section matching
436           sectionpattern.  The VMA address is the address where the section
437           will be located once the program has started executing.  Normally
438           this is the same as the LMA address, which is the address where the
439           section will be loaded into memory, but on some systems, especially
440           those where a program is held in ROM, the two can be different.  If
441           = is used, the section address is set to val.  Otherwise, val is
442           added to or subtracted from the section address.  See the comments
443           under --change-addresses, above.  If sectionpattern does not match
444           any sections in the input file, a warning will be issued, unless
445           --no-change-warnings is used.
446
447       --change-warnings
448       --adjust-warnings
449           If --change-section-address or --change-section-lma or
450           --change-section-vma is used, and the section pattern does not
451           match any sections, issue a warning.  This is the default.
452
453       --no-change-warnings
454       --no-adjust-warnings
455           Do not issue a warning if --change-section-address or
456           --adjust-section-lma or --adjust-section-vma is used, even if the
457           section pattern does not match any sections.
458
459       --set-section-flags sectionpattern=flags
460           Set the flags for any sections matching sectionpattern.  The flags
461           argument is a comma separated string of flag names.  The recognized
462           names are alloc, contents, load, noload, readonly, code, data, rom,
463           exclude, share, and debug.  You can set the contents flag for a
464           section which does not have contents, but it is not meaningful to
465           clear the contents flag of a section which does have contents--just
466           remove the section instead.  Not all flags are meaningful for all
467           object file formats.  In particular the share flag is only
468           meaningful for COFF format files and not for ELF format files.
469
470       --set-section-alignment sectionpattern=align
471           Set the alignment for any sections matching sectionpattern.  align
472           specifies the alignment in bytes and must be a power of two, i.e.
473           1, 2, 4, 8....
474
475       --add-section sectionname=filename
476           Add a new section named sectionname while copying the file.  The
477           contents of the new section are taken from the file filename.  The
478           size of the section will be the size of the file.  This option only
479           works on file formats which can support sections with arbitrary
480           names.  Note - it may be necessary to use the --set-section-flags
481           option to set the attributes of the newly created section.
482
483       --dump-section sectionname=filename
484           Place the contents of section named sectionname into the file
485           filename, overwriting any contents that may have been there
486           previously.  This option is the inverse of --add-section.  This
487           option is similar to the --only-section option except that it does
488           not create a formatted file, it just dumps the contents as raw
489           binary data, without applying any relocations.  The option can be
490           specified more than once.
491
492       --update-section sectionname=filename
493           Replace the existing contents of a section named sectionname with
494           the contents of file filename.  The size of the section will be
495           adjusted to the size of the file.  The section flags for
496           sectionname will be unchanged.  For ELF format files the section to
497           segment mapping will also remain unchanged, something which is not
498           possible using --remove-section followed by --add-section.  The
499           option can be specified more than once.
500
501           Note - it is possible to use --rename-section and --update-section
502           to both update and rename a section from one command line.  In this
503           case, pass the original section name to --update-section, and the
504           original and new section names to --rename-section.
505
506       --add-symbol name=[section:]value[,flags]
507           Add a new symbol named name while copying the file.  This option
508           may be specified multiple times.  If the section is given, the
509           symbol will be associated with and relative to that section,
510           otherwise it will be an ABS symbol.  Specifying an undefined
511           section will result in a fatal error.  There is no check for the
512           value, it will be taken as specified.  Symbol flags can be
513           specified and not all flags will be meaningful for all object file
514           formats.  By default, the symbol will be global.  The special flag
515           'before=othersym' will insert the new symbol in front of the
516           specified othersym, otherwise the symbol(s) will be added at the
517           end of the symbol table in the order they appear.
518
519       --rename-section oldname=newname[,flags]
520           Rename a section from oldname to newname, optionally changing the
521           section's flags to flags in the process.  This has the advantage
522           over using a linker script to perform the rename in that the output
523           stays as an object file and does not become a linked executable.
524           This option accepts the same set of flags as the
525           --sect-section-flags option.
526
527           This option is particularly helpful when the input format is
528           binary, since this will always create a section called .data.  If
529           for example, you wanted instead to create a section called .rodata
530           containing binary data you could use the following command line to
531           achieve it:
532
533                     objcopy -I binary -O <output_format> -B <architecture> \
534                      --rename-section .data=.rodata,alloc,load,readonly,data,contents \
535                      <input_binary_file> <output_object_file>
536
537       --long-section-names {enable,disable,keep}
538           Controls the handling of long section names when processing "COFF"
539           and "PE-COFF" object formats.  The default behaviour, keep, is to
540           preserve long section names if any are present in the input file.
541           The enable and disable options forcibly enable or disable the use
542           of long section names in the output object; when disable is in
543           effect, any long section names in the input object will be
544           truncated.  The enable option will only emit long section names if
545           any are present in the inputs; this is mostly the same as keep, but
546           it is left undefined whether the enable option might force the
547           creation of an empty string table in the output file.
548
549       --change-leading-char
550           Some object file formats use special characters at the start of
551           symbols.  The most common such character is underscore, which
552           compilers often add before every symbol.  This option tells objcopy
553           to change the leading character of every symbol when it converts
554           between object file formats.  If the object file formats use the
555           same leading character, this option has no effect.  Otherwise, it
556           will add a character, or remove a character, or change a character,
557           as appropriate.
558
559       --remove-leading-char
560           If the first character of a global symbol is a special symbol
561           leading character used by the object file format, remove the
562           character.  The most common symbol leading character is underscore.
563           This option will remove a leading underscore from all global
564           symbols.  This can be useful if you want to link together objects
565           of different file formats with different conventions for symbol
566           names.  This is different from --change-leading-char because it
567           always changes the symbol name when appropriate, regardless of the
568           object file format of the output file.
569
570       --reverse-bytes=num
571           Reverse the bytes in a section with output contents.  A section
572           length must be evenly divisible by the value given in order for the
573           swap to be able to take place. Reversing takes place before the
574           interleaving is performed.
575
576           This option is used typically in generating ROM images for
577           problematic target systems.  For example, on some target boards,
578           the 32-bit words fetched from 8-bit ROMs are re-assembled in
579           little-endian byte order regardless of the CPU byte order.
580           Depending on the programming model, the endianness of the ROM may
581           need to be modified.
582
583           Consider a simple file with a section containing the following
584           eight bytes:  12345678.
585
586           Using --reverse-bytes=2 for the above example, the bytes in the
587           output file would be ordered 21436587.
588
589           Using --reverse-bytes=4 for the above example, the bytes in the
590           output file would be ordered 43218765.
591
592           By using --reverse-bytes=2 for the above example, followed by
593           --reverse-bytes=4 on the output file, the bytes in the second
594           output file would be ordered 34127856.
595
596       --srec-len=ival
597           Meaningful only for srec output.  Set the maximum length of the
598           Srecords being produced to ival.  This length covers both address,
599           data and crc fields.
600
601       --srec-forceS3
602           Meaningful only for srec output.  Avoid generation of S1/S2
603           records, creating S3-only record format.
604
605       --redefine-sym old=new
606           Change the name of a symbol old, to new.  This can be useful when
607           one is trying link two things together for which you have no
608           source, and there are name collisions.
609
610       --redefine-syms=filename
611           Apply --redefine-sym to each symbol pair "old new" listed in the
612           file filename.  filename is simply a flat file, with one symbol
613           pair per line.  Line comments may be introduced by the hash
614           character.  This option may be given more than once.
615
616       --weaken
617           Change all global symbols in the file to be weak.  This can be
618           useful when building an object which will be linked against other
619           objects using the -R option to the linker.  This option is only
620           effective when using an object file format which supports weak
621           symbols.
622
623       --keep-symbols=filename
624           Apply --keep-symbol option to each symbol listed in the file
625           filename.  filename is simply a flat file, with one symbol name per
626           line.  Line comments may be introduced by the hash character.  This
627           option may be given more than once.
628
629       --strip-symbols=filename
630           Apply --strip-symbol option to each symbol listed in the file
631           filename.  filename is simply a flat file, with one symbol name per
632           line.  Line comments may be introduced by the hash character.  This
633           option may be given more than once.
634
635       --strip-unneeded-symbols=filename
636           Apply --strip-unneeded-symbol option to each symbol listed in the
637           file filename.  filename is simply a flat file, with one symbol
638           name per line.  Line comments may be introduced by the hash
639           character.  This option may be given more than once.
640
641       --keep-global-symbols=filename
642           Apply --keep-global-symbol option to each symbol listed in the file
643           filename.  filename is simply a flat file, with one symbol name per
644           line.  Line comments may be introduced by the hash character.  This
645           option may be given more than once.
646
647       --localize-symbols=filename
648           Apply --localize-symbol option to each symbol listed in the file
649           filename.  filename is simply a flat file, with one symbol name per
650           line.  Line comments may be introduced by the hash character.  This
651           option may be given more than once.
652
653       --globalize-symbols=filename
654           Apply --globalize-symbol option to each symbol listed in the file
655           filename.  filename is simply a flat file, with one symbol name per
656           line.  Line comments may be introduced by the hash character.  This
657           option may be given more than once.  Note: this option cannot be
658           used in conjunction with the -G or --keep-global-symbol options.
659
660       --weaken-symbols=filename
661           Apply --weaken-symbol option to each symbol listed in the file
662           filename.  filename is simply a flat file, with one symbol name per
663           line.  Line comments may be introduced by the hash character.  This
664           option may be given more than once.
665
666       --alt-machine-code=index
667           If the output architecture has alternate machine codes, use the
668           indexth code instead of the default one.  This is useful in case a
669           machine is assigned an official code and the tool-chain adopts the
670           new code, but other applications still depend on the original code
671           being used.  For ELF based architectures if the index alternative
672           does not exist then the value is treated as an absolute number to
673           be stored in the e_machine field of the ELF header.
674
675       --writable-text
676           Mark the output text as writable.  This option isn't meaningful for
677           all object file formats.
678
679       --readonly-text
680           Make the output text write protected.  This option isn't meaningful
681           for all object file formats.
682
683       --pure
684           Mark the output file as demand paged.  This option isn't meaningful
685           for all object file formats.
686
687       --impure
688           Mark the output file as impure.  This option isn't meaningful for
689           all object file formats.
690
691       --prefix-symbols=string
692           Prefix all symbols in the output file with string.
693
694       --prefix-sections=string
695           Prefix all section names in the output file with string.
696
697       --prefix-alloc-sections=string
698           Prefix all the names of all allocated sections in the output file
699           with string.
700
701       --add-gnu-debuglink=path-to-file
702           Creates a .gnu_debuglink section which contains a reference to
703           path-to-file and adds it to the output file.  Note: the file at
704           path-to-file must exist.  Part of the process of adding the
705           .gnu_debuglink section involves embedding a checksum of the
706           contents of the debug info file into the section.
707
708           If the debug info file is built in one location but it is going to
709           be installed at a later time into a different location then do not
710           use the path to the installed location.  The --add-gnu-debuglink
711           option will fail because the installed file does not exist yet.
712           Instead put the debug info file in the current directory and use
713           the --add-gnu-debuglink option without any directory components,
714           like this:
715
716                    objcopy --add-gnu-debuglink=foo.debug
717
718           At debug time the debugger will attempt to look for the separate
719           debug info file in a set of known locations.  The exact set of
720           these locations varies depending upon the distribution being used,
721           but it typically includes:
722
723           "* The same directory as the executable."
724           "* A sub-directory of the directory containing the executable"
725               called .debug
726
727           "* A global debug directory such as /usr/lib/debug."
728
729           As long as the debug info file has been installed into one of these
730           locations before the debugger is run everything should work
731           correctly.
732
733       --keep-file-symbols
734           When stripping a file, perhaps with --strip-debug or
735           --strip-unneeded, retain any symbols specifying source file names,
736           which would otherwise get stripped.
737
738       --only-keep-debug
739           Strip a file, removing contents of any sections that would not be
740           stripped by --strip-debug and leaving the debugging sections
741           intact.  In ELF files, this preserves all note sections in the
742           output.
743
744           Note - the section headers of the stripped sections are preserved,
745           including their sizes, but the contents of the section are
746           discarded.  The section headers are preserved so that other tools
747           can match up the debuginfo file with the real executable, even if
748           that executable has been relocated to a different address space.
749
750           The intention is that this option will be used in conjunction with
751           --add-gnu-debuglink to create a two part executable.  One a
752           stripped binary which will occupy less space in RAM and in a
753           distribution and the second a debugging information file which is
754           only needed if debugging abilities are required.  The suggested
755           procedure to create these files is as follows:
756
757           1.<Link the executable as normal.  Assuming that it is called>
758               "foo" then...
759
760           1.<Run "objcopy --only-keep-debug foo foo.dbg" to>
761               create a file containing the debugging info.
762
763           1.<Run "objcopy --strip-debug foo" to create a>
764               stripped executable.
765
766           1.<Run "objcopy --add-gnu-debuglink=foo.dbg foo">
767               to add a link to the debugging info into the stripped
768               executable.
769
770           Note---the choice of ".dbg" as an extension for the debug info file
771           is arbitrary.  Also the "--only-keep-debug" step is optional.  You
772           could instead do this:
773
774           1.<Link the executable as normal.>
775           1.<Copy "foo" to  "foo.full">
776           1.<Run "objcopy --strip-debug foo">
777           1.<Run "objcopy --add-gnu-debuglink=foo.full foo">
778
779           i.e., the file pointed to by the --add-gnu-debuglink can be the
780           full executable.  It does not have to be a file created by the
781           --only-keep-debug switch.
782
783           Note---this switch is only intended for use on fully linked files.
784           It does not make sense to use it on object files where the
785           debugging information may be incomplete.  Besides the gnu_debuglink
786           feature currently only supports the presence of one filename
787           containing debugging information, not multiple filenames on a one-
788           per-object-file basis.
789
790       --strip-dwo
791           Remove the contents of all DWARF .dwo sections, leaving the
792           remaining debugging sections and all symbols intact.  This option
793           is intended for use by the compiler as part of the -gsplit-dwarf
794           option, which splits debug information between the .o file and a
795           separate .dwo file.  The compiler generates all debug information
796           in the same file, then uses the --extract-dwo option to copy the
797           .dwo sections to the .dwo file, then the --strip-dwo option to
798           remove those sections from the original .o file.
799
800       --extract-dwo
801           Extract the contents of all DWARF .dwo sections.  See the
802           --strip-dwo option for more information.
803
804       --file-alignment num
805           Specify the file alignment.  Sections in the file will always begin
806           at file offsets which are multiples of this number.  This defaults
807           to 512.  [This option is specific to PE targets.]
808
809       --heap reserve
810       --heap reserve,commit
811           Specify the number of bytes of memory to reserve (and optionally
812           commit) to be used as heap for this program.  [This option is
813           specific to PE targets.]
814
815       --image-base value
816           Use value as the base address of your program or dll.  This is the
817           lowest memory location that will be used when your program or dll
818           is loaded.  To reduce the need to relocate and improve performance
819           of your dlls, each should have a unique base address and not
820           overlap any other dlls.  The default is 0x400000 for executables,
821           and 0x10000000 for dlls.  [This option is specific to PE targets.]
822
823       --section-alignment num
824           Sets the section alignment field in the PE header.  Sections in
825           memory will always begin at addresses which are a multiple of this
826           number.  Defaults to 0x1000.  [This option is specific to PE
827           targets.]
828
829       --stack reserve
830       --stack reserve,commit
831           Specify the number of bytes of memory to reserve (and optionally
832           commit) to be used as stack for this program.  [This option is
833           specific to PE targets.]
834
835       --subsystem which
836       --subsystem which:major
837       --subsystem which:major.minor
838           Specifies the subsystem under which your program will execute.  The
839           legal values for which are "native", "windows", "console", "posix",
840           "efi-app", "efi-bsd", "efi-rtd", "sal-rtd", and "xbox".  You may
841           optionally set the subsystem version also.  Numeric values are also
842           accepted for which.  [This option is specific to PE targets.]
843
844       --extract-symbol
845           Keep the file's section flags and symbols but remove all section
846           data.  Specifically, the option:
847
848           *<removes the contents of all sections;>
849           *<sets the size of every section to zero; and>
850           *<sets the file's start address to zero.>
851
852           This option is used to build a .sym file for a VxWorks kernel.  It
853           can also be a useful way of reducing the size of a --just-symbols
854           linker input file.
855
856       --compress-debug-sections
857           Compress DWARF debug sections using zlib with SHF_COMPRESSED from
858           the ELF ABI.  Note - if compression would actually make a section
859           larger, then it is not compressed.
860
861       --compress-debug-sections=none
862       --compress-debug-sections=zlib
863       --compress-debug-sections=zlib-gnu
864       --compress-debug-sections=zlib-gabi
865           For ELF files, these options control how DWARF debug sections are
866           compressed.  --compress-debug-sections=none is equivalent to
867           --decompress-debug-sections.  --compress-debug-sections=zlib and
868           --compress-debug-sections=zlib-gabi are equivalent to
869           --compress-debug-sections.  --compress-debug-sections=zlib-gnu
870           compresses DWARF debug sections using zlib.  The debug sections are
871           renamed to begin with .zdebug instead of .debug.  Note - if
872           compression would actually make a section larger, then it is not
873           compressed nor renamed.
874
875       --decompress-debug-sections
876           Decompress DWARF debug sections using zlib.  The original section
877           names of the compressed sections are restored.
878
879       --elf-stt-common=yes
880       --elf-stt-common=no
881           For ELF files, these options control whether common symbols should
882           be converted to the "STT_COMMON" or "STT_OBJECT" type.
883           --elf-stt-common=yes converts common symbol type to "STT_COMMON".
884           --elf-stt-common=no converts common symbol type to "STT_OBJECT".
885
886       --merge-notes
887       --no-merge-notes
888           For ELF files, attempt (or do not attempt) to reduce the size of
889           any SHT_NOTE type sections by removing duplicate notes.
890
891       -V
892       --version
893           Show the version number of objcopy.
894
895       --verilog-data-width=bytes
896           For Verilog output, this options controls the number of bytes
897           converted for each output data element.  The input target controls
898           the endianness of the conversion.
899
900       -v
901       --verbose
902           Verbose output: list all object files modified.  In the case of
903           archives, objcopy -V lists all members of the archive.
904
905       --help
906           Show a summary of the options to objcopy.
907
908       --info
909           Display a list showing all architectures and object formats
910           available.
911
912       @file
913           Read command-line options from file.  The options read are inserted
914           in place of the original @file option.  If file does not exist, or
915           cannot be read, then the option will be treated literally, and not
916           removed.
917
918           Options in file are separated by whitespace.  A whitespace
919           character may be included in an option by surrounding the entire
920           option in either single or double quotes.  Any character (including
921           a backslash) may be included by prefixing the character to be
922           included with a backslash.  The file may itself contain additional
923           @file options; any such options will be processed recursively.
924

SEE ALSO

926       ld(1), objdump(1), and the Info entries for binutils.
927
929       Copyright (c) 1991-2020 Free Software Foundation, Inc.
930
931       Permission is granted to copy, distribute and/or modify this document
932       under the terms of the GNU Free Documentation License, Version 1.3 or
933       any later version published by the Free Software Foundation; with no
934       Invariant Sections, with no Front-Cover Texts, and with no Back-Cover
935       Texts.  A copy of the license is included in the section entitled "GNU
936       Free Documentation License".
937
938
939
940binutils-2.35                     2020-07-24                        OBJCOPY(1)
Impressum