aboutsummaryrefslogtreecommitdiff
path: root/binutils/ar.c
AgeCommit message (Collapse)AuthorFilesLines
2017-07-17Correct previous fix for an absence of input files on the ar command line, ↵Nick Clifton1-3/+6
so that a complaint is not issued in MRI mode. PR 21433 * ar.c (main): Skip check for no files on the command line when running in MRI mode.
2017-04-26Fix invocation of stat() on a NULL pointer.Nick Clifton1-0/+3
PR binutils/21407 * bucomm.c (get_file_size): Return -1 if file_name is NULL. * ar.c (main): Fail with usage() invocation if no file names are provided.
2017-04-23PR 21418, ar -N lacks arg checkAlan Modra1-1/+7
PR 21418 * ar.c (main): Check -a, -b, -i and -N args are given.
2017-04-23PR 21417, ar arg check failureAlan Modra1-0/+2
PR 21417 * ar.c (main): Check that an archive file is given after options.
2017-01-02Update year range in copyright notice of all files.Alan Modra1-1/+1
2016-07-16Don't include libbfd.h outside of bfd, part 6Alan Modra1-0/+1
Some messing with plugin code in order to not need arelt_size in ld code. File descriptor handling in ld/plugin.c is tidied too, simply duping the open fd rather than opening the file again. bfd/ * elflink.c: Include plugin-api.h. * plugin.c (bfd_plugin_open_input): New function, extracted from.. (try_claim): ..here. * plugin.h: Don't include bfd.h. (bfd_plugin_open_input): Declare. binutils/ * ar.c: Include plugin-api.h. * nm.c: Likewise. ld/ * plugin.c: Don't include libbfd.h. Include plugin-api.h before bfd/plugin.h. (plugin_object_p): Use bfd_plugin_open_input.
2016-07-16Don't include libbfd.h outside of bfd, part 1Alan Modra1-1/+0
Make BFD_ALIGN available to objcopy. Fix assertions. Don't use bfd_log2 in ppc32elf.em or bfd_malloc in xtensaelf.em and bucomm.c. bfd/ * libbfd-in.h (BFD_ALIGN): Move to.. * bfd-in.h: ..here. * elf32-ppc.h (struct ppc_elf_params): Add pagesize. * elf32-ppc.c (default_params): Adjust init. (ppc_elf_link_params): Set pagesize_p2. * libbfd.h: Regenerate. * bfd-in2.h: Regenerate. binutils/ * ar.c: Don't include libbfd.h. * objcopy.c: Likewise. * bucomm.c (bfd_get_archive_filename): Use xmalloc rather than bfd_malloc. gas/ * config/bfin-parse.y: Don't include libbfd.h. * config/tc-bfin.c: Likewise. * config/tc-rl78.c: Likewise. * config/tc-rx.c: Likewise. * config/tc-metag.c: Likewise. (create_dspreg_htabs, create_scond_htab): Use gas_assert not BFD_ASSERT. * Makefile.am: Update dependencies. * Makefile.in: Regenerate. ld/ * ldlang.c: Don't include libbfd.h. * emultempl/nds32elf.em: Likewise. * emultempl/ppc64elf.em: Likewise. * emultempl/ppc32elf.em: Likewise. (pagesize): Delete. (params): Update init. (ppc_after_open_output): Use params.pagesize. Don't call bfd_log2. (PARSE_AND_LIST_ARGS_CASES): Use params.pagesize. * emultempl/sh64elf.em: Don't include libbfd.h. (after_allocation): Use ASSERT, not BFD_ASSERT. * emultempl/xtensaelf.em: Don't include libbfd.h. (replace_insn_sec_with_prop_sec): Use xmalloc, not bfd_malloc. * Makefile.am: Update dependencies. * Makefile.in: Regenerate.
2016-06-14Delete bfd_my_archive macroAlan Modra1-2/+2
Many more places use abfd->my_archive rather than bfd_my_archive (abfd), so let's make the code consistently use the first idiom. bfd/ * bfd-in.h (bfd_my_archive): Delete. * bfd-in2.h: Regenerate. binutils/ * ar.c: Expand uses of bfd_my_archive. * size.c: Likewise. ld/ * ldlang.c: Expand uses of bfd_my_archive. * ldmain.c: Likewise. * ldmisc.c: Likewise. * plugin.c: Likewise.
2016-01-01Copyright update for binutilsAlan Modra1-1/+1
2015-08-12Remove trailing spaces in binutilsH.J. Lu1-1/+1
2015-08-04Fix memory leak in ar if it encounters an invalid path whilst extracting files.Nick Clifton1-0/+1
* ar.c (extract_file): Free cbuf if the path is invalid.
2015-01-21Fix memory access violations triggered by running strip on fuzzed binaries.Nick Clifton1-0/+1
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-02ChangeLog rotatation and copyright year updateAlan Modra1-1/+1
2014-11-06Prevent archive memebers with illegal pathnames from being extracted from an ↵Nick Clifton1-0/+9
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-04-03This patch allows one to place the gcc's liblto_plugin in the ↵Markus Trippelsdorf1-2/+4
lib/bfd-plugins directory and have it loaded by default (as long as the --target option isn't used). PR binutils/14698 ar.c: Set plugin_target early if plugins are supported. nm.c: Likewise.
2014-03-05Update copyright yearsAlan Modra1-1/+1
2013-10-01 * arsup.c (ar_save): Respect the deterministic setting whenNick Clifton1-0/+1
reading from an mri script. * ar.c (main): Set the default deterministic mode when reading from an mri script.
2013-08-27 PR binutils/15796Nick Clifton1-0/+18
* ar.c (map_over_members): Correctly handle multiple same-name entries on the command line and in the archive.
2013-07-18 * ar.c (usage): Fix C conformance issue.Nick Clifton1-2/+2
* config/tc-i386-intel.c (i386_intel_operand): Fixed signed vs unsigned comparison.
2013-02-15 PR binutils/15140Nick Clifton1-3/+20
* ar.c (open_inarch): Fail on attempts to convert a normal archive to a thin archive or vice versa. * elfcomm.c (make_qualified_name): Handle corrupted thin archives. * readelf.c (process_archive): Likewise. * doc/binutils.texi: Clarify documentation describing thin archives. * archive.c (_bfd_get_elt_at_filepos): Prevent an infinite loop accessing a corrupt nested archive.
2013-01-07binutils/Roland McGrath1-2/+2
* 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-06-29 PR binutils/14302Nick Clifton1-15/+16
* bucomm.c (print_arelt_descr): Correctly report the archive size field (for 'ar tv'). * ar.c (print_contents): Use correct types for archive element sizes (for 'ar p'). (extract_file): Likewise (for 'ar x').
2012-02-09 * sysdep.h: Include sys/stat.h here.Alan Modra1-1/+0
* 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.
2012-02-01 PR binutils/13493Nick Clifton1-2/+13
* ar.c (ranlib_main): Process --plugin option. * doc/binutils.texi: Document --plugin support for ranlib.
2011-12-21 * configure.in (--enable-deterministic-archives): Grok newRoland McGrath1-7/+50
argument. Set DEFAULT_AR_DETERMINISTIC to 1 or 0 accordingly. * configure: Regenerated. * config.in: Regenerated. * ar.c (deterministic): Initialize to -1. (decode_options, ranlib_main): Grok U option. (usage, ranlib_usage): Mention U; say for D and U which is the default. (default_deterministic): New function. (ranlib_main): Call it. (main): Likewise. Make newer_only && deterministic error non-fatal if it was just DEFAULT_AR_DETERMINISTIC and not the D option. * doc/binutils.texi (ar cmdline, ranlib): Document U modifier and --enable-deterministic-archives behavior.
2011-11-29 * ar.c (ranlib_usage): Describe -D.Roland McGrath1-2/+9
(ranlib_main): Parse -D. (ranlib_touch): Set BFD_DETERMINISTIC_OUTPUT under -D. * doc/binutils.texi (ranlib): Describe -D, and also --help/-h/-H.
2011-10-16Set target from the the first object only if it isn't set.H.J. Lu1-3/+3
2011-10-16 H.J. Lu <hongjiu.lu@intel.com> PR binutils/13278 * ar.c (open_inarch): Set the target from the the first object on the list only if it isn't set.
2011-10-132011-10-13 Nick Clifton <nickc@redhat.com>Nick Clifton1-1/+1
Fixes to aid translation: * addr2line.c (translate_address): Add comments describing context of a couple of printf statements. * ar.c (write_archive): Allow translation of error message. * bucomm.c (endian_string): Allow translation of strings. (display_target_list): Allow translation. * coffdump.c (dump_coff_type): Allow translation of output. (dump_coff_where): Likewise. (dump_coff_symbol): Likewise. (dump_coff_scope): Likewise. (dump_coff_sfile): Likewise. (dump_coff_section): Likewise. (coff_dump): Likewise. * dlltool (def_version): Allow translation of output. (run): Likewise. * dllwrap.c (run): Allow translation of output. * dwarf.c (print_dwarf_vma): Allow translation of output. (process_extended_line_op): Remove spurious translation. Add translation for strings that can be translated. (decode_location_exression): Allow translation of output. (read_and_display_attr_value): Allow translation of output. * readelf.c (slurp_rela_relocs): Add translation for error messages when failing to get data. (slurp_rel_relocs): Likewise. (get_32bit_elf_symbols): Likewise. (get_64bit_elf_symbols): Likewise. (dump_ia64_vms_dynamic_relocs): Replace abbreviation with full word. (process_relocs): Remove spurious translation. (decode_tic6x_unwind_bytecode): Likewise. (process_version_section): Improve error messages. (process_mips_specific): Likewise. (print_gnu_note): Remove spurious translation. (print_stapsdt_note): Likewise. (get_ia64_vms_note_type): Likewise. * sysdump.c (getCHARS): Allow translation. (fillup): Allow translation of output. (getone): Likewise. (must): Likewise. (derived_type): Likewise. * doc/binutils.doc (addr2line): Extend description of command line options. * po/binutils.pot: Regenerate.
2011-06-30 PR binutils/12558Nick Clifton1-5/+11
* ar.c (main): When asked to move members in an archive that is being created, ignore the move request.
2011-05-02 PR binutils/12720Alan Modra1-20/+7
Revert the following change Michael Snyder <msnyder@vmware.com> * ar.c (move_members): Plug memory leak. (delete_members): Plug memory leak.
2011-03-25 * ar.c (write_archive): Plug memory leak.Nick Clifton1-0/+1
2011-03-25 * ar.c (delete_members): Plug memory leak.Nick Clifton1-2/+8
2011-03-25 * ar.c (move_members): Plug memory leak.Nick Clifton1-5/+12
2011-03-17 PR 12590Alan Modra1-2/+3
* ar.c (ranlib_main): Init arg_index properly. (usage): Describe --target.
2010-12-08 * ar.c: Formatting.Alan Modra1-29/+23
(usage): Correct help strings. (decode_options): Correct getopt_long short options. Remove duplicate non-handled option message. (main): Don't handle -M specially.
2010-12-08 * ar.c (long_options): Add target.Alan Modra1-4/+11
(decode_options): Handle the --target option. (open_inarch): Check for plugin's target, default to --target (replace_members): Use generic `target'.
2010-12-08 * ar.c (operation): New global variable.Alan Modra1-187/+223
(show_version): Likewise. (show_help): Likewise. (long_options): Likewise. (usage): Fix help string argument order. (decode_options): New. (ranlib_main): Use getopt_long. (main): Use decode_options.
2010-12-08 * ar.c (main): Split ranlib path.Alan Modra1-86/+111
(ranlib_usage): New (ranlib_main): New
2010-11-17 * ar.c (print_contents): Don't internationalize strings without words.Alan Modra1-2/+1
* dwarf.c (process_extended_line_op): Likewise. (process_debug_info): Likwise. (display_debug_lines_raw): Likewise. (display_debug_lines_decoded): Likewise. (display_debug_abbrev): Likewise. * readelf.c (process_file_header): Likewise. (GET_OP): Likewise. (decode_arm_unwind): Likewise. (process_mips_specific): Likewise. * resrc.c (run_cmd): Likewise. (rcparse_warning): Likewise. * objdump.c (dump_headers): Don't print "Pg".
2010-10-29 PR binutils/12058Nick Clifton1-2/+3
* ar.c (usage): Revert previous change. Describe how 's' can be used as a command letter. * doc/binutils.texi (ar cmdline): Describe how 's' can be used as a command letter.
2010-10-28 PR binutils/12058Nick Clifton1-2/+2
* ar.c (usage): Remove spurious 's' from list of accepted command letters.
2010-09-15Pass "plugin" as target for "ar --plugin" when opening a BFD file.H.J. Lu1-5/+9
2010-09-15 H.J. Lu <hongjiu.lu@intel.com> * ar.c (plugin_target): New. (main): Set plugin_target to "plugin" for --plugin. (open_inarch): Initialize target to plugin_target. (replace_members): Pass plugin_target to ar_emul_replace and ar_emul_append. * binemul.h (ar_emul_append): Add a target argument. (ar_emul_default_append): Likewise. (ar_emul_replace): Likewise. (ar_emul_default_replace): Likewise. (bin_emulation_xfer_struct): Add a target argument to ar_append and ar_replace. * binemul.c (ar_emul_append): Updated. Pass target to bfd_openr. (do_ar_emul_default_append): Likewise. (ar_emul_default_append): Likewise. (ar_emul_replace): Likewise. (ar_emul_default_replace): Likewise.
2010-01-132010-01-13 Tristan Gingold <gingold@adacore.com>Tristan Gingold1-33/+2
* ar.c (main): Use lbasename. (normalize): Ditto. * objdump.c (update_source_path): Ditto.
2010-01-082010-01-08 Tristan Gingold <gingold@adacore.com>Tristan Gingold1-6/+1
* ar.c: Remove bfd_special_undocumented_glue prototype.
2009-12-11Add -Wshadow to the gcc command line options used when compiling the binutils.Nick Clifton1-3/+3
Fix up all warnings generated by the addition of this switch.
2009-09-10 Updated soruces in binutils/* to compile cleanly with -Wc++-compat.Nick Clifton1-8/+8
* binutils/addr2line.c (slurp_symtab): Fix casts. Introduce variable minisyms to avoid aliasing varning. * binutils/ar.c: Add casts. (normalize): Use name del instead of delete. (display_target_list,display_info_table): Change loop counter variable a to int. * binutils/bucomm.c: Add casts. * binutils/debug.c: Update function to use new names. (struct debug_baseclass): Rename member from virtual to is_virtual. (struct debug_type_s,struct debug_field_s,struct debug_baseclass_s,struct debug_method_s,struct debug_method_variant_s,struct debug_type_s): Rename struct from avoid name collision. * /binutils/debug.h: Use new struct names. * binutils/dwarf.c: Add casts. (free_debug_memory): Change loop counter variable a to int. * binutils/ieee.c: Add casts. (enum ieee_var_kind): Move to top level. (ieee_class_baseclass): Rename parameter virtual to is_virtual. (ieee_class_method_var): Rename variable virtual to is_virtual. * binutils/nm.c: Add casts. * binutils/objcopy.c: Add casts. (copy_archive): Rename variable delete to del. * binutils/objdump.c: Add casts. (dump_dwarf_section): Change loop counter variable i to int. * binutils/prdbg.c: Add casts. (pr_class_baseclass,tg_class_baseclass): Rename parameters virtual to is_virtual. * binutils/readelf.c: Add casts. (struct ia64_unw_table_entry,struct hppa_unw_table_entry): Move to top level. * binutils/size.c: Add casts. * binutils/stabs.c (parse_stab_type, parse_stab_range_type) (parse_stab_cpp_abbrev): Rename parameter from typename to type_name. (parse_stab_baseclasses): Rename variable virtual to is_virtual. * binutils/strings.c: Add casts. * binutils/wrstabs.c (stab_class_baseclass): Rename parameter virtual to is_virtual.
2009-06-19 * ar.c (usage): Do not use #ifdef inside _("...).Nick Clifton1-3/+5
* nm.c (usage): Likewise.
2009-05-282009-05-28 Nick Clifton <nickc@redhat.com>Nick Clifton1-0/+3
* targets.c (_bfd_target_vector): Only include plugin target in all-targets build if BFD_SUPPORTS_PLUGINS is non-zero. 2009-05-27 Rafael Avila de Espindola <espindola@google.com> * plugin.c (program_name): Remove. (plugin_program_name): New. (bfd_plugin_set_program_name): New. (try_load_plugin): Use plugin_program_name. * plugin.h (bfd_plugin_set_program_name): New. 2009-05-27 Rafael Avila de Espindola <espindola@google.com> * ar.c (main): Call bfd_plugin_set_program_name. * nm.c (main): Call bfd_plugin_set_program_name.
2009-05-26 * Makefile.am: Run "make dep-am".Nick Clifton1-6/+35
(AM_CPPFLAGS): New. (LIBDL): New. (ALL_MACHINES): Add cpu-plugin.lo. (ALL_MACHINES_CFILES): Add cpu-plugin.c. (BFD32_BACKENDS): Add plugin.lo. (BFD32_BACKENDS_CFILES): Add plugin.c. (libbfd_la_LIBADD): Add LIBDL * archures.c (bfd_architecture): Add bfd_arch_plugin. (bfd_plugin_arch): Declare. * bfd-in.h (BFD_SUPPORTS_PLUGINS): New. * bfd.c (bfd): Add plugin_data. * config.bfd: Handle the plugin target. * configure.in: Check for --enable-plugins. (LT_INIT): Use the dlopen option. * cpu-plugin.c: New. * plugin.c: New. * plugin.h: New. * targets.c (plugin_vec): Declare. (_bfd_target_vector): Add plugin_vec. * Makefile.in: Regenerate. * bfd-in2.h: Regenerate. * configure: Regenerate. * ar.c: Include plugin.h. (main): Handle the --plugin option. * nm.c: Include plugin.h. (OPTION_PLUGIN): New. (long_options): Add plugin. (main): Handle OPTION_PLUGIN. * NEWS: Mention the new feature. * doc/binutils: Documement the new command line options. * configure.in: Check for --enable-plugins. * configure: Regenerate.
2009-03-11[bfd/ChangeLog]Chris Demetriou1-0/+15
2009-03-11 Chris Demetriou <cgd@google.com> * bfd.c (BFD_DETERMINISTIC_OUTPUT): New flag. * bfd-in2.h: Regenerate. * archive.c (bfd_ar_hdr_from_filesystem): If BFD_DETERMINISTIC_OUTPUT flag is set, use 0 for uid, gid, and timestamp, and use 0644 for file mode. (bsd_write_armap): Likewise. (_bfd_archive_bsd_update_armap_timestamp): If BFD_DETERMINISTIC_OUTPUT flag is set, do nothing. (coff_write_armap): If BFD_DETERMINISTIC_OUTPUT flag is set, use 0 for timestamp. [binutils/ChangeLog] 2009-03-11 Chris Demetriou <cgd@google.com> * ar.c (deterministic): New global variable. (main): Recognize new 'D' option, which enables 'deterministic mode'. (usage): Document new 'D' option. (write_archive): Set BFD_DETERMINISTIC_OUTPUT in output archive's flags if deterministic mode was requested. * doc/binutils.texi (ar): Document deterministic mode ('D' option). [binutils/testsuite/ChangeLog] 2009-03-11 Chris Demetriou <cgd@google.com> * binutils-all/ar.exp (deterministic_archive): New test.