• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Tags
No Tags

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

GNU Binutils with patches for OS216


Commit MetaInfo

Revisión6765ee1825d92d25d9b3f6260de3f8a2a27e4998 (tree)
Tiempo2019-11-19 17:56:40
AutorAlan Modra <amodra@gmai...>
CommiterAlan Modra

Log Message

PR24968, make objcopy use output ELF arch if -B not given

This should make objcopy -B redundant for the common case of producing
ELF output where the -O target defaults to the desired arch:mach.

PR 24968
* objcopy.c (copy_object): For ELF output and non-ELF input without
arch, take arch from output file if not given by -B. Don't
bfd_get_arch_info when we already have iarch.

Cambiar Resumen

Diferencia incremental

--- a/binutils/ChangeLog
+++ b/binutils/ChangeLog
@@ -1,5 +1,12 @@
11 2019-11-19 Alan Modra <amodra@gmail.com>
22
3+ PR 24968
4+ * objcopy.c (copy_object): For ELF output and non-ELF input without
5+ arch, take arch from output file if not given by -B. Don't
6+ bfd_get_arch_info when we already have iarch.
7+
8+2019-11-19 Alan Modra <amodra@gmail.com>
9+
310 PR 25191
411 * objcopy.c (is_nondebug_keep_contents_section): Use bfd_get_flavour.
512 (copy_object): Likewise.
--- a/binutils/objcopy.c
+++ b/binutils/objcopy.c
@@ -2646,8 +2646,7 @@ copy_object (bfd *ibfd, bfd *obfd, const bfd_arch_info_type *input_arch)
26462646 imach = bfd_get_mach (ibfd);
26472647 if (input_arch)
26482648 {
2649- if (bfd_get_arch_info (ibfd) == NULL
2650- || bfd_get_arch_info (ibfd)->arch == bfd_arch_unknown)
2649+ if (iarch == bfd_arch_unknown)
26512650 {
26522651 iarch = input_arch->arch;
26532652 imach = input_arch->mach;
@@ -2656,6 +2655,14 @@ copy_object (bfd *ibfd, bfd *obfd, const bfd_arch_info_type *input_arch)
26562655 non_fatal (_("Input file `%s' ignores binary architecture parameter."),
26572656 bfd_get_archive_filename (ibfd));
26582657 }
2658+ if (iarch == bfd_arch_unknown
2659+ && bfd_get_flavour (ibfd) != bfd_target_elf_flavour
2660+ && bfd_get_flavour (obfd) == bfd_target_elf_flavour)
2661+ {
2662+ const struct elf_backend_data *bed = get_elf_backend_data (obfd);
2663+ iarch = bed->arch;
2664+ imach = 0;
2665+ }
26592666 if (!bfd_set_arch_mach (obfd, iarch, imach)
26602667 && (ibfd->target_defaulted
26612668 || bfd_get_arch (ibfd) != bfd_get_arch (obfd)))