diff options
author | Howard Chu <hyc@symas.com> | 2020-11-03 15:12:47 +0000 |
---|---|---|
committer | Nick Clifton <nickc@redhat.com> | 2020-11-03 15:12:47 +0000 |
commit | f3016d6ce178b76002edde12c30ebe7f608a8e21 (patch) | |
tree | c8c1943182747f75bafa7c34c4b7562ea7dfbbce /binutils/binemul.c | |
parent | fd65497db4098140490e59e3dbf4709da5536081 (diff) | |
download | gdb-f3016d6ce178b76002edde12c30ebe7f608a8e21.zip gdb-f3016d6ce178b76002edde12c30ebe7f608a8e21.tar.gz gdb-f3016d6ce178b76002edde12c30ebe7f608a8e21.tar.bz2 |
Add an option to the archiver to add a section recording library dependencies.
* ar.c (long_options): Add --record-libdeps.
(usage): Mention the new option.
(decode_options): Handle the new option.
(replace_members): If necessary, create a bfd to hold the libdeps
description.
* binemul.c (ar_emul_append_bfd): New function.
(ar_emul_replace_bfd): New function.
(ar_emul_default_append): Replace file_name and target arguments
with new_bfd argument.
(ar_emul_default_replace): Likewise.
* binemul.h: Update prototypes.
(struct bin_emulation_xfer_struct): Update fields.
* doc/binutils.texi: Document the new option.
* NEWS: Mention the new feature.
* emul_aix.c (ar_emul_aix_append): Update.
(ar_emul_aix_replace): Likewise.
* testsuite/binutils-all/ar.exp: Add test of new feature.
Diffstat (limited to 'binutils/binemul.c')
-rw-r--r-- | binutils/binemul.c | 53 |
1 files changed, 37 insertions, 16 deletions
diff --git a/binutils/binemul.c b/binutils/binemul.c index 7c71b5b..8a0512e 100644 --- a/binutils/binemul.c +++ b/binutils/binemul.c @@ -42,8 +42,23 @@ bfd_boolean ar_emul_append (bfd **after_bfd, char *file_name, const char *target, bfd_boolean verbose, bfd_boolean flatten) { + bfd *new_bfd; + + new_bfd = bfd_openr (file_name, target); + AR_EMUL_ELEMENT_CHECK (new_bfd, file_name); + if (bin_dummy_emulation.ar_append) + return bin_dummy_emulation.ar_append (after_bfd, new_bfd, + verbose, flatten); + + return FALSE; +} + +bfd_boolean +ar_emul_append_bfd (bfd **after_bfd, bfd *new_bfd, + bfd_boolean verbose, bfd_boolean flatten) +{ if (bin_dummy_emulation.ar_append) - return bin_dummy_emulation.ar_append (after_bfd, file_name, target, + return bin_dummy_emulation.ar_append (after_bfd, new_bfd, verbose, flatten); return FALSE; @@ -93,14 +108,9 @@ do_ar_emul_append (bfd **after_bfd, bfd *new_bfd, } bfd_boolean -ar_emul_default_append (bfd **after_bfd, char *file_name, - const char *target, bfd_boolean verbose, - bfd_boolean flatten) +ar_emul_default_append (bfd **after_bfd, bfd *new_bfd, + bfd_boolean verbose, bfd_boolean flatten) { - bfd *new_bfd; - - new_bfd = bfd_openr (file_name, target); - AR_EMUL_ELEMENT_CHECK (new_bfd, file_name); return do_ar_emul_append (after_bfd, new_bfd, verbose, flatten, any_ok); } @@ -108,23 +118,34 @@ bfd_boolean ar_emul_replace (bfd **after_bfd, char *file_name, const char *target, bfd_boolean verbose) { + bfd *new_bfd; + + new_bfd = bfd_openr (file_name, target); + AR_EMUL_ELEMENT_CHECK (new_bfd, file_name); + if (bin_dummy_emulation.ar_replace) - return bin_dummy_emulation.ar_replace (after_bfd, file_name, - target, verbose); + return bin_dummy_emulation.ar_replace (after_bfd, new_bfd, + verbose); return FALSE; } bfd_boolean -ar_emul_default_replace (bfd **after_bfd, char *file_name, - const char *target, bfd_boolean verbose) +ar_emul_replace_bfd (bfd **after_bfd, bfd *new_bfd, + bfd_boolean verbose) { - bfd *new_bfd; + if (bin_dummy_emulation.ar_replace) + return bin_dummy_emulation.ar_replace (after_bfd, new_bfd, + verbose); - new_bfd = bfd_openr (file_name, target); - AR_EMUL_ELEMENT_CHECK (new_bfd, file_name); + return FALSE; +} - AR_EMUL_REPLACE_PRINT_VERBOSE (verbose, file_name); +bfd_boolean +ar_emul_default_replace (bfd **after_bfd, bfd *new_bfd, + bfd_boolean verbose) +{ + AR_EMUL_REPLACE_PRINT_VERBOSE (verbose, bfd_get_filename (new_bfd)); new_bfd->archive_next = *after_bfd; *after_bfd = new_bfd; |