aboutsummaryrefslogtreecommitdiff
path: root/binutils/objcopy.c
AgeCommit message (Collapse)AuthorFilesLines
2016-01-01Copyright update for binutilsAlan Modra1-1/+1
2015-11-20Fix building objcopy under mingw64 by replacing uses of strndup with xstrndup.Ronald Hoogenboom1-3/+3
* objcopy.c (parse_symflags): Use xstrndup in place of strndup. (copy_main): Likewise.
2015-10-22binutils/objcopy.c (setup_section): missing extract_symbol partHans-Peter Nilsson1-5/+0
* objcopy.c (setup_section): Don't omit bfd_copy_private_bfd_data call when extract_symbol.
2015-10-21Add ability for objcopy to insert new symbols into a binary.Ronald Hoogenbllon1-100/+303
PR binutils/19104 binutils * objcopy.c (command_line_switch): Add OPTION_ADD_SYMBOL. (copy_options): Add add-symbol. (copy_usage): Likewise. (parse_symflags): New function. (need_sym_before): New function. (create_new_symbol): New function. (filter_symbols): Add code to insert new symbols. (copy_main): Process OPTION_ADD_SYMBOL. * doc/binutils.texi: Document new feature. * NEWS: Add note about the new feature. tests * binutils-all/add-symbol.d: New test. * binutils-all/objcopy.exp: Run the new test.
2015-10-15objcopy --extract-symbolAlan Modra1-5/+0
Calling bfd_copy_private_bfd_data is necessary to copy ELF file header info. binutils/ * objcopy.c (copy_object): Don't omit bfd_copy_private_bfd_data call when extract_symbol. bfd/ * elf32-v850.c (v850_elf_copy_private_bfd_data): Remove assertion that input and output .note.renesas sections are same size. Instead, only copy input to output if they are.
2015-09-29Don't use the output section size to copy input sectionH.J. Lu1-22/+5
We can't use the output section size to copy input section since --interleave will shrink the output section. Instead, we change bfd_convert_section_contents to return the updated input section size. When we do that, we don't need to adjust the output section size to skip gap fills. bfd/ PR binutils/19020 * bfd.c (bfd_convert_section_contents): Add ptr_size parameter. * bfd-in2.h: Regenerated. binutils/ PR binutils/19020 * objcopy.c (copy_object): Don't adjust the output section size when copying from input sections. (copy_section): Use input section size for the copy. Get the updated section size from bfd_convert_section_contents. binutils/testsuite/ PR binutils/19020 * binutils-all/objcopy.exp: Run pr19020a and pr19020b. * lib/utils-lib.exp (run_dump_test): Support binary input. * binutils-all/pr19020.in: New file. * binutils-all/pr19020a.d: Likewise. * binutils-all/pr19020b.d: Likewise.
2015-09-29Adjust the output section size to skip gap fillsH.J. Lu1-4/+20
In objcopy, copy_object calls copy_section to copy contents of input section to output section. When --gap-fill= is used, objcopy extends the size of output sectios to fill gaps between output sections with gap fills. In this case, we adjust the output section size to skip gap files to avoid reading beypond the input section buffer before calling copy_section and restore the output section size after input sections have been copied. binutils/ PR binutils/19005 * objcopy.c (copy_object): Adjust the output section size to skip gap fills between sections when copying from input sections to output sections. ld/testsuite/ PR binutils/19005 * ld-elf/pr19005.d: New file. * ld-elf/pr19005.s: Likewise. * ld-elf/pr19005.t: Likewise.
2015-08-12Remove trailing spaces in binutilsH.J. Lu1-5/+5
2015-08-07objcopy: Improve wildcard matching for symbols with '!' prefix.Andrew Burgess1-4/+4
When using options such as --localize-symbol, --globalize-symbol, etc, along with the --wildcard option, prefixing a symbol name with '!' should provide non-matching behaviour, as example the following example is given in the manual: --wildcard --weaken-symbol !foo --weaken-symbol fo* which should weaken all symbols matching the pattern 'fo*', but not the symbol 'foo'. However, this currently does not work, the current logic will waken all symbols matching the pattern 'fo*' AND all symbols that are not 'foo'. The symbol 'foo' is covered by the first condition, and so is weakened, while, other symbols, for example 'bar' will match the second condition, and so be weakened. This patch adjusts the logic so that a pattern prefixed with '!' specifically DOES NOT apply the relevant change to any matching symbols, instead of applying the change to all non-matching symbols. So this: --weaken-symbol !foo will ensure that the symbol 'foo' is not weakened, but says nothing about symbols that are not 'foo'. As a result, a pattern prefixed with '!' now only makes sense when used alongside a more wide ranging wildcard pattern. This change should make the wildcard matching feature more useful, with no overall loss of functionality. The example given in the manual, weaken all symbols matching 'fo*' except 'foo' can now be achieved, but so too can more complex examples, such as weaken all symbols matching 'fo*' except 'foo', 'foa', and 'fob', like this: --wildcard --weaken-symbol !foo \ --weaken-symbol !foa \ --weaken-symbol !fob \ --weaken-symbol fo* Under the previous scheme, something as symbols as, weaken all symbols except 'foo' could have been achieved with this: --weaken-symbol !foo however, this will no longer work. To achieve the same result under the new scheme this is now required: --weaken-symbol !foo --weaken-symbol * binutils/ChangeLog: * objcopy.c (is_specified_symbol_predicate): Don't stop at first match. Non-match rules set found to FALSE. binutils/testsuite/ChangeLog: * binutils-all/objcopy.exp: Run new symbol tests. (objcopy_test_symbol_manipulation): New function. * binutils-all/symbols-1.d: New file. * binutils-all/symbols-2.d: New file. * binutils-all/symbols-3.d: New file. * binutils-all/symbols-4.d: New file. * binutils-all/symbols.s: New file.
2015-07-14Make default compression gABI compliantH.J. Lu1-1/+1
All programs in binutils+gdb git repo now support gABI compression with the SHF_COMPRESSED bit. This patch makes the zlib-gabi option as compression default for gas, gold, ld and objcopy, instead of the zlib-gnu option whose outputs are incompatible with gABI. binutils/ * objcopy.c (copy_file): Set BFD_COMPRESS_GABI if not zlib-gnu. * doc/binutils.texi: Change --compress-debug-sections and --compress-debug-sections=zlib to zlib-gabi. binutils/testsuite/ * binutils-all/compress.exp: Update. gas/ * as.c (parse_args): Make --compress-debug-sections and --compress-debug-sections=zlib the same as --compress-debug-sections=zlib-gabi. * doc/as.texinfo: Change --compress-debug-sections and --compress-debug-sections=zlib to zlib-gabi. gold/ * compressed_output.cc (Output_compressed_section::set_final_data_size): Make --compress-debug-sections=zlib the same as --compress-debug-sections=zlib-gabi. * testsuite/Makefile.am (flagstest_compress_debug_sections.check): Expect ".debug_.*" with the SHF_COMPRESSED bit, instead of ".zdebug_". * testsuite/Makefile.in: Regenerated. ld/ * emultempl/elf32.em (gld${EMULATION_NAME}_handle_option): Make --compress-debug-sections=zlib the same as --compress-debug-sections=zlib-gabi. * ld.texinfo: Change --compress-debug-sections=zlib to zlib-gabi. ld/testsuite/ * ld-elf/zlibbegin.rS: Updated to .debug_.* with the SHF_COMPRESSED bit. * ld-elf/zlibnormal.rS: Likewise.
2015-07-10Properly convert objects between different ELF classesH.J. Lu1-2/+9
The output SHF_COMPRESSED section size is different from input if ELF classes of input and output aren't the same. We must adjust the section sizes as well as the compression headers in SHF_COMPRESSED sections when converting objects between different ELF classes. bfd/ PR binutils/18656 * bfd.c (bfd_convert_section_size): New function. (bfd_convert_section_contents): Likewise. * bfd-in2.h: Regenerated. binutils/ 2015-07-10 H.J. Lu <hongjiu.lu@intel.com> PR binutils/18656 * objcopy.c (setup_section): Call bfd_convert_section_size to get the output section size. (copy_section): Get the section size from the output section and call bfd_get_full_section_contents to convert section contents for output. binutils/testsuite/ PR binutils/18656 * binutils-all/compress.exp (convert_test): New proc. Run conversion tests between x86-64 and x32.
2015-04-23Don't change compressed input debug section namesH.J. Lu1-0/+3
Change compressed input debug section name for objdump is very confusing. But we need to change it for linker so that linker will consider the input section as a debug section. This patch delays section rename to elf_fake_sections for objcopy and avoids it for objdump. bfd/ PR binutils/18209 * bfd.c (bfd): Add is_linker_input. * elf.c (convert_debug_to_zdebug): New. (convert_zdebug_to_debug): Likewise. (_bfd_elf_make_section_from_shdr): Don't convert .debug_* to .zdebug_* here. Use convert_zdebug_to_debug. Set SEC_ELF_RENAME. (_bfd_elf_init_reloc_shdr): Pass a pointer to section name instead of a pointer to section. (elf_fake_sections): Rename the section name if SEC_ELF_RENAME is set. * section.c (SEC_ELF_RENAME): New. * bfd-in2.h: Regenerated. binutils/ PR binutils/18209 * objcopy.c (setup_section): Copy compress status. binutils/testsuite/ PR binutils/18209 * binutils-all/compress.exp: Replace dw2-3.W with dw2-3gabi.W on zlib-gabi output. * binutils-all/dw2-1.W: Convert section names to .zdebug_*. * binutils-all/dw2-3.W: Likewise. * binutils-all/objdump.W: Likewise. * binutils-all/dw2-3gabi.W: New file. ld/ PR binutils/18209 * ldfile.c (ldfile_try_open_bfd): Set is_linker_input to 1.
2015-04-09Properly check --compress-debug-sections=XXXH.J. Lu1-14/+19
We can't check if input is ELF in copy_file since some targets may only set xvec after bfd_check_format_matches is called. This patch moves this check to copy_object. bfd/ * elfxx-target.h (TARGET_BIG_SYM): Add BFD_COMPRESS_GABI to object_flags. (TARGET_LITTLE_SYM): Likewise. binutils/ * objcopy.c (do_debug_sections): Use bit patterns. (copy_object): Return FALSE for compress_zlib, compress_gnu_zlib and compress_gabi_zlib on non-ELF input. (copy_file): Don't check non-ELF input here.
2015-04-08Add SHF_COMPRESSED support to gas and objcopyH.J. Lu1-3/+33
This patch adds --compress-debug-sections={none|zlib|zlib-gnu|zlib-gabi} options to gas and objcopy for ELF files. They control how DWARF debug sections are compressed. --compress-debug-sections=none is equivalent to --nocompress-debug-sections. --compress-debug-sections=zlib and --compress-debug-sections=zlib-gnu are equivalent to --compress-debug-sections. --compress-debug-sections=zlib-gabi compresses DWARF debug sections with SHF_COMPRESSED from the ELF ABI. No linker changes are required to support SHF_COMPRESSED. bfd/ * archive.c (_bfd_get_elt_at_filepos): Also copy BFD_COMPRESS_GABI bit. * bfd.c (bfd::flags): Increase size to 18 bits. (BFD_COMPRESS_GABI): New. (BFD_FLAGS_SAVED): Add BFD_COMPRESS_GABI. (BFD_FLAGS_FOR_BFD_USE_MASK): Likewise. (bfd_update_compression_header): New fuction. (bfd_check_compression_header): Likewise. (bfd_get_compression_header_size): Likewise. (bfd_is_section_compressed_with_header): Likewise. * compress.c (MAX_COMPRESSION_HEADER_SIZE): New. (bfd_compress_section_contents): Return the uncompressed size if the full section contents is compressed successfully. Support converting from/to .zdebug* sections. (bfd_get_full_section_contents): Call bfd_get_compression_header_size to get compression header size. (bfd_is_section_compressed): Renamed to ... (bfd_is_section_compressed_with_header): This. Add a pointer argument to return compression header size. (bfd_is_section_compressed): Use it. (bfd_init_section_decompress_status): Call bfd_get_compression_header_size to get compression header size. Return FALSE if uncompressed section size is 0. * elf.c (_bfd_elf_make_section_from_shdr): Support converting from/to .zdebug* sections. * bfd-in2.h: Regenerated. binutils/ * objcopy.c (do_debug_sections): Add compress_zlib, compress_gnu_zlib and compress_gabi_zlib. (copy_options): Use optional_argument on compress-debug-sections. (copy_usage): Update --compress-debug-sections. (copy_file): Handle compress_zlib, compress_gnu_zlib and compress_gabi_zlib. (copy_main): Handle --compress-debug-sections={none|zlib|zlib-gnu|zlib-gabi}. * doc/binutils.texi: Document --compress-debug-sections={none|zlib|zlib-gnu|zlib-gabi}. binutils/testsuite/ * compress.exp: Add tests for --compress-debug-sections={none|zlib|zlib-gnu|zlib-gabi}. * binutils-all/dw2-3.rS: New file. * binutils-all/dw2-3.rt: Likewise. * binutils-all/libdw2-compressedgabi.out: Likewise. gas/ * as.c (show_usage): Update --compress-debug-sections. (std_longopts): Use optional_argument on compress-debug-sections. (parse_args): Handle --compress-debug-sections={none|zlib|zlib-gnu|zlib-gabi}. * as.h (compressed_debug_section_type): New. (flag_compress_debug): Change type to compressed_debug_section_type. --compress-debug-sections={none|zlib|zlib-gnu|zlib-gabi}. * write.c (compress_debug): Set BFD_COMPRESS_GABI for --compress-debug-sections=zlib-gabi. Call bfd_get_compression_header_size to get compression header size. Don't rename section name for --compress-debug-sections=zlib-gabi. * config/tc-i386.c (compressed_debug_section_type): Set to COMPRESS_DEBUG_ZLIB. * doc/as.texinfo: Document --compress-debug-sections={none|zlib|zlib-gnu|zlib-gabi}. gas/testsuite/ * gas/i386/dw2-compressed-1.d: New file. * gas/i386/dw2-compressed-2.d: Likewise. * gas/i386/dw2-compressed-3.d: Likewise. * gas/i386/x86-64-dw2-compressed-2.d: Likewise. * gas/i386/i386.exp: Run dw2-compressed-2, dw2-compressed-1, dw2-compressed-3 and x86-64-dw2-compressed-2. ld/testsuite/ * ld-elf/compress.exp: Add a test for --compress-debug-sections=zlib-gabi. (build_tests): Add 2 tests for --compress-debug-sections=zlib-gabi. (run_tests): Likewise. Verify linker output with zlib-gabi compressed debug input. * ld-elf/compressed1a.d: New file. * ld-elf/compressed1b.d: Likewise. * ld-elf/compressed1c.d: Likewise.
2015-04-08Display --interleave[=<number>]H.J. Lu1-1/+1
Optional argument of a command line option must start with "=". * objcopy.c (copy_usage): Replace "--interleave [<number>]" with --interleave[=<number>].
2015-03-10Fixes a problem with objcopy leaving temporary files and directories around ↵Nick Clifton1-6/+18
if it encounters a problem during a copy. PR binutils/17636 * objcopy.c (copy_object): Avoid calling fatal as that does not allow the parent to clean up temporary files.
2015-02-28objcopy: Add --update-section option.Andrew Burgess1-0/+84
New option for objcopy --update-section allows the contents of a section to be updated while maintaining the section flags, and, for ELF files, the section to segment mapping. New test uses --dump-section and --update-section to check that a section can be made larger and smaller with an update. binutils/ChangeLog: * objcopy.c (update_sections): New list. (command_line_switch): Add OPTION_UPDATE_SECTION. (copy_options): Add update-section. (copy_usage): Document new option. (is_update_section): New function. (is_strip_section_1): Add check for attempt to update and remove the same section. (copy_object): Update size and content of requested sections. (skip_section): Don't copy for updated sections. (copy_main): Handle --update-section. * doc/binutils.texi (objcopy): Add description of --update-section option. * NEWS: Mention --update-section option. binutils/testsuite/ChangeLog: * binutils-all/update-1.s: New file. * binutils-all/update-2.s: New file. * binutils-all/update-3.s: New file. * binutils-all/update-4.s: New file. * binutils-all/update-section.exp: New file.
2015-02-26objcopy: Avoid shadowing optarg.Andrew Burgess1-4/+4
In commit 7173b38a442c007a554ea200817a0eadce89c87b I used optarg as the name for a function parameter, shadowing the global of that name. This commit changes the function parameter to be called arg. binutils/ChangeLog: * objcopy.c (init_section_add): Rename optarg to arg in order to avoid shadowing a global variable.
2015-02-25objcopy: Factor out some of the option parsing code.Andrew Burgess1-67/+78
This patch splits out some of the option parsing code, increasing code reuse. binutils/ChangeLog: * objcopy.c (init_section_add): New function. (section_add_load_file): New function. (copy_main): Make use of new functions.
2015-01-21Fix memory access violations triggered by running strip on fuzzed binaries.Nick Clifton1-3/+10
PR binutils/17512 * coffcode.h (coff_set_arch_mach_hook): Check return value from bfd_malloc. (coff_slurp_line_table): Return FALSE if the line number information was corrupt. (coff_slurp_symbol_table): Return FALSE if the symbol information was corrupt. * mach-o.c (bfd_mach_o_bfd_copy_private_header_data): Always initialise the fields of the dyld_info structure. (bfd_mach_o_build_exec_seg_command): Replace assertion with an error message and a return value. (bfd_mach_o_layout_commands): Change the function to boolean. Return FALSE if the function fails. (bfd_mach_o_build_commands): Fail if bfd_mach_o_layout_commands fails. (bfd_mach_o_read_command): Fail if an unrecognised command is encountered. * peXXigen.c (_bfd_XXi_swap_aouthdr_in): Set bfd_error if the read fails. (slurp_symtab): Check the return from bfd_malloc. (_bfd_XX_bfd_copy_private_bfd_data_common): Fail if the copy encountered an error. (_bfd_XXi_final_link_postscript): Fail if a section could not be copied. * peicode.h (pe_bfd_object_p): Fail if the header could not be swapped in. * tekhex.c (first_phase): Fail if the section is too big. * versados.c (struct esdid): Add content_size field. (process_otr): Use and check the new field. (versados_get_section_contents): Check that the section exists and that the requested data is available. PR binutils/17512 * addr2line.c (main): Call bfd_set_error_program_name. * ar.c (main): Likewise. * coffdump.c (main): Likewise. * cxxfilt.c (main): Likewise. * dlltool.c (main): Likewise. * nlmconv.c (main): Likewise. * nm.c (main): Likewise. * objdump.c (main): Likewise. * size.c (main): Likewise. * srconv.c (main): Likewise. * strings.c (main): Likewise. * sysdump.c (main): Likewise. * windmc.c (main): Likewise. * windres.c (main): Likewise. * objcopy.c (main): Likewise. (copy_relocations_in_section): Check for relocs without associated symbol pointers.
2015-01-08Fix memory access violations exposed by running strip on fuzzed binaries.Nick Clifton1-1/+13
PR binutils/17512 * coffcode.h (coff_slurp_symbol_table): Return false if we failed to load the line table. * elf.c (_bfd_elf_map_sections_to_segments): Enforce a minimum maxpagesize of 1. * peXXigen.c (_bfd_XX_bfd_copy_private_bfd_data_common): Fail if the Data Directory Size is too large. * objcopy.c (copy_object): Free the symbol table if no symbols could be loaded. (copy_file): Use bfd_close_all_done to close files that could not be copied.
2015-01-02ChangeLog rotatation and copyright year updateAlan Modra1-1/+1
2014-12-24This patch fixes a snafu where the -D and -U short versions of theAlexander Cherepanov1-2/+2
--enable-deterministic-archives and --disable-deteministic-archive options were not being accepted. PR binutils/17671 * objcopy.c (copy_main, strip_main): Add D and U to the list of accepted short versions of long options.
2014-12-23Clarify strip docs.Andrew Stubbs1-1/+1
binutils/ * objcopy.c (strip_usage): Reword --remove-section description. * doc/binutils.texi (strip): Likewise.
2014-11-10Fix objcopy and strip so that they remove their temporary files even if an ↵Nick Clifton1-7/+14
error occurs. PR binutils/17552 * (copy_archive): Clean up temporary files even if an error occurs.
2014-11-06Prevent archive memebers with illegal pathnames from being extracted from an ↵Nick Clifton1-0/+6
archive. PR binutils/17552, binutils/17533 * bucomm.c (is_valid_archive_path): New function. Returns false for absolute pathnames and pathnames that include /../. * bucomm.h (is_valid_archive_path): Add prototype. * ar.c (extract_file): Use new function to check for valid pathnames when extracting files from an archive. * objcopy.c (copy_archive): Likewise. * doc/binutils.texi: Update documentation to mention the limitation on pathname of archive members.
2014-09-08Change pe/coff build-id section name to '.buildid'Jon TURNEY1-2/+2
The section name used to store the build-id on pe/coff is arbitrary, as it's contents should be located using the pe/coff header's DataDirectory debug data entry, not by using the section name. But '.build-id' is not a good choice for that section name, as it is 9 characters long, and hence truncated to 8 characters when --disable-long-section-names is used (which is the default, when producing an executable with no dwarf debug sections, e.g. using ld --strip-all --build-id) This truncation then breaks 'objcopy --only-keep-debug', which does use the section name, due to concerns that keeping an arbitrary section which contains the debug directory is not sensible. binutils/ChangeLog 2014-09-01 Jon TURNEY <jon.turney@dronecode.org.uk> * objcopy.c (is_nondebug_keep_contents_section): Change pe/coff build-id section name from '.build-id' to '.buildid'. ld/ChangeLog 2014-09-01 Jon TURNEY <jon.turney@dronecode.org.uk> * emultempl/pe.em (write_build_id, setup_build_id): Change pe/coff build-id section name from '.build-id' to '.buildid'. * emultempl/pep.em (write_build_id, setup_build_id): Ditto. Signed-off-by: Jon TURNEY <jon.turney@dronecode.org.uk>
2014-05-16This fixes a few issues with pe/coff build-ids that were discovered since theJon Turney1-2/+19
original patches were posted: pe/coff: Display GUID build-id in the conventional way pe/coff: Don't interpret debug directory in section with no contents pe/coff: Keep .build-id with --only-keep-debug pe/coff: Don't break .build-id with objcopy/strip * peXXigen.c (pe_print_debugdata): Don't interpret debug directory in a section with no contents. (is_vma_in_section, find_section_by_vma): New functions. (_bfd_XX_bfd_copy_private_bfd_data_common): Recalculate file offsets in the debug directory. (_bfd_XXi_slurp_codeview_record, _bfd_XXi_write_codeview_record): Byte-swap GUID from little-endian to big-endian order for consistent and conventional display. * objcopy.c (is_nondebug_keep_contents_section): New function. (setup_section): Use it.
2014-04-07Report an error on objcopy/strip of sectionless binariesAlan Modra1-0/+7
All strip operations require section headers to be present, as do most objcopy operations. BFD is seriously confused by objects without section info. The error message added here is similar to the error on attempting to strip/objcopy a zero length object. PR binutils/16811 * objcopy.c (copy_object): Error if no sections.
2014-03-14Check fwrite return codeAnthony Green1-1/+6
2014-03-05Update copyright yearsAlan Modra1-1/+1
2013-12-31 * objcopy.c (dump_sections): New list.Nick Clifton1-0/+78
(command_line_switch): Add OPTION_DUMP_SECTION. (copy_options): Add dump-section. (copy_usage): Document new option. (copy_object): Dump requested sections. (copy_main): Handle --dump-section. * doc/binutils.texi: Document --dump-section option. * NEWS: Mention new feature.
2013-02-15 * objcopy.c (copy_main): Initialize context variable.Kai Tietz1-1/+1
2013-02-15 PR binutils/15033Nick Clifton1-105/+179
* objcopy.c (enum change_action): Delete. (struct section_list): Delete remove, copy, change_vma, change_lma and set_flags fields. Add context field. (find_section_list): Add a context parameter. Add support for wildcard characters in section names. (is_strip_section): Check for sections being both copied and removed. (copy_object): Pass context to find_section_list. (setup_section): Likewise. (copy_section): Likewise. (copy_main): Likewise. * doc/binutils: Document the new behaviour. * NEWS: Mention the new feature
2013-02-14 PR binutils/15125Nick Clifton1-48/+60
* objcopy.c (copy_object): Provide a helpful warning message when adding a gnu_debuglink section to an object which already contains one.
2013-01-28 * objcopy.c (parse_flags): Add merge and strings section flags.Alan Modra1-1/+3
2013-01-25* objcopy.c : Enable long section names for OPTION_ADD_GNU_DEBUGLINK.Nick Clifton1-0/+1
2013-01-07binutils/Roland McGrath1-10/+55
* objcopy.c (deterministic): Make int rather than bfd_boolean, initialize to -1. (strip_options, copy_options): Add -U/--disable-deterministic-archives. (default_deterministic): New function. (strip_main, copy_main): Handle -U. Call default_deterministic. (copy_usage, strip_usage): Describe -U. Cite whether -D or -U is the default based on DEFAULT_AR_DETERMINISTIC. * doc/binutils.texi (objcopy, strip): Describe -U and effect of configure options on -D. * ar.c (default_deterministic): Comment fix.
2012-11-07Don't read beyond section endH.J. Lu1-1/+5
* objcopy.c (copy_section): Don't read beyond section end.
2012-10-18 * objcopy.c (is_strip_section_1): Don't stripKai Tietz1-2/+8
.reloc section by default.
2012-05-08binutils/Cary Coutant1-4/+47
* doc/binutils.texi (objcopy): Add --strip-dwo, --extract-dwo options. (strip): Add --strip-dwo option. * objcopy.c (enum strip_action): Add STRIP_DWO, STRIP_NONDWO. (enum command_line_switch): Add OPTION_EXTRACT_DWO, OPTION_STRIP_DWO. (strip_options): Add --strip-dwo option. (copy_options): Add --extract-dwo, --strip-dwo options. (copy_usage): Likewise. (strip_usage): Add --strip-dwo option. (is_dwo_section): New function. (is_strip_section_1): Check for DWO sections. (copy_object): Check for --strip-dwo, --extract-dwo options. (copy_relocations_in_section): Discard relocations for DWO sections. Discard entire relocation section when no relocations. (strip_main): Add --strip-dwo option. (copy_main): Add --strip-dwo, --extract-dwo options.
2012-04-25 * doc/binutils.texi: Add -D/--enable-deterministic-archives optionCary Coutant1-1/+21
to strip and objcopy. * objcopy.c (deterministic): New global variable. (strip_options): Add --enable-deterministic-archives. (copy_options): Likewise. (copy_usage): Likewise. (strip_usage): Likewise. (copy_archive): When stripping all, don't add archive map; set deterministic output when requested. (strip_main): Add -D/--enable-deterministic-archives option. (copy_main): Likewise.
2012-04-13Don't generate empty reloc sectionsH.J. Lu1-17/+56
binutils/ PR binutils/13947 * objcopy.c (copy_object): Call copy_relocations_in_section before copy_section. (skip_section): New. (copy_relocations_in_section): Likewise. (copy_section): Use skip_section. Don't copy relocations here. binutils/testsuite/ PR binutils/13947 * binutils-all/i386/compressed-1b.d: Remove empty REL section. * binutils-all/i386/compressed-1c.d: Likewise. * binutils-all/x86-64/compressed-1b.d: Remove empty RELA section. * binutils-all/x86-64/compressed-1c.d: Likewise.
2012-02-09 * sysdep.h: Include sys/stat.h here.Alan Modra1-2/+1
* ar.c: Don't include headers already included by sysdep.h. * bucomm.c: Likewise. * budbg.h: Likewise. * dlltool.h: Likewise. * elfedit.c: Likewise. * nlmconv.c: Likewise. * objcopy.c: Likewise. * objdump.c: Likewise. * objdump.h: Likewise. * readelf.c: Likewise. * rename.c: Likewise. * resrc.c: Likewise. * strings.c: Likewise. * windres.c: Likewise. * od-macho.c: Ensure #include sysdep.h is first. * od-xcoff.c: Likewise. * dllwrap.c: Remove alloca pragma handled by sysdep.h, and remove duplicate headers. * dlltool.c: Likewise and ensure #include sysdep.h is first.
2011-09-16Remove the group section if all members are removed.H.J. Lu1-2/+27
binutils/ 2011-09-15 H.J. Lu <hongjiu.lu@intel.com> PR binutils/13180 * objcopy.c (is_strip_section_1): New. (is_strip_section): Use it. Remove the group section if all members are removed. binutils/testsuite/ 2011-09-15 H.J. Lu <hongjiu.lu@intel.com> PR binutils/13180 * binutils-all/group-6.d: New. * binutils-all/group-6.s: Likewise. * binutils-all/objcopy.exp: Run group-6 for ELF targrts.
2011-05-06 * objcopy.c (copy_archive): Check bfd_openw result in unknown objectAlan Modra1-31/+30
case. Rewrite without goto.
2011-04-04Make the unknown archive element readable.H.J. Lu1-1/+3
2011-04-03 H.J. Lu <hongjiu.lu@intel.com> PR binutils/12632 * objcopy.c (copy_unknown_object): Make the archive element readable.
2011-03-142011-03-14 Michael Snyder <msnyder@vmware.com>Michael Snyder1-0/+2
* objcopy.c (set_pe_subsystem): Free subsystem.
2011-02-28ChangeLog binutils/Kai Tietz1-2/+4
2011-02-28 Kai Tietz <kai.tietz@onevision.com> * debug.c (debug_start_source): Use filename_(n)cmp. * ieee.c (ieee_finish_compilation_unit): Likewise. (ieee_lineno): Likewise. * nlmconv.c (main): Likewise. * objcopy.c (strip_main): Likewise. (copy_main): Likewise. * objdump.c (show_line): Likewise. (dump_reloc_set): Likewise. * srconv.c (main): Likewise. * wrstabs.c (stab_lineno): Likewise. ChangeLog gas/ 2011-02-28 Kai Tietz <kai.tietz@onevision.com> * depend.c (register_dependency): Use filename_(n)cmp. * dwarf2dbg.c (get_filenum): Likewise. * ecoff.c (add_file): Likewise. (ecoff_generate_asm_lineno): Likewise. * input-scrub.c (new_logical_line_flags): Likewise. * listing.c (file_info): Likewise. (listing_newline): Likewise. * remap.c (remap_debug_filename): Likewise. * stabs.c (generate_asm_file): Likewise. (stabs_generate_asm_lineno): Likewise.
2010-11-08bfd/Alan Modra1-17/+0
* hash.c (bfd_hash_hash): Extract from.. (bfd_hash_lookup): ..here. (bfd_hash_rename): New function. * section.c (bfd_rename_section): New function. * bfd-in.h (bfd_hash_rename): Declare. * bfd-in2.h: Regenerate. * elf.c (_bfd_elf_make_section_from_shdr): Rename input sections when compressing or decompressing. Don't assert name match. * elf64-hppa.c (get_reloc_section): Don't assert name match. * elfxx-ia64.c (get_reloc_section): Likewise. binutils/ * objcopy.c (copy_main): No need to rename sections when compressing or decompressing. binutils/testsuite/ * binutils-all/objdump.W: Adjust expected result for debug section rename.