1 /* Binutils emulation layer.
2 Copyright 2002, 2003, 2005, 2006, 2007, 2008, 2010
3 Free Software Foundation, Inc.
4 Written by Tom Rix, Red Hat Inc.
6 This file is part of GNU Binutils.
8 This program is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 3 of the License, or
11 (at your option) any later version.
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
18 You should have received a copy of the GNU General Public License
19 along with this program; if not, write to the Free Software
20 Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
21 MA 02110-1301, USA. */
25 #include "coff/internal.h"
26 #include "coff/xcoff.h"
30 /* Default to <bigaf>. */
31 /* FIXME: write only variable. */
32 static bfd_boolean big_archive
= TRUE
;
34 /* Whether to include 32 bit objects. */
35 static bfd_boolean X32
= TRUE
;
37 /* Whether to include 64 bit objects. */
38 static bfd_boolean X64
= FALSE
;
41 ar_emul_aix_usage (FILE *fp
)
43 AR_EMUL_USAGE_PRINT_OPTION_HEADER (fp
);
44 /* xgettext:c-format */
45 fprintf (fp
, _(" [-g] - 32 bit small archive\n"));
46 fprintf (fp
, _(" [-X32] - ignores 64 bit objects\n"));
47 fprintf (fp
, _(" [-X64] - ignores 32 bit objects\n"));
48 fprintf (fp
, _(" [-X32_64] - accepts 32 and 64 bit objects\n"));
52 check_aix (bfd
*try_bfd
)
54 extern const bfd_target rs6000coff_vec
;
55 extern const bfd_target rs6000coff64_vec
;
56 extern const bfd_target aix5coff64_vec
;
58 if (bfd_check_format (try_bfd
, bfd_object
))
60 if (!X32
&& try_bfd
->xvec
== &rs6000coff_vec
)
63 if (!X64
&& (try_bfd
->xvec
== &rs6000coff64_vec
64 || try_bfd
->xvec
== &aix5coff64_vec
))
71 ar_emul_aix_append (bfd
**after_bfd
, char *file_name
, const char *target
,
72 bfd_boolean verbose
, bfd_boolean flatten
)
76 new_bfd
= bfd_openr (file_name
, target
);
77 AR_EMUL_ELEMENT_CHECK (new_bfd
, file_name
);
79 return do_ar_emul_append (after_bfd
, new_bfd
, verbose
, flatten
, check_aix
);
83 ar_emul_aix_replace (bfd
**after_bfd
, char *file_name
, const char *target
,
88 new_bfd
= bfd_openr (file_name
, target
);
89 AR_EMUL_ELEMENT_CHECK (new_bfd
, file_name
);
91 if (!check_aix (new_bfd
))
94 AR_EMUL_REPLACE_PRINT_VERBOSE (verbose
, file_name
);
96 new_bfd
->archive_next
= *after_bfd
;
103 ar_emul_aix_parse_arg (char *arg
)
105 if (CONST_STRNEQ (arg
, "-X32_64"))
111 else if (CONST_STRNEQ (arg
, "-X32"))
117 else if (CONST_STRNEQ (arg
, "-X64"))
123 else if (CONST_STRNEQ (arg
, "-g"))
135 struct bin_emulation_xfer_struct bin_aix_emulation
=
140 ar_emul_aix_parse_arg
,