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

DESCRIPTION

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

OPTIONS

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

SEE ALSO

843       ld(1), objdump(1), and the Info entries for binutils.
844
846       Copyright (c) 1991-2016 Free Software Foundation, Inc.
847
848       Permission is granted to copy, distribute and/or modify this document
849       under the terms of the GNU Free Documentation License, Version 1.3 or
850       any later version published by the Free Software Foundation; with no
851       Invariant Sections, with no Front-Cover Texts, and with no Back-Cover
852       Texts.  A copy of the license is included in the section entitled "GNU
853       Free Documentation License".
854
855
856
857binutils-2.27                     2016-08-03                        OBJCOPY(1)
Impressum