Commit Graph

4505 Commits

Author SHA1 Message Date
Frederic Cambus
73b22419ed Add support to readelf for the PT_OPENBSD_NOBTCFI segment type. 2023-09-28 13:39:01 +01:00
Aaron Merey
28bc495137 config/debuginfod.m4: Add check for libdebuginfod 0.188
Add check for libdebuginfod 0.188 in AC_DEBUGINFOD and if found
define macro HAVE_LIBDEBUGINFOD_FIND_SECTION.

This macro indicates support for downloading ELF sections from
debuginfod servers.
2023-09-27 15:11:13 -04:00
Nick Clifton
854f72b36d Fix a snafu in the new tests for reproducible archives that assumed a umask of 22. 2023-09-26 16:27:28 +01:00
Nick Clifton
6f56739807 Allow the use of SOURCE_DATE_EPOCH in the timestamps for members of static archives.
(For some reason this commit was not applied at the time that the patch was approved).
2023-09-26 14:07:23 +01:00
Vsevolod Alekseyev
84102ebc29 Fix readelf's display of dwarf v5 range lists
PR 30792
  * dwarf.h (struct debug_info): Remove range_versions field.
  * dwarf.c (fetch_indexed_offset): New function. (read_and_display_attr_value): Use it for DW_FORM_rnglistx. Remove code to initialise range_versions. (skip_attribute): New function. (read_bases): Read and reccord all range and address bases in a CU. (process_debug_info): Call read_bases. (display_debug_rnglists): Rename to display_debug_rnglists_unit_header and only display the range list header information. (display_debug_ranges): Adjust.
2023-09-25 18:01:31 +01:00
Claudiu Zissulescu
f14cd06ba4 Revert "arc: Update NEWS files"
This reverts commit a47d304b12.
2023-09-25 17:01:47 +03:00
Claudiu Zissulescu
a47d304b12 arc: Update NEWS files
Add ARCv3 support in NEWS files.

Signed-off-by: Claudiu Zissulescu <claziss@gmail.com>
2023-09-25 11:33:12 +03:00
Claudiu Zissulescu
f0a3c3dd52 arc: Update binutils arc predicate for tests.
binutils/testsuite/binutils-all
xxxx-xx-xx  Claudiu Zissulescu  <claziss@synopsys.com>

	* binutils/testsuite/binutils-all/arc/objdump.exp: Update predicate.

Signed-off-by: Claudiu Zissulescu <claziss@synopsys.com>
2023-09-25 10:32:52 +03:00
Alan Modra
765a0c0a86 readelf.c 'ext' may be used uninitialized
* readelf.c (display_lto_symtab): Init ext.
2023-09-20 08:23:48 +09:30
Nick Clifton
b6ac461ace readelf: Add option to display the names of sections referenced by symbols.
PR 30684
  * readelf.c (extra_sym_info): New variable. (section_name_valid): Also check for filedata being NULL. (section_name_print): Delete. (section_index_real): New function.  Returns true if the given section index references a real section. (print_symbol): Rename to print_sumbol_name. (printable_section_name): Use a rotating array of static buffers for the return string. (printable_section_name_from_index): Merge code from dump_relocations and get_symbol_index_type into here. (long_option_values): Add OPTION_NO_EXTRA_SYM_INFO. (options): Add "extra-sym-info" and "no-extra-sym-info". (usage): Mention new options. (parse_args): Parse new options. (get_symbol_index_type): Delete. (print_dynamic_symbol_size): Rename to print_symbol_size. (print_dynamic_symbol): Rename to print_symbol. (print_symbol_table_heading): New function. (process_symbol_table): Use new function.
  * doc/binutils.texi: Document the new option.
  * NEWS: Mention the new feature.
2023-09-05 11:08:23 +01:00
Nicolas Boulenguez
eb5b52158f PR30806, CPPFLAGS are missing for bfd/chew, syslex_wrap and sysinfo
PR 30806
bfd/
	* doc/local.mk (doc/chew.stamp): Add CPPFLAGS_FOR_BUILD.
	* Makefile.in: Regenerate.
binutils/
	* Makefile.am (syslex_wrap.@OBJEXT@): Add CPPFLAGS_FOR_BUILD.
	(sysinfo.@OBJEXT@): Likewise.
	* Makefile.in: Regenerate.
2023-09-01 09:18:05 +09:30
Alan Modra
aa1e22eb8d objdump: Free sorted_syms on error path
* objdump.c (disassemble_data): Free sorted_syms before returning.
2023-08-30 11:22:23 +09:30
Alan Modra
0283863037 binutils/dwarf.c abbrev list leak
* dwarf.c (process_debug_info): Call free_abrev_list on
	return paths.
2023-08-30 11:22:23 +09:30
Alan Modra
a422bb9db1 Re: readelf/objdump: Handle DWARF info with mixed types of range section
PR 30791
	* dwarf.c (free_debug_information): Free range_versions.
2023-08-30 11:22:23 +09:30
Nicolas Boulenguez
90de8f9c80 readelf: typos in user messages 2023-08-29 16:04:47 +01:00
Nick Clifton
d367563d55 Correct PR number in previous delta 2023-08-23 11:40:59 +01:00
Nick Clifton
589d38af0d readelf/objdump: Handle DWARF info with mixed types of range section.
PR 30791
  * dwarf.h (debug_info): Add range_versions field.
  * dwarf.c (read_and_display_attr_value): When recording a range arribute also ecord the dwarf version number.
  (is_range_list_for_this_section): New function.
  (display_debug_ranges): Only show debug ranges whose version is suitable for the secction being displayed.
2023-08-23 11:36:25 +01:00
Alan Modra
8c8145a43e bfd_get_symbol_leading_char vs. ""
Some places matching the first char of a string against
bfd_get_symbol_leading_char, which may be zero, didn't check for the
string being "".  This patch adds the check to stop accesses past the
end of the string and potential buffer overruns.
The dlltool one was found by oss-fuzz quite a while ago.

bfd/
	* cofflink.c (_bfd_coff_link_input_bfd): Ensure a zero
	bfd_get_symbol_leading_char doesn't lead to accessing past the
	zero string terminator.
	* linker.c (bfd_wrapped_link_hash_lookup): Likewise.
	(unwrap_hash_lookup): Likewise.
binutils/
	* dlltool.c (scan_filtered_symbols): Ensure a zero
	bfd_get_symbol_leading_char doesn't lead to accessing past the
	zero string terminator.
2023-08-23 10:07:45 +09:30
Alan Modra
8032f75b29 objdump: file name table entry count check
Fuzzers have found that objdump -W takes a really long time if
the entry count uleb is ridiculously large, and format attributes
don't consume data (which doesn't make sense for a table of names).

	* dwarf.c (display_formatted_table): Sanity check count of
	table entries.
2023-08-22 11:41:37 +09:30
Alan Modra
bb8b2f633e Re: kvx: New port.
Add files submitted on the mailing list but somehow not committed.
2023-08-22 09:35:55 +09:30
Luis Machado
11e3488d3f aarch64/sme2: Teach binutils/BFD about the NT_ARM_ZT register set
The Scalable Matrix Extension v2 (SME2) defines a new register, ZT0, that
the Linux Kernel handles through a new NT_ARM_ZT register set.

Teach binutils/BFD about it so that gdb can make use of it for reading
and writing core files.  This also enables readelf/objdump to show the
correct identification for the NT_ARM_ZT register set.

Validated under Fast Models.
2023-08-21 12:43:43 +01:00
Paul Iannetta
6e712424f5 kvx: New port. 2023-08-16 14:22:54 +01:00
Alan Modra
9381cdb1fb Remove fall-back prune_warnings
No one should be using versions of dejagnu without prune_warnings,
which was available in 1996 (dejagnu-1.3).

binutils/
	* testsuite/lib/binutils-common.exp: Remove fallback prune_warnings.
gas/
	* testsuite/lib/gas-defs.exp: Remove fallback prune_warnings.
2023-08-14 17:07:19 +09:30
Alan Modra
6a6859cbff regen config
This regenerates config files changed by the previous 44 commits.
Note that subject lines in these commits mostly match the gcc git
originating commit.
2023-08-12 10:27:57 +09:30
Alan Modra
e416bd75c3 warn unused result for bfd IO functions
This patch fixes all the warnings I found in bfd, binutils and ld,
plus some bitrotted COFF_GO32 code that tried to allocate -168ul
bytes.  When the malloc fail was reported these testsuite fails
resulted:

i386-go32  +FAIL: go32 stub
i386-go32  +ERROR: tcl error sourcing /home/alan/src/binutils-gdb/ld/testsuite/ld-i386/i386.exp.
i386-go32  +ERROR: couldn't open "tmpdir/go32stub": no such file or directory
i386-go32  +FAIL: ld-scripts/sane1
i386-go32  +FAIL: ld-scripts/assign-loc
i386-go32  +FAIL: ld-scripts/pr18963

This does result in some warnings in gdb which are fixed in a followup
patch.

bfd/
	* bfdio.c (bfd_read, bfd_write): Add ATTRIBUTE_WARN_UNUSED_RESULT.
	(bfd_tell, bfd_stat, bfd_seek, bfd_mmap): Likewise.
	* bfd-in2.h: Regenerate.
	* coff-rs6000.c (xcoff_write_armap_big) Don't ignore bfd_write
	return value.
	(xcoff_generate_rtinit): Likewise.  Also free data_buffer and
	string_table before returning.
	* coff64-rs6000.c (xcoff64_generate_rtinit): Likewise.
	* coff-stgo32.c (go32exe_check_format): Don't ignore bfd_seek
	return value.
	* coffcode.h (coff_apply_checksum): Don't ignore bfd_write return.
	(coff_write_object_contents <COFF_GO32>): Likewise, and bfd_malloc.
	Fix bitrotted code to look for first section with non-zero filepos.
	* elf64-ia64-vms.c (elf64_vms_write_shdrs_and_ehdr): Don't ignore
	bfd_seek or bfd_write return values.
	* pef.c (bfd_pef_scan_section): Likewise.
	(bfd_pef_read_header, bfd_pef_xlib_read_header): Likewise.
	* vms-misc.c (_bfd_vms_output_end): Likewise.  Return status.
	* vms.h (_bfd_vms_output_end): Update prototype.
	* vms-alpha.c: Pass _bfd_vms_output_end status up call chains.
	* wasm-module.c (wasm_compute_custom_section_file_position): Don't
	ignore bfd_seek or bfd_write return values.
	(wasm_compute_section_file_positions): Likewise.
	* xsym.c (bfd_sym_scan): Don't ignore bfd_seek return value.
	(bfd_sym_read_name_table): Likewise.
binutils/
	* ar.c (print_contents, extract_file): Don't ignore bfd_seek
	return value.
ld/
	* pdb.c (create_section_contrib_substream): Don't ignore bfd_seek
	return value.
	(create_section_header_stream): Likewise.
	* pe-dll.c (pe_get16, pe_get32): Add fail param to return results
	from bfd_seek and bfd_read.
	(pe_implied_import_dll): Handle these fails, and other bfd_seek
	and bfd_read return values.
2023-08-11 16:36:11 +09:30
Alan Modra
226f9f4fad Rename bfd_bread and bfd_bwrite
These were renamed from bfd_read and bfd_write back in 2001 when they
lost an unnecessary parameter.  Rename them back, and get rid of a few
casts that are only needed without prototyped functions (K&R C).
2023-08-09 08:48:09 +09:30
Alan Modra
f8c4789c7f readelf sprintf optimisation
This replaces sprintf and strcat calls with stpcpy, and makes use of
sprintf return value rather than using strlen, for get_machine_flags.

decode_NDS32_machine_flags made use of snprintf, which is arguably the
"correct" way to do things if there can be a buffer overflow.  In this
case I don't think there can be, the buffer is 1k in size which is at
least 5 times more than needed.  What's more, snprintf returns the
count of chars that would be output given no buffer limit, which means
code like
  r += snprintf (buf + r, size - r, ...);
  r += snprintf (buf + r, size - r, ...);
is just wrong.  There needs to be a check on the return value in order
to prevent buf + r being out of bounds for the second snprintf call.

BTW, if you look closely you'll see the return value of the decode
functions is unused.  I admit to getting a little carried away with
writing "out = stpcpy (out, ...):" in each of the decode functions and
didn't notice that until get_machine_flags was trimmed down to a much
smaller size.  When I did notice, I decided it's not such a bad thing.

	* readelf.c (decode_ARC_machine_flags, decode_ARM_machine_flags),
	(decode_AVR_machine_flags, decode_NDS32_machine_flags),
	(decode_AMDGPU_machine_flags): Use stpcpy and sprintf return
	value.  Return end of string.
	(decode_BLACKFIN_machine_flags, decode_FRV_machine_flags),
	(decode_IA64_machine_flags, decode_LOONGARCH_machine_flags),
	(decode_M68K_machine_flags, decode_MeP_machine_flags),
	(decode_MIPS_machine_flags, decode_MSP430_machine_flags),
	(decode_PARISC_machine_flags, decode_RISCV_machine_flags),
	(decode_RL78_machine_flags, decode_RX_machine_flags),
	(decode_SH_machine_flags, decode_SPARC_machine_flags),
	(decode_V800_machine_flags, decode_V850_machine_flags),
	(decode_Z80_machine_flags): New functions, split out from..
	(get_machine_flags): ..here.  Similarly use stpcpy.
2023-08-03 21:20:33 +09:30
Alan Modra
ad923ded82 binutils sprintf optimisation
Avoid the use of sprintf with a "%s" format string, replacing with
strcpy or stpcpy.  Use sprintf return value rather than a later
strlen.  Don't use strcat where we can keep track of the end of a
string output buffer.

	* dlltool.c (look_for_prog): memcpy prefix and strcpy prog_name.
	* dllwrap.c (look_for_prog): Likewise.
	* resrc.c (look_for_default): Likewise.  Add quotes with memmove
	rather than allocating another buffer.
	* size.c (size_number): Use sprintf return value.
	* stabs.c (parse_stab_argtypes): Likewise.
	* windmc.c (write_bin): Likewes, and use stpcpy.
	* wrstabs.c: Similarly throughout.
2023-08-03 21:20:33 +09:30
Alan Modra
137f6bc0da resrc: sprintf sanitizer null destination pointer
* resrc.c (read_rc_file): Use stpcpy rather than sprintf
	followed by strlen.  Tidy.
2023-08-03 21:19:54 +09:30
Alan Modra
e2e7c52613 dlltool: sprintf sanitizer null destination pointer
* dlltool.c (gen_lib_file): Avoid bogus sanitizer error.
2023-08-03 21:19:54 +09:30
Alan Modra
d191eacb7b wrstabs: sprintf sanitizer null destination pointer
gcc-2.12 seems to be ignoring __attribute__((__returns_nonnull__))
on xmalloc.

	* wrstabs.c (stab_method_type): Use stpcpy rather than sprintf
	or strcat.
2023-08-03 21:19:54 +09:30
Alan Modra
760fb390fd objdump, nm: sprintf sanitizer null destination pointer
Seen on Ubuntu 23.04 x86_64-linux using gcc-12.2 and gcc-12.3 with
CFLAGS="-m32 -g -O2 -fsanitize=address,undefined".

  CC       objdump.o
In file included from /usr/include/stdio.h:906,
                 from /home/alan/src/binutils-gdb/binutils/sysdep.h:24,
                 from /home/alan/src/binutils-gdb/binutils/objdump.c:51:
In function 'sprintf',
    inlined from 'display_utf8' at /home/alan/src/binutils-gdb/binutils/objdump.c:621:14,
    inlined from 'sanitize_string.part.0' at /home/alan/src/binutils-gdb/binutils/objdump.c:742:11:
/usr/include/bits/stdio2.h:30:10: error: null destination pointer [-Werror=format-overflow=]
   30 |   return __builtin___sprintf_chk (__s, __USE_FORTIFY_LEVEL - 1,
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   31 |                                   __glibc_objsize (__s), __fmt,
      |                                   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   32 |                                   __va_arg_pack ());
      |                                   ~~~~~~~~~~~~~~~~~
cc1: all warnings being treated as errors

The warning is bogus of course.  xmalloc is guaranteed to return
non-NULL, but apparently this isn't seen in display_utf6.  The same
doesn't happen with -m64, maybe due to inlining differences, I haven't
investigated fully.  Easily avoided as we hardly need to use sprintf
for a single char, or a two char string.

	* objdump.c (display_utf8): Avoid bogus sprintf sanitizer warning.
	Use hex ESC to switch back to default colour.
	(sanitize_string): Comment.  Bump buffer size by one.  Fix overlong
	line.
	* nm.c (display_utf8, sanitize_string): As above.
2023-08-03 21:19:04 +09:30
Sam James
b5c37946cc Revert "2.41 Release sources"
This reverts commit 675b9d612c.

See https://sourceware.org/pipermail/binutils/2023-August/128761.html.
2023-08-02 12:06:23 +01:00
Nick Clifton
675b9d612c 2.41 Release sources 2023-08-02 09:23:36 +01:00
Alan Modra
b6456e91d4 Don't declare xmalloc or xrealloc in bucomm.h
It's better to include the proper header, which has declarations with
various attributes.  Commit 096aefc040 in 1994 introduced this wart.

	* bucomm.h (xmalloc, xrealloc): Delete declaration.
	* od-macho.c: Include libiberty.h.
	* od-xcoff.c: Include libiberty.h.
2023-08-02 07:53:26 +09:30
Nick Clifton
b99a969343 Fix "--only-keep-debug for ELF relocatables" binutils test for compilers which add .debug_macro sections to object files.
PR 30699
  * binutils/testsuite/binutils-all/objcopy.exp (keep_debug_symbols_for_elf_relocatable): Do not add sections containing the string "debug_" to the list of non-debug sections.
2023-08-01 14:40:08 +01:00
Nick Clifton
0251080cb8 Add note to check that all changes have been pushed before creating the source tarballs 2023-08-01 10:41:58 +01:00
Jose E. Marchesi
1e18ffc991 bpf: include, bfd, opcodes: add EF_BPF_CPUVER ELF header flags
This patch adds support for EF_BPF_CPUVER bits in the ELF
machine-dependent header flags.  These bits encode the BPF CPU
version for which the object file has been compiled for.

The BPF assembler is updated so it annotates the object files it
generates with these bits.

The BPF disassembler is updated so it honors EF_BPF_CPUVER to use the
appropriate ISA version if the user didn't specify an explicit ISA
version in the command line.  Note that a value of zero in
EF_BPF_CPUVER is interpreted by the disassembler as "use the later
supported version" (the BPF CPU versions start with v1.)

The readelf utility is updated to pretty print EF_BPF_CPUVER when it
prints out the ELF header:

   $ readelf -h a.out
   ELF Header:
     ...
     Flags:                             0x4, CPU Version: 4

Tested in bpf-unknown-none.

include/ChangeLog:

2023-07-30  Jose E. Marchesi  <jose.marchesi@oracle.com>

	* elf/bpf.h (EF_BPF_CPUVER): Define.
	* opcode/bpf.h (BPF_XBPF): Change from 0xf to 0xff so it fits in
	EF_BPF_CPUVER.

binutils/ChangeLog:

2023-07-30  Jose E. Marchesi  <jose.marchesi@oracle.com>

	* readelf.c (get_machine_flags): Recognize and pretty print BPF
	machine flags.

opcodes/ChangeLog:

2023-07-30  Jose E. Marchesi  <jose.marchesi@oracle.com>

	* bpf-dis.c: Initialize asm_bpf_version to -1.
	(print_insn_bpf): Set BPF ISA version from the cpu version ELF
	header flags if no explicit version set in the command line.
	* disassemble.c (disassemble_init_for_target): Remove unused code.

gas/ChangeLog:

2023-07-30  Jose E. Marchesi  <jose.marchesi@oracle.com>

	* config/tc-bpf.h (elf_tc_final_processing): Define.
	* config/tc-bpf.c (bpf_elf_final_processing): New function.
2023-07-30 22:39:30 +02:00
Nick Clifton
82be476a08 Update how to make a release document after the 2.41 release 2023-07-30 16:07:09 +01:00
YunQiang Su
29c108c961 MIPS: Support `-gnuabi64' target triplet suffix for 64-bit Linux targets
Make the n64 ABI the default for 64-bit Linux targets specified with
`-gnuabi64' suffix included in the target triplet, for configurations
such as the Debian mips64el and mips64r6el ports.  Adjust testsuite
configuration accordingly.

There are the following regressions with the new target triplet:

mips64-linux-gnuabi64  +FAIL: readelf -S bintest
mips64-linux-gnuabi64  +FAIL: MIPS reloc estimation 1
mips64el-linux-gnuabi64  +FAIL: readelf -S bintest
mips64el-linux-gnuabi64  +FAIL: MIPS reloc estimation 1

The `readelf' issue comes from a difference in section headers produced
that the `binutils/testsuite/binutils-all/readelf.s-64' pattern template
does not match.  While there has been a precedent it does not appear to
me that there is a clear advantage from adding more and more variations
to the template rather than forking the existing template into multiple
ones for a more exact match.  So this is best deferred to a separate
discussion.

The MIPS reloc estimation issue is an actual bug in `objdump', which
discards a number of trailing entries from output here for n64 composed
relocations:

DYNAMIC RELOCATION RECORDS
OFFSET           TYPE              VALUE
0000000000000000 R_MIPS_NONE       *ABS*
0000000000000000 R_MIPS_NONE       *ABS*

and consequently `ld/testsuite/ld-mips-elf/reloc-estimate-1.d' does not
match even though ELF output produced is correct according to `readelf':

Relocation section '.rel.dyn' at offset 0x10400 contains 2 entries:
  Offset          Info           Type           Sym. Value    Sym. Name
000000000000  000000000000 R_MIPS_NONE
                    Type2: R_MIPS_NONE
                    Type3: R_MIPS_NONE
000000010000  000300001203 R_MIPS_REL32      0000000000010010 foo@@V2
                    Type2: R_MIPS_64
                    Type3: R_MIPS_NONE

As a genuine bug this has to be handled separately.

Co-Authored by: Maciej W. Rozycki <macro@orcam.me.uk>

	bfd/
	* config.bfd: Add `mips64*el-*-linux*-gnuabi64' and
	`mips64*-*-linux*-gnuabi64' targets.

	binutils/
	* testsuite/binutils-all/mips/mips.exp: Handle `*-*-*-gnuabi64'
	targets.
	* testsuite/binutils-all/objcopy.exp: Handle
	`mips64*-*-*-gnuabi64' targets.
	* testsuite/binutils-all/remove-relocs-01.d: Likewise.
	* testsuite/binutils-all/remove-relocs-04.d: Likewise.
	* testsuite/binutils-all/remove-relocs-05.d: Likewise.
	* testsuite/binutils-all/remove-relocs-06.d: Likewise.

	gas/
	* configure.ac: Handle `mips64*-linux-gnuabi64' targets.
	* configure: Regenerate.
	* testsuite/gas/mips/compact-eh-eb-7.d: Handle
	`mips64*-*-*-gnuabi64' targets.
	* testsuite/gas/mips/compact-eh-el-7.d: Likewise.

	ld/
	* configure.tgt: Add `mips64*el-*-linux-gnuabi64' and
	`mips64*-*-linux-gnuabi64' targets.
	* testsuite/ld-undefined/undefined.exp: Handle
	`mips64*-*-*-gnuabi64' targets.
	* testsuite/ld-mips-elf/attr-gnu-4-10.d: Likewise.
	* testsuite/ld-mips-elf/compact-eh6.d: Likewise.
	* testsuite/ld-mips-elf/mips-elf.exp: Handle `*-*-*-gnuabi64'
	targets.
2023-07-28 06:00:37 +01:00
YunQiang Su
ed4dca900c testsuite: Handle composed R_MIPS_NONE relocations
MIPS n64 ABI has a peculiarity where all relocations are composed of
three, with subsequent relocation types set to R_MIPS_NONE if further
calculation is not required.  Example output produced by `readelf' and
`objdump' for such relocations is:

  Offset          Info           Type           Sym. Value    Sym. Name + Addend
000000000000  000800000002 R_MIPS_32         0000000000000000 foo + 0
                    Type2: R_MIPS_NONE
                    Type3: R_MIPS_NONE

and:

OFFSET           TYPE              VALUE
0000000000000000 R_MIPS_32         foo
0000000000000000 R_MIPS_NONE       *ABS*
0000000000000000 R_MIPS_NONE       *ABS*

respectively.  The presence of these extra R_MIPS_NONE entries is not
relevant for generic or even some MIPS tests, so optionally match them
with the respective dump patterns, also discarding `xfail' annotation
for MIPS/OpenBSD targets from gas/elf/missing-build-notes.d, removing
these regressions:

mips64-openbsd  -FAIL: readelf -r bintest
mips64-openbsd  -FAIL: forward expression
mips64-openbsd  -FAIL: assignment tests
mips64-openbsd  -FAIL: gas/all/none
mips64-openbsd  -XFAIL: gas/elf/missing-build-notes
mips64-openbsd  -FAIL: macro test 2
mips64-openbsd  -FAIL: macro irp
mips64-openbsd  -FAIL: macro rept
mips64-openbsd  -FAIL: nested irp/irpc/rept
mips64-openbsd  -FAIL: macro vararg
mips64-openbsd  -FAIL: mips jalx
mips64-openbsd  -FAIL: ST Microelectronics Loongson-2F workarounds of Jump Instruction issue
mips64el-openbsd  -FAIL: readelf -r bintest
mips64el-openbsd  -FAIL: forward expression
mips64el-openbsd  -FAIL: assignment tests
mips64el-openbsd  -FAIL: gas/all/none
mips64el-openbsd  -XFAIL: gas/elf/missing-build-notes
mips64el-openbsd  -FAIL: macro test 2
mips64el-openbsd  -FAIL: macro irp
mips64el-openbsd  -FAIL: macro rept
mips64el-openbsd  -FAIL: nested irp/irpc/rept
mips64el-openbsd  -FAIL: macro vararg
mips64el-openbsd  -FAIL: mips jalx
mips64el-openbsd  -FAIL: ST Microelectronics Loongson-2F workarounds of Jump Instruction issue

Co-Authored-By: Maciej W. Rozycki <macro@orcam.me.uk>

	binutils/
	* testsuite/binutils-all/readelf.r-64: Optionally match extra
	R_MIPS_NONE pairs.

	gas/
	* testsuite/gas/all/assign.d: Optionally match extra
	R_MIPS_NONE pairs.
	* testsuite/gas/all/fwdexp.d: Likewise.
	* testsuite/gas/all/none.d: Likewise.
	* testsuite/gas/macros/irp.d: Likewise.
	* testsuite/gas/macros/repeat.d: Likewise.
	* testsuite/gas/macros/rept.d: Likewise.
	* testsuite/gas/macros/test2.d: Likewise.
	* testsuite/gas/macros/vararg.d: Likewise.
	* testsuite/gas/mips/compact-eh-eb-1.d: Likewise.
	* testsuite/gas/mips/compact-eh-eb-2.d: Likewise.
	* testsuite/gas/mips/compact-eh-eb-3.d: Likewise.
	* testsuite/gas/mips/compact-eh-eb-4.d: Likewise.
	* testsuite/gas/mips/compact-eh-eb-5.d: Likewise.
	* testsuite/gas/mips/compact-eh-eb-6.d: Likewise.
	* testsuite/gas/mips/compact-eh-el-1.d: Likewise.
	* testsuite/gas/mips/compact-eh-el-2.d: Likewise.
	* testsuite/gas/mips/compact-eh-el-3.d: Likewise.
	* testsuite/gas/mips/compact-eh-el-4.d: Likewise.
	* testsuite/gas/mips/compact-eh-el-5.d: Likewise.
	* testsuite/gas/mips/compact-eh-el-6.d: Likewise.
	* testsuite/gas/mips/loongson-2f-3.d: Likewise.
	* testsuite/gas/mips/mips-jalx.d: Likewise.
	* testsuite/gas/elf/missing-build-notes.d: Likewise.  Remove
	the `xfail' tag.

	ld/
	* testsuite/ld-mips-elf/reloc-estimate-1.d: Optionally match
	extra R_MIPS_NONE pairs.
2023-07-28 06:00:36 +01:00
YunQiang Su
60ec8306db testsuite: Also discard the `.MIPS.options' section
Also discard the `.MIPS.options' section, used with n64 MIPS binaries,
along with similar other MIPS sections (`.reginfo', `.MIPS.abiflags')
not relevant for the test cases concerned, fixing these regressions:

mips64-openbsd  -FAIL: ld-elf/group3a
mips64-openbsd  -FAIL: ld-elf/group3b
mips64-openbsd  -FAIL: Place orphan sections (map file check)
mips64-openbsd  -FAIL: ld-elf/orphan-region
mips64-openbsd  -FAIL: ld-elf/orphan
mips64-openbsd  -FAIL: overlay size (map file check)
mips64-openbsd  -FAIL: overlay size
mips64el-openbsd  -FAIL: ld-elf/group3a
mips64el-openbsd  -FAIL: ld-elf/group3b
mips64el-openbsd  -FAIL: Place orphan sections (map file check)
mips64el-openbsd  -FAIL: ld-elf/orphan-region
mips64el-openbsd  -FAIL: ld-elf/orphan
mips64el-openbsd  -FAIL: overlay size (map file check)
mips64el-openbsd  -FAIL: overlay size

Co-Authored-By: Maciej W. Rozycki <macro@orcam.me.uk>

	binutils/
	* testsuite/binutils-all/strip-3.d: Add `-R .MIPS.options' to
	the `strip' tag.

	ld/
	* testsuite/ld-elf/group.ld: Also discard `.MIPS.options'.
	* testsuite/ld-elf/orphan-region.ld: Likewise.
	* testsuite/ld-elf/orphan.ld: Likewise.
	* testsuite/ld-mips-elf/got-page-1.ld: Likewise.
	* testsuite/ld-scripts/overlay-size.t: Likewise.
2023-07-28 06:00:36 +01:00
Maciej W. Rozycki
cc66ad2d2a Revert "MIPS: support mips*64 as CPU and gnuabi64 as ABI"
This reverts commit 32f1c80375.  It had
two unrelated changes lumped together, one of which changed the meaning
of the `mipsisa64*-*-linux*' target triplets, which was not properly
evaluated.
2023-07-28 06:00:36 +01:00
Alan Modra
41c8b9f097 coff/pe/xcoff and --extract-symbols
This fixes failure of the "extract symbols" test for rs6000, where
--extract-symbols generates a non-zero sized .text.  By the look of
coffcode.h the same problem might occur for coff/pe too, but doesn't
happen to trigger a test failure.

bfd/
	* coffcode.h (coff_compute_section_file_positions): Don't
	adjust size of !SEC_LOAD sections.
binutils/
	* objcopy.c (setup_section): Clear SEC_LOAD for --extract-symbol.
2023-07-28 14:11:27 +09:30
Johannes Schauer Marin Rodrigues
6badd1020f objcopy embeds the current time and ignores SOURCE_DATE_EPOCH making the output unreproducible.
bfd
  * peXXigen.c (_bfd_XXi_only_swap_filehdr_out): If inserting a timestamp, use the value held in the SOURCE_DATE_EPOCH environment variable, if it is defined.
binutils
  * doc/binutils.texi (objcopy): Document change in behaviour of objcopy's --preserve-dates command line option.
ld
  * pe-dll.c (fill_edata): If inserting a timestamp, use the value held in the SOURCE_DATE_EPOCH environment variable, if it is defined.
  * ld.texi (--insert-timestamp): Document change in behaviour.
2023-07-24 16:59:19 +01:00
Alan Modra
b7bf7f1b8f Tidy binutils configure
Separate out some of the defines from the block handling windows
support, so they don't get lost.  Delete an unused variable.
2023-07-19 11:06:22 +09:30
Alan Modra
eb84343a1d Build all the objdump extensions with --enable-targets=all
Only the xcoff and pe extensions were enabled.  Build the lot, and fix
some more printf format problems when the host is 32-bit.

	* configure.ac (od_vectors): Set up for --enable-targets=all.
	* configure: Regenerate.
	* od-elf32_avr.c (elf32_avr_dump_mem_usage): Correct format
	specifier vs. arg mismatch.
	(elf32_avr_dump_avr_prop): Likewise.
2023-07-19 10:46:59 +09:30
Nick Clifton
fdc60e8cf6 Updated Swedish translation for the binutils subdirectory 2023-07-18 17:12:25 +01:00
Alan Modra
6d872a1a80 More tidies to objcopy archive handling
This makes sure copy_archive exits with ibfd and obfd closed.  Error
paths didn't do that, leading to memory leaks.  None of this matters
very much.

	* objcopy.c (copy_archive): bfd_close ibfd and obfd on error
	return paths.  Remove braces around "list" free.
	(copy_file): Don't close invalid file descriptor.
2023-07-14 11:53:48 +09:30
Alan Modra
1052fb3ecb Re: Keeping track of rs6000-coff archive element pointers
bfd/
	* coff-rs6000.c (add_range): Revise comment, noting possible fail.
	(_bfd_xcoff_openr_next_archived_file): Start with clean ranges.
binutils/
	* bfdtest1.c: Enhance to catch errors on second scan.
2023-07-12 09:31:40 +09:30