diff options
author | Alan Modra <amodra@gmail.com> | 2025-01-05 21:44:06 +1030 |
---|---|---|
committer | Alan Modra <amodra@gmail.com> | 2025-01-06 14:09:32 +1030 |
commit | f832531609d01fc06068b60786bc55f5009bd759 (patch) | |
tree | 6a524e202a93ee9e9d98ab524d0b18d9f44f8432 /gdb/unittests | |
parent | a61beb42b0a12a8495755f95f9f4b97d7652b589 (diff) | |
download | gdb-master.zip gdb-master.tar.gz gdb-master.tar.bz2 |
ar is supposed to make archives containing any sort of file, and it
generally does that. It also tries to make archives suited to target
object files stored. Some targets have peculiar archives.
In one particular case we get into trouble trying to suit archives to
object files: where the target object file is recognised but that
target doesn't happen to support archives, and the default target has
a special archive format. For example, we'll get failures on
rs6000-aix if trying to add tekhex objects to a new archive. What
happens in that the tekhex object is recognised and its target vector
used to create an empty archive, ie. with _bfd_generic_mkarchive and
_bfd_write_archive_contents. An attempt is then made to open the
newly created archive. The tekhex target vector does not have a
check_format function to recognise generic archives, nor as it happens
do any of the xcoff or other targets built for rs6000-aix.
It seems to me the simplest fix is to not use any target vector to
create archives where that vector can't also recognise them. That's
what this patch does, and to reinforce that I've removed target vector
support for creating empty archives from such targets.
bfd/
* i386msdos.c (i386_msdos_vec): Remove support for creating
empty archives.
* ihex.c (ihex_vec): Likewise.
* srec.c (srec_vec, symbolsrec_vec): Likewise.
* tekhex.c (tekhex_vec): Likewise.
* wasm-module.c (wasm_vec): Likewise.
* ptrace-core.c (core_ptrace_vec): Tidy.
* targets.c (bfd_target_supports_archives): New inline function.
* bfd-in2.h: Regenerate.
binutils/
* ar.c (open_inarch): Don't select a target from the first
object file that can't read archives. Set output_filename
earlier.
* testsuite/binutils-all/ar.exp (thin_archive_with_nested):
Don't repeat --thin test using T.
(foreign_object): New test.
* testsuite/binutils-all/tek1.obj,
* testsuite/binutils-all/tek2.obj: New files.
Diffstat (limited to 'gdb/unittests')
0 files changed, 0 insertions, 0 deletions