summaryrefslogtreecommitdiff
path: root/bfd/binary.c
diff options
context:
space:
mode:
authorNick Clifton <nickc@redhat.com>2001-03-13 00:08:35 +0000
committerNick Clifton <nickc@redhat.com>2001-03-13 00:08:35 +0000
commit4cdc3f7839736b214c2d71639d1bfef5c88b0cb7 (patch)
treedf64de2b67522ce71613668ed2029752c6956f72 /bfd/binary.c
parentea909ad306d06aaef0f82b8afdd8bf72e48b4d6e (diff)
downloadbinutils-redhat-4cdc3f7839736b214c2d71639d1bfef5c88b0cb7.tar.gz
Add --binary-architecture switch to objcopy to allow the output architecture
to be set when the input file type is binary.
Diffstat (limited to 'bfd/binary.c')
-rw-r--r--bfd/binary.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/bfd/binary.c b/bfd/binary.c
index b80343bed7..a008f90297 100644
--- a/bfd/binary.c
+++ b/bfd/binary.c
@@ -55,6 +55,10 @@ static boolean binary_set_section_contents
PARAMS ((bfd *, asection *, PTR, file_ptr, bfd_size_type));
static int binary_sizeof_headers PARAMS ((bfd *, boolean));
+/* Set by external programs - specifies the BFD architecture
+ to use when creating binary BFDs. */
+enum bfd_architecture bfd_external_binary_architecture = bfd_arch_unknown;
+
/* Create a binary object. Invoked via bfd_set_format. */
static boolean
@@ -101,6 +105,13 @@ binary_object_p (abfd)
abfd->tdata.any = (PTR) sec;
+ if (bfd_get_arch_info (abfd) != NULL)
+ {
+ if ((bfd_get_arch_info (abfd)->arch == bfd_arch_unknown)
+ && (bfd_external_binary_architecture != bfd_arch_unknown))
+ bfd_set_arch_info (abfd, bfd_lookup_arch (bfd_external_binary_architecture, 0));
+ }
+
return abfd->xvec;
}