Returns TRUE upon success, FALSE otherwise. */
static bool
-copy_object (bfd *ibfd, bfd *obfd, const bfd_arch_info_type *input_arch)
+copy_object (bfd *ibfd, bfd *obfd, const bfd_arch_info_type *input_arch,
+ bool target_defaulted)
{
bfd_vma start;
long symcount;
imach = 0;
}
if (!bfd_set_arch_mach (obfd, iarch, imach)
- && (ibfd->target_defaulted
+ && (target_defaulted
|| bfd_get_arch (ibfd) != bfd_get_arch (obfd)))
{
if (bfd_get_arch (ibfd) == bfd_arch_unknown)
static bool
copy_archive (bfd *ibfd, bfd *obfd, const char *output_target,
bool force_output_target,
- const bfd_arch_info_type *input_arch)
+ const bfd_arch_info_type *input_arch,
+ bool target_defaulted)
{
struct name_list
{
#endif
if (ok_object)
{
- ok = copy_object (this_element, output_element, input_arch);
+ ok = copy_object (this_element, output_element, input_arch,
+ target_defaulted);
if (!ok && bfd_get_arch (this_element) == bfd_arch_unknown)
/* Try again as an unknown object file. */
char **core_matching;
off_t size = get_file_size (input_filename);
const char *target = input_target;
+ bool target_defaulted = (!input_target
+ || strcmp (input_target, "default") == 0);
if (size < 1)
{
}
if (!copy_archive (ibfd, obfd, output_target, force_output_target,
- input_arch))
+ input_arch, target_defaulted))
status = 1;
}
else if (
else
#endif
{
- if (! copy_object (ibfd, obfd, input_arch))
+ if (! copy_object (ibfd, obfd, input_arch, target_defaulted))
status = 1;
/* PR 17512: file: 0f15796a.
run_pr33198_test "-fat" "-R .gnu.lto_* -R .gnu.debuglto_* -R .llvm.lto -N __gnu_lto_v1"
run_pr33198_test "" "-R .llvm.lto"
run_pr33198_test "-fat" "-R .llvm.lto"
+
+set t $srcdir/$subdir/pr33230.obj.bz2
+# We need to strip the ".bz2", but can leave the dirname.
+set test $subdir/[file tail $t]
+set testname [file rootname $test]
+verbose $testname
+set obj tmpdir/pr33230.o
+if {[catch "system \"bzip2 -dc $t > $obj\""] != 0} {
+ untested "bzip2 -dc ($testname)"
+} else {
+ set cmd "$STRIP $obj -o ${obj}.strip"
+ send_log "$cmd\n"
+ verbose "$cmd" 1
+ catch "exec $cmd" got
+ if [regexp "Unable to recognise the format" $got] then {
+ pass "$testname"
+ } else {
+ send_log "$got\n"
+ verbose "$got" 1
+ fail "$testname"
+ }
+ set cmd "$STRIP --input-target=default $obj -o ${obj}.strip"
+ send_log "$cmd\n"
+ verbose "$cmd" 1
+ catch "exec $cmd" got
+ if [regexp "Unable to recognise the format" $got] then {
+ pass "$testname"
+ } else {
+ send_log "$got\n"
+ verbose "$got" 1
+ fail "$testname (--input-target=default)"
+ }
+}