OBJCOPY(1) GNU Development Tools OBJCOPY(1) (NAME) objcopy - (Object Files) (SYNOPSIS) objcopy [-F bfdname|--target=bfdname] [-I bfdname|--input-target=bfdname] [-O bfdname|--output-target=bfdname] [-B bfdarch|--binary-architecture=bfdarch] [-S|--strip-all] [-g|--strip-debug] [--strip-unneeded] [-K symbolname|--keep-symbol=symbolname] [--keep-file-symbols] [--keep-section-symbols] [-N symbolname|--strip-symbol=symbolname] [--strip-unneeded-symbol=symbolname] [-G symbolname|--keep-global-symbol=symbolname] [--localize-hidden] [-L symbolname|--localize-symbol=symbolname] [--globalize-symbol=symbolname] [--globalize-symbols=filename] [-W symbolname|--weaken-symbol=symbolname] [-w|--wildcard] [-x|--discard-all] [-X|--discard-locals] [-b byte|--byte=byte] [-i [breadth]|--interleave[=breadth]] [--interleave-width=width] [-j sectionpattern|--only-section=sectionpattern] [-R sectionpattern|--remove-section=sectionpattern] [--keep-section=sectionpattern] [--remove-relocations=sectionpattern] [--strip-section-headers] [-p|--preserve-dates] [-D|--enable-deterministic-archives] [-U|--disable-deterministic-archives] [--debugging] [--gap-fill=val] [--pad-to=address] [--set-start=val] [--adjust-start=incr] [--change-addresses=incr] [--change-section-address sectionpattern{=,+,-}val] [--change-section-lma sectionpattern{=,+,-}val] [--change-section-vma sectionpattern{=,+,-}val] [--change-warnings] [--no-change-warnings] [--set-section-flags sectionpattern=flags] [--set-section-alignment sectionpattern=align] [--add-section sectionname=filename] [--dump-section sectionname=filename] [--update-section sectionname=filename] [--rename-section oldname=newname[,flags]] [--long-section-names {enable,disable,keep}] [--change-leading-char] [--remove-leading-char] [--reverse-bytes=num] [--srec-len=ival] [--srec-forceS3] [--redefine-sym old=new] [--redefine-syms=filename] [--weaken] [--keep-symbols=filename] [--strip-symbols=filename] [--strip-unneeded-symbols=filename] [--keep-global-symbols=filename] [--localize-symbols=filename] [--weaken-symbols=filename] [--binary-symbol-prefixstring] [--add-symbol name=[section:]value[,flags]] [--alt-machine-code=index] [--prefix-symbols=string] [--prefix-sections=string] [--prefix-alloc-sections=string] [--add-gnu-debuglink=path-to-file] [--only-keep-debug] [--strip-dwo] [--extract-dwo] [--extract-symbol] [--writable-text] [--readonly-text] [--pure] [--impure] [--file-alignment=num] [--heap=reserve[,commit]] [--image-base=address] [--section-alignment=num] [--stack=reserve[,commit]] [--subsystem=which:major.minor] [--compress-debug-sections] [--decompress-debug-sections] [--elf-stt-common=val] [--merge-notes] [--no-merge-notes] [--verilog-data-width=val] [-v|--verbose] [-V|--version] [--help] [--info] infile [outfile] (DESCRIPTION) objcopy (Object File) . objcopy BFD (GNU BFD Library) . objcopy . objcopy (Fully Linked) (Relocatable) . objcopy . objcopy BFD BFD . objcopy (S-records) srec ( -O srec). objcopy binary ( -O binary). objcopy (Memory Dump) . . -S . -R . : objcopy (Endianness) . ( ) objcopy ( srec). ( --reverse-bytes ). (OPTIONS) infile outfile . outfile objcopy infile . -I bfdname --input-target=bfdname bfdname . -O bfdname --output-target=bfdname bfdname . -F bfdname --target=bfdname bfdname . -B bfdarch --binary-architecture=bfdarch . bfdarch . . . _binary_objfile_start _binary_objfile_end _binary_objfile_size . . -j sectionpattern --only-section=sectionpattern . . . (Wildcard) sectionpattern . sectionpattern (!) --only-section . : --only-section=.text.* --only-section=!.text.foo '.text.*' '.text.foo' . -R sectionpattern --remove-section=sectionpattern sectionpattern . . . sectionpattern . -j -R . sectionpattern (!) --remove-section . : --remove-section=.text.* --remove-section=!.text.foo '.text.*' '.text.foo' . --keep-section=sectionpattern sectionpattern . --remove-relocations=sectionpattern (Non- dynamic Relocations) sectionpattern . . .rela.plt --remove-relocations=.plt . sectionpattern . : --remove-relocations=.text.* '.text.*' . sectionpattern (!) --remove-relocations . : --remove-relocations=.text.* --remove-relocations=!.text.foo '.text.*' '.text.foo' . --strip-section-headers (Section Headers) . ELF --strip-all --merge-notes . -S --strip-all . . -g --strip-debug . --strip-unneeded --strip-debug . -K symbolname --keep-symbol=symbolname symbolname . . -N symbolname --strip-symbol=symbolname symbolname . . --strip-unneeded-symbol=symbolname symbolname . . -G symbolname --keep-global-symbol=symbolname symbolname (Global) (Local) . . : --globalize-symbol --globalize-symbols . --localize-hidden ELF (Hidden) (Internal) . -L . -L symbolname --localize-symbol=symbolname symbolname . . : (Unique symbols) . -W symbolname --weaken-symbol=symbolname symbolname (Weak) . . --binary-symbol-prefix=string --input-target=binary string . : _start _end _size _binary . . --globalize-symbol=symbolname symbolname . . : -G --keep-global-symbol . -w --wildcard (Regular Expressions) symbolname . () (*) (\) ([]) . (!) . : -w -W !foo -W fo* objcopy "fo" "foo" (Weaken) . -x --discard-all . -X --discard-locals ( L . ). -b byte --byte=byte (Interleaving) --interleave byte . byte 0 breadth-1 breadth --interleave . -i [breadth] --interleave[=breadth] breadth ( ). --byte --interleave-width . (ROM) srec . --byte objcopy . 4 --byte 0 objcopy . --interleave-width=width --interleave width . --byte --interleave . 1 . width byte --byte --interleave . -b 0 -i 4 --interleave-width=2 -b 2 -i 4 --interleave-width=2 objcopy . '12345678' '1256' '3478' . -p --preserve-dates . PE SOURCE_DATE_EPOCH . (Unix epoch) . -D --enable-deterministic-archives (Deterministic). UID GID . binutils --enable-deterministic-archives . -U . -U --disable-deterministic-archives . -D UID GID . binutils --enable-deterministic-archives . --debugging . . --gap-fill val val . (LMA) val . --pad-to address address (Pad) . --gap-fill (: ) . --set-start val ( / Entry Address) val . . --change-start incr --adjust-start incr ( ) incr . . --change-addresses incr --adjust-vma incr VMA LMA incr . . (Relocate) . --change-section-address sectionpattern{=,+,-}val --adjust-section-vma sectionpattern{=,+,-}val VMA LMA sectionpattern . = val val . --change-addresses . sectionpattern --no-change-warnings . --change-section-lma sectionpattern{=,+,-}val LMA sectionpattern . LMA . VMA ( ) ROM . = val val . --change-addresses . sectionpattern --no-change-warnings . --change-section-vma sectionpattern{=,+,-}val VMA sectionpattern . VMA . LMA ( ) ROM . = val val . --change-addresses . sectionpattern --no-change-warnings . : VMA . --change-warnings --adjust-warnings --change-section-address --change-section-lma --change-section-vma . . --no-change-warnings --no-adjust-warnings --change-section-address --adjust-section-lma --adjust-section-vma . --set-section-flags sectionpattern=flags sectionpattern . flags . : alloc contents load noload readonly code data rom exclude share debug large. contents contents . share COFF ELF . large ELF x86-64 SHF_X86_64_LARGE . --set-section-alignment sectionpattern=align (Alignment) sectionpattern . align ( ...). : LMA VMA . --change-section-lma --change-section-vma . VMA . --add-section sectionname=filename sectionname . filename . . : --set-section-flags . --dump-section sectionname=filename sectionname filename . --add-section --only-section (Dump) . . --update-section sectionname=filename sectionname filename . sectionname . ELF (Segment) --remove-section --add-section . . : --rename-section --update-section . --update-section --rename-section . --add-symbol name=[section:]value[,flags] name . . section (ABS) . . . . . 'before=othersym' othersym . --rename-section oldname=newname[,flags] oldname newname flags . (Linker Script) . --set-section-flags . .data . .rodata : objcopy -I binary -O -B \ --rename-section .data=.rodata,alloc,load,readonly,data,contents \ --long-section-names {enable,disable,keep} COFF PE- COFF . keep . enable disable disable (Truncate) . enable keep enable . --change-leading-char . (_) . objcopy . . --remove-leading-char . (_) . . . --change-leading-char . --reverse-bytes=num . . (Interleaving) . ROM . ROM (Little-endian) . ROM . : 12345678 --reverse-bytes=2 21436587 . --reverse-bytes=4 43218765 . --reverse-bytes=2 --reverse-bytes=4 34127856 . --srec-len=ival srec . (S-records) ival . (CRC) . --srec-forceS3 srec . S1 S2 S3 . --redefine-sym old=new old new . (Name Collision) . --redefine-syms=filename --redefine-sym "old new" filename . filename . (#) . . --weaken (Weak) . -R . . --keep-symbols=filename --keep-symbol filename . filename . (#) . . --strip-symbols=filename --strip-symbol filename . (#) . . --strip-unneeded-symbols=filename --strip-unneeded-symbol filename . (#) . . --keep-global-symbols=filename --keep-global-symbol filename . (#) . . --localize-symbols=filename --localize-symbol filename . (#) . . --globalize-symbols=filename --globalize-symbol filename . (#) . . : -G --keep-global-symbol . --weaken-symbols=filename --weaken-symbol filename . (#) . . --alt-machine-code=index (Alternate Machine Codes) index . (Toolchain) . ELF index e_machine ELF . --writable-text ( / Text) (Writable) . . --readonly-text (Text) ( / Read-only) . . --pure (Demand Paged) . . --impure (Impure) . . --prefix-symbols=string string . --prefix-sections=string string . --prefix-alloc-sections=string string (Allocated Sections) . --add-gnu-debuglink=path-to-file .gnu_debuglink path-to-file . : path-to-file .gnu_debuglink (Checksum) . --add-gnu-debuglink . --add-gnu-debuglink ( ) : objcopy --add-gnu-debuglink=foo.debug . : o . o .debug. o /usr/lib/debug. . --keep-section-symbols ( --strip-debug --strip-unneeded) . --keep-file-symbols ( --strip-debug --strip-unneeded) . --only-keep-debug --strip-debug . ELF (Note sections) . : . . --add-gnu-debuglink : RAM . : 1. "foo" : 2. objcopy --only-keep-debug foo foo.dbg . 3. objcopy --strip-debug foo . 4. objcopy --add-gnu-debuglink=foo.dbg foo . : ".dbg" . --only-keep-debug : 1. . 2. "foo" "foo.full" . 3. objcopy --strip-debug foo . 4. objcopy --add-gnu-debuglink=foo.full foo . --add-gnu-debuglink --only-keep-debug . : . . gnu_debuglink . --strip-dwo DWARF .dwo . -gsplit-dwarf .o .dwo . --extract-dwo .dwo .dwo --strip-dwo .o . --extract-dwo DWARF .dwo . --strip-dwo . --file-alignment num (File Alignment) . . . [ PE .] --heap reserve --heap reserve,commit ( / Commit) (Heap) . [ PE .] --image-base value value (Base Address) dll . dll . dll dll . 0x400000 dll 0x10000000 . [ PE .] --section-alignment num [ PE .] (Section Alignment) PE ( ) . . 0x1000 . : LMA VMA --set-section-lma --set-section-vma LMA VMA . --stack reserve --stack reserve,commit ( Commit ) (Stack) . [ PE .] --subsystem which --subsystem which:major --subsystem which:major.minor . which : native windows console posix efi-app efi-bsd efi-rtd sal-rtd xbox. . which . [ PE .] --extract-symbol . : o . o . o . .sym VxWorks . --just-symbols . --compress-debug-sections DWARF zlib SHF_COMPRESSED ELF ABI . : . --compress-debug-sections=none --compress-debug-sections=zlib --compress-debug-sections=zlib-gnu --compress-debug-sections=zlib-gabi --compress-debug-sections=zstd ELF DWARF . --compress-debug-sections=none --decompress-debug-sections . --compress-debug-sections=zlib --compress-debug-sections=zlib-gabi --compress-debug-sections . --compress-debug-sections=zlib-gnu DWARF zlib-gnu .zdebug . --compress-debug-sections=zstd DWARF zstd . : . --decompress-debug-sections DWARF . .zdebug . --elf-stt-common=yes --elf-stt-common=no ELF (Common Symbols) STT_COMMON STT_OBJECT. --elf-stt-common=yes STT_COMMON --elf-stt-common=no STT_OBJECT . --merge-notes --no-merge-notes ELF SHT_NOTE ( ). -V --version objcopy . --verilog-data-width=bytes (Verilog) . (Endianness) . -v --verbose : . objcopy -v . --help objcopy. --info . @file file. @file . . file (Whitespace) . . ( ) (\) . @file . (SEE ALSO) ld(1), objdump(1) Info binutils. (COPYRIGHT) Copyright (c) 1991-2026 Free Software Foundation, Inc. / << >> (GNU Free Documentation License) . (FSF) . "GNU Free Documentation License" . binutils-2.47 2026-08-11 OBJCOPY(1)