Commit Graph

4681 Commits

Author SHA1 Message Date
Nick Clifton
4d1636909d
Remove Debian from SECURITY.txt 2024-11-20 12:59:35 +00:00
Jan Beulich
d5cbf916be gas/ELF: also reject merge entity size being zero
This won't have any useful effect, so is at best marginally less bogus
than a negative value.

The change actually points out a flawed (for Arm) testcase: @ is a
comment character there.
2024-11-18 11:35:57 +01:00
Sam James
eeff15bc88
binutils: fix -std=gnu23 compatibility wrt _Bool
GCC trunk now defaults to -std=gnu23. We return false in a few places
which can't work when true/false are a proper type (_Bool). Return NULL
where appropriate instead of false. All callers handle this appropriately.

ChangeLog:
	PR ld/32372

	* prdbg.c (visibility_name): Return NULL.
2024-11-18 03:09:15 +00:00
Nelson Chu
004a5bfc72 RISC-V: Dump instruction without checking architecture support as usual.
Since QEMU have supported -Max option to to enable all normal extensions,
the dis-assembler should also add an option, -M,max to do the same thing.
For the instruction, which have overlapped encodings like zfinx, will not
be considered by the -M,max option.

opcodes/
	* riscv-dis.c (all_ext): New static boolean.  If set, disassemble
	without checking architectire string.
	(riscv_disassemble_insn): Likewise.
	(parse_riscv_dis_option_without_args): Recognized -M,max option.
binutils/
	* NEWS: Updated.
2024-10-31 11:28:45 +08:00
Alan Modra
86b26b453f Replace uses of asprintf with xasprintf
xasprintf has a nicer interface and behaves like xmalloc as far as
memory is concerned, ie. no need to check a return status and the
program exits with an error on OOM.

binutils/
	* dwarf.c (load_debug_sup_file): Replace asprintf with xasprintf.
	* nm.c (get_elf_symbol_type, get_coff_symbol_type): Likewise.
	* objdump.c (dump_ctf_indent_lines): Likewise.
	* readelf.c (display_lto_symtab, dump_ctf_indent_lines): Likewise.
	* windres.c (main): Likewise.
	* configure.ac: Remove asprintf from AC_CHECK_DECLS.
	* config.in: Regenerate.
	* configure: Regenerate.
gas/
	* config/tc-kvx.c (kvx_emit_single_noop): Simplify.
	* config/tc-riscv.c (md_assemblef): Replace asprintf with xasprintf.
	* read.c (s_nop, do_s_func): Likewise.
	* stabs.c (stabs_generate_asm_func): Likewise.
	(stabs_generate_asm_endfunc): Likewise.
	* configure.ac: Remove asprintf from AC_CHECK_DECLS.
	* config.in: Regenerate.
	* configure: Regenerate.
ld/
	* ldlang.c (lang_leave_overlay_section): Replace xmalloc+sprintf
	with xasprintf.  Localise vars.
	* lexsup.c (parse_args): Replace asprintf with xasprintf.
	* pe-dll.c (make_head, make_tail, make_one): Likewise.
	(make_singleton_name_thunk, make_import_fixup_entry): Likewise.
	(make_runtime_pseudo_reloc): Likewise.
	(pe_create_runtime_relocator_reference): Likewise.
	* configure.ac: Remove asprintf from AC_CHECK_DECLS.
	* config.in: Regenerate.
	* configure: Regenerate.
2024-10-24 17:58:00 +10:30
Alan Modra
bc85bc665a Add noxfail option to run_dump_test
The noxfail option is useful in situations like pr23658-1e which
fails on all microblaze ELF targets except microblaze-linux.  This was
possible to handle by writing a small proc and use that as an xfail
predicate, or painstakingly listing all microblaze ELF targets, but
this is simpler.  The patch also fixes some other FAILs and XPASSes of
the pr23658 tests.

binutils/
	* testsuite/lib/binutils-common.exp (run_dump_test): Support
	noxfail.
ld/
	* testsuite/ld-elf/pr23658-1a.d: Don't xfail m68hc12.
	* testsuite/ld-elf/pr23658-1e.d: Likewise.  xfail xstormy16
	and correct microblaze xfails.
2024-10-16 14:54:00 +10:30
Jan Beulich
1f1b5e506b bfd/ELF: restrict file alignment for object files
While for executables properly aligning sections within the file can be
quite relevant, the same is of pretty little importance for relocatable
object files. Avoid passing "true" into
_bfd_elf_assign_file_position_for_section() when dealing with object
files, but compensate minimally by applying log_file_align in such
cases as a cap to the alignment put in place.
2024-10-11 08:19:34 +02:00
Alan Modra
967dc35c78 PR32243, NAME_MAX does not exist on mingw-w64 without _POSIX_
PR 32243
	* dlltool.c: Move forward decls.  Delete unnecessary ones.
	(bfd_errmsg): Delete macro, define as inline function.
	(PATHMAX): Delete.
	(NAME_MAX): Define.
2024-10-09 12:00:11 +10:30
Alan Modra
124deb3101 Revised "Don't return (null) from bfd_elf_sym_name"
Commit 68bbe11833 results in a lot of follow up work, much of which
likely is still to be done. (And yes, since this is all for corrupted
or fuzzed object files, a whole lot of work doesn't much benefit
anyone.  It was a bad idea to put NULL in asymbol->name.)  So I'm
changing the approach to instead put a unique empty string for symbols
with a corrupted st_name.  An empty string won't require much work to
ensure nm, objcopy, objdump etc. won't crash, since these tools
already must work with unnamed local symbols.

The unique empty string is called bfd_symbol_error_name.  This patch
uses that name string for corrupted symbols in the ELF and COFF
backends.  Such symbols are displayed by nm and objdump as the
translated string "<corrupt>", which is what the COFF backend used to
put directly into corrupted symbols.

ie. it's the way I should have written the original patch, plus a few
tides and cleanups I retained from the reverted patches.
2024-10-08 15:12:19 +10:30
Alan Modra
b0623fda9f Revert "dlltool fixes for commit 68bbe1183379"
This reverts commit 06116013f8.
2024-10-08 15:12:14 +10:30
Alan Modra
22ad34b314 Revert "objcopy fixes for commit 68bbe1183379"
This reverts commit ef166f451f.
2024-10-08 15:12:14 +10:30
Alan Modra
ef166f451f objcopy fixes for commit 68bbe11833
* objcopy.c (is_specified_symbol): Handle NULL name.
	(filter_symbols): Drop syms with a NULL name.
2024-10-05 10:58:37 +09:30
Alan Modra
06116013f8 dlltool fixes for commit 68bbe11833
For some reason, dlltool supports mcore-elf input files.

	* dlltool.c (filter_symbols): Drop symbols with NULL names.
	(identify_member_contains_symname): Don't consider symbols
	with NULL names.
2024-10-04 22:07:22 +09:30
Jan Beulich
af16469a90 MAINTAINERS: move M R Swami Reddy to Past Maintainers
He/she cannot be reached at the given address anymore, and the name is
apparently too common to identify the person to attempt to establish
another contact. Sadly this orphans the CR16 and CRx ports.
2024-10-04 09:34:11 +02:00
Jan Beulich
4b59d30c84 MAINTAINERS: move Matt Thomas to Past Maintainers
Matt cannot be reached at the @netbsd.org address anymore, and I was
unable to find another one, even with the help of the NetBSD community
(where his resigning was announced over 4 years ago [1]).

[1] http://mail-index.netbsd.org/netbsd-announce/2020/05/07/msg000314.html
2024-10-04 09:33:49 +02:00
Alan Modra
c6bf8c475a Enable dlltool --leading-underscore for targets other than x86
This also makes the dlltool tests run more PE targets, finding that
sh-pe dlltool reports "Machine 'sh' not supported".  I guess no one
cares about that.

	PR19459
	* dlltool.c (asm_prefix): Remove "mach" parameter.  Return
	leading_underscore independent of machine.
	(ASM_PREFIX): Adjust.
	* testsuite/binutils-all/dlltool.exp: Run on any target
	satisfying is_pecoff_format for which dlltool is built.
	Revert commit 0398b8d6c8.  Remove target_xfail.
2024-10-03 12:31:46 +09:30
Alan Modra
45a7f5a29d dlltool leading_underscore
This patch tidies dlltool code dealing with adding a leading
underscore to generated symbol names.  There should be no functional
change here, but there could be if we ever have a bfd target with
symbol_leading_char something other than '_' or 0.

	* dlltool.c (leading_underscore): Change from an int to a
        char*.  Update all uses.  If neither --leading-underscore or
        --no=leading-underscore is given, set leading_underscore to a
        string with first char returned by bfd_get_target_info as the
        target's symbol underscoring.
2024-10-03 12:31:45 +09:30
Alan Modra
d2ea1a9411 nm: don't try to print line numbers for symbols without names
It doesn't make much sense trying to print line numbers for what are
usually broken symbols, and there is a possibility of a segfault if
we pass strcmp a NULL.
2024-10-03 12:31:45 +09:30
Alan Modra
d0285cdf58 Re: dlltool: file name too long
Allow for "snnnnn.o" suffix when testing against NAME_MAX, and tidy
TMP_STUB handling by overwriting a prior nnnnn.o string rather than
copying the entire name.

	* dlltool.c (TMP_STUB): Add "nnnnn.o" to format.
	(make_one_lib_file): Localise variables.  Don't copy TMP_STUB,
	overwrite suffix instead.
	(gen_lib_file): Similarly.
	(main): Allow for max suffix when testing against NAME_MAX.
2024-10-01 08:35:49 +09:30
Alan Modra
f6abafcd91 Move uses_elf_em to ld-lib.exp
and add a missing entry from uses_genelf.

binutils/
	* testsuite/lib/binutils-common.exp (uses_elf_em): Delete.
ld/
	* testsuite/lib/ld-lib.exp (uses_genelf): Add moxie-*-moxiebox.
	(uses_elf_em): New.
2024-09-28 15:45:50 +09:30
Frank Ch. Eigler
3babc2e220 binutils testsuite: canonicalize subtest names in debuginfod.exp
Previous code included the full $srcdir pathnames in the individual
subtest PASS/FAIL names, which makes it difficult to compute
comparisons or regressions between test runs on different machines.
This version switches to the basename only, which are common.

Signed-off-by: Frank Ch. Eigler <fche@redhat.com>
2024-09-24 21:50:41 -04:00
Alan Modra
f2a15e7cde get_type_abbrev_from_form tidy
* dwarf.c (get_type_abbrev_from_form): Make uvalue param a
	uint64_t.  Localise variables.  Don't bother clearing *data_return
	and *addrev_num_return for a NULL return value.
2024-08-29 21:05:57 +09:30
Jiaying Song
a253bea899 dlltool: file name too long
During the execution of the command: i686-w64-mingw32-dlltool
--input-def $def_filepath --output-delaylib $filepath --dllname qemu.exe
An error occurred:
i686-w64-mingw32-dlltool: failed to open temporary head file: ..._w64_mingw32_nativesdk_qemu_8_2_2_build_plugins_libqemu_plugin_api_a_h.s

Due to the path length exceeding the Linux system's file name length
limit (NAME_MAX=255), the temporary file name generated by the
i686-w64-mingw32-dlltool command becomes too long to open. To address
this, a new temporary file name prefix is generated using tmp_prefix =
prefix_encode ("d", getpid()), ensuring that the file name does not
exceed the system's length limit.

Signed-off-by: Jiaying Song <jiaying.song.cn@windriver.com>
Reviewed-by: Alan Modra <amodra@gmail.com>
2024-08-28 22:29:40 +09:30
Alan Modra
57a3845126 dlltool.c formatting
Mostly whitespace fixes, some removal of excess parens.
2024-08-28 22:19:38 +09:30
Nick Clifton
73fbc50f4b Remove Walter Lee as maintainer for Tile Gx and Tile Pro 2024-08-19 16:34:29 +01:00
Nick Clifton
baeb0a958c Update release readme after making 2.43.1 release 2024-08-17 19:14:44 +01:00
Alan Modra
cfe96ff03a PR32072 dlltool.c initializer-string is too long
PR 32072
	* dlltool.c: Delete unneeded forward function declaraions.
	Make buffers used by dlltmp static.
	(prefix_encode): Avoid warning.  Use stpcpy.
2024-08-13 12:50:17 +09:30
Nick Clifton
b59d8eafd8 Update release-README after completing the 2.43 release. 2024-08-04 17:47:49 +01:00
Nick Clifton
05d193cacd Updated Bulgarian translation for the binutils/ directory 2024-08-02 15:40:14 +01:00
Aapo Rantalainen
f938391534 Fix typo in --help output of the strings program.
PR 31940
2024-08-02 15:14:27 +01:00
Alan Modra
479c611636 skip_attr_bytes assertion (data) <= (end) fail
get_type_abbrev_from_form is lax in not limiting data for a uleb to
the current CU, because DW_FORM_ref_addr allows access to other CU's
data.  This can lead to an assertion fail when skipping or reading
attributes in get_type_signedness.

	* dwarf.c (get_type_abbrev_from_form): Limit uleb data to map end
	for ref_addr, cu_end otherwise.
2024-08-01 21:52:34 +09:30
Nick Clifton
8896efce13 Updated translations for the bfd, binutils, gas, ld and opcodes directories 2024-07-29 11:57:25 +01:00
Pali Rohár
fb2a924990 PR 31728 testcases 2024-07-29 20:01:06 +09:30
YunQiang Su
08e6af1bac microMIPS: Add MT ASE instruction set support
Add the MT ASE instruction operand types and encodings to the microMIPS
opcode table and enable the assembly of these instructions in GAS from
MIPSr2 onwards.  Update the binutils and GAS testsuites accordingly.

References:

"MIPS Architecture for Programmers, Volume IV-f: The MIPS MT Module for
the microMIPS32 Architecture", MIPS Technologies, Inc., Document Number:
MD00768, Revision 1.12, July 16, 2013

Co-Authored-By: Maciej W. Rozycki <macro@redhat.com>
2024-07-26 18:01:09 +01:00
Nick Clifton
ad43ae7635 Fix "Untranslated plural in readelf.c"
PR 32002
2024-07-26 16:42:03 +01:00
Pali Roh?r
91b999864f Improve objdump's display of PE header information.
PR 31953
2024-07-23 08:52:21 +01:00
H.J. Lu
e1b9d58e85 Correct version for binutils 2.43 NEWS entries.
Change 2.42 to 2.43 for binutils 2.43 NEWS entries.

binutils/

	* NEWS: Change 2.42 to 2.43 for 2.43 NEWS entries.

ld/

	* NEWS: Change 2.42 to 2.43 for 2.43 NEWS entries.

Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
2024-07-20 13:52:50 -07:00
Nick Clifton
9f26b04c3e Update after creating 2.43 branch 2024-07-20 13:46:23 +01:00
Nick Clifton
cff16e125a Change version to 2.43.50 2024-07-20 13:16:33 +01:00
Nick Clifton
b33c4f8f82 Add markers for 2.43 branch/release 2024-07-20 12:43:19 +01:00
Alan Modra
237c05a65f Re: binutils: Add a test for strip with build notes
The new test wasn't being run, and failed due to relocations against
.gnu.build.attributes being stripped by default strip behaviour.
We probably should be keeping these relocations, but I haven't made
that change here.
BTW, the new test fails on ia64-hpux but that's just a repeat of the
existing note-5 fail.

	PR 31999
	* testsuite/binutils-all/strip-16.d: strip with --strip-unneeded
	and --merge-notes.
	* testsuite/binutils-all/objcopy.exp: Run the new test.  Sort
	other strip tests.
2024-07-20 13:54:00 +09:30
H.J. Lu
3f55acd0ec binutils: Add a test for strip with build notes
Add a test for strip with build notes.

	PR binutils/31999
	* testsuite/binutils-all/strip-16.d: New.

Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
2024-07-19 18:59:53 -07:00
Alan Modra
964be70df7 PR31999 strip [.gnu.build.attributes]: failed
PR 31999
	* objcopy.c (merge_gnu_build_notes): Always set *new_size.
2024-07-20 10:11:25 +09:30
Maciej W. Rozycki
0ffc724699 MIPS/opcodes: Mark MT thread context move assembly idioms as aliases
A number of instructions in the regular MIPS opcode table are assembly
idioms for the MT thread context move MFTR and MTTR instructions, so
mark them as aliases accordingly.  Add suitable test cases, which also
cover the PAUSE assembly idiom.
2024-07-19 19:01:53 +01:00
Vladimir Mezentsev
f769dcdb01 gprofng: add release notes for 2.43
ChangeLog
2024-07-10  Vladimir Mezentsev  <vladimir.mezentsev@oracle.com>.

	* binutils/NEWS (gprofng): Add release notes for 2.43
2024-07-11 21:27:10 -07:00
Alan Modra
66e545391e Re: LoongArch: Add DT_RELR support
Fix commit d89ecf33ab testsuite breakage.

	* testsuite/lib/binutils-common.exp (supports_dt_relr): Correct.
2024-07-06 18:22:06 +09:30
Alan Modra
428c21e99a objcopy bfd_map_over_sections and global status
This patch started life as a relatively simple change to fix some
unimportant objcopy memory leaks, but expanded into a larger patch
when I was annoyed by the awkwardness of passing data when using
bfd_map_over_sections.  A simple loop over sections is much more
convenient, and we really don't need the abstraction layer.  Sections
in a list isn't going to disappear any time soon.

The patch also removes use of the global "status" variable by all but
the top-level functions called from main.

	* objcopy.c (filter_symbols): Return success as a bool.  Pass
	symcount as a pointer, updated on return.
	(merge_gnu_build_notes): Similarly return a bool and add newsize
	param with updated smaller section size.
	(setup_bfd_headers): Return bool success rather than setting
	"status" on failure.
	(setup_section): Likewise.
	(copy_relocations_in_section, copy_section): Likewise, and adjust
	params.
	(mark_symbols_used_in_relocations): Likewise, and free memory
	on failure path.  Don't call bfd_fatal.
	(get_sections): Delete function.
	(copy_object): Don't use bfd_map_over_sections, instead use a
	loop allowing easy detection of failure status.  Free memory on
	error paths.
	(copy_archive): Return bool success rather than setting "status"
	on failure.
	(copy_file): Set "status" here.
	* testsuite/binutils-all/strip-13.d: Adjust to suit.
2024-07-06 10:41:29 +09:30
Xi Ruoyao
d89ecf33ab LoongArch: Add DT_RELR support
The logic is same as a71d876801 ("aarch64: Add DT_RELR support").

As LoongArch does not have -z dynamic-undefined-weak, we don't need to
consider UNDEFWEAK_NO_DYNAMIC_RELOC.

The linker relaxation adds another layer of complexity.  When we delete
bytes in a section during relaxation, we need to fix up the offset in
the to-be-packed relative relocations against this section.

Signed-off-by: Xi Ruoyao <xry111@xry111.site>
2024-07-05 12:11:11 +08:00
Claudiu Zissulescu
7fafb57457 MAINTAINERS: Update my e-mail address
Signed-off-by: Claudiu Zissulescu <claziss@gmail.com>
2024-07-01 10:58:17 +03:00
Alan Modra
79674bfc36 PR31941 objcopy --globalize-symbol
I think FILE symbols are special, and I can't see why anyone would
want them to be made global.  The fact that no one has reported this
bug since commit 7b4a0685e8 in 2005 supports that claim.

	PR 31941
	* objcopy.c (filter_symbols): Don't allow BSF_FILE symbols to
	be made global.
2024-07-01 11:04:31 +09:30