Commit Graph

19603 Commits

Author SHA1 Message Date
GDB Administrator
e1474599f2 Automatic date update in version.in 2025-01-17 00:01:45 +00:00
GDB Administrator
1f3c894d72 Automatic date update in version.in 2025-01-16 00:01:55 +00:00
GDB Administrator
5746383e8c Automatic date update in version.in 2025-01-15 00:01:32 +00:00
GDB Administrator
3babd75807 Automatic date update in version.in 2025-01-14 00:01:44 +00:00
GDB Administrator
0866754873 Automatic date update in version.in 2025-01-13 00:01:29 +00:00
GDB Administrator
36d2bf9ba1 Automatic date update in version.in 2025-01-12 00:01:34 +00:00
GDB Administrator
97b4f10487 Automatic date update in version.in 2025-01-11 00:00:42 +00:00
GDB Administrator
230ab6b333 Automatic date update in version.in 2025-01-10 00:00:37 +00:00
GDB Administrator
6cd2d77114 Automatic date update in version.in 2025-01-09 00:01:45 +00:00
GDB Administrator
03a4ae4018 Automatic date update in version.in 2025-01-08 00:00:27 +00:00
GDB Administrator
6b0351f121 Automatic date update in version.in 2025-01-07 00:00:56 +00:00
GDB Administrator
dcde183ad1 Automatic date update in version.in 2025-01-06 00:02:01 +00:00
GDB Administrator
aebbe069df Automatic date update in version.in 2025-01-05 00:00:40 +00:00
GDB Administrator
67a0e92293 Automatic date update in version.in 2025-01-04 00:01:06 +00:00
GDB Administrator
85c6b4e827 Automatic date update in version.in 2025-01-03 00:01:53 +00:00
Alan Modra
97078538d6 PR 32507, PRIx64 in error messages on 32-bit mingw
People, including me, had forgotten that the bfd_error_handler just
handled standard printf format strings, not MSC %I64 and suchlike.
Using PRIx64 and similar in errors does not work if the host compiler
headers define those formats as the Microsoft %I64 variety.  (We
handled %ll OK, editing it to %I64 on such hosts.)

	PR 32507
	* bfd.c (_bfd_doprnt, _bfd_doprnt_scan): Handle %I64 and %I32
	in input strings if the host defines PRId64 as "I64d".
	Edit %ll to %I64 on detecting PRId64 as "I64d" rather than on
	a preprocessor define.

(cherry picked from commit b38cf91f23)
2025-01-02 19:32:16 +02:00
GDB Administrator
c1001d08ee Automatic date update in version.in 2025-01-02 00:01:22 +00:00
GDB Administrator
c2a5fae738 Automatic date update in version.in 2025-01-01 00:01:14 +00:00
GDB Administrator
7b4436effe Automatic date update in version.in 2024-12-31 00:00:50 +00:00
GDB Administrator
0d51df64c4 Automatic date update in version.in 2024-12-30 00:01:44 +00:00
Joel Brobecker
b2d36b9a2b Set development mode to "off" by default.
This is done by setting the "development" variable to "false"
in bfd/development.sh.
2024-12-29 06:51:39 +04:00
GDB Administrator
ee29a3c4ac Automatic date update in version.in 2024-12-29 00:00:18 +00:00
GDB Administrator
f866db7aff Automatic date update in version.in 2024-12-28 00:00:19 +00:00
Jan Beulich
d5827a0e83 bfd/ELF: refine segment index in filepos assignment diag
Reporting an internal loop index isn't helpful for the user to determine
which segment the problem is with. Report the PHDR index instead.
2024-12-27 11:37:42 +01:00
Xi Ruoyao
e2cbacaec1 LoongArch: Reword message for unresolvable relocs
For PDE, "recompiling with -fPIE" just makes no sense.

For PIE, "recompiling with -fPIE" makes sense for unresolvable absolute
relocs, but not unresolveable PC-relative relocs: if the reloc is
already PC-relative, the problem is not the reloc is PC-relative or
absolute, but the reloc is not applicable for external symbols.

If we hit an unresolvable reloc in PDE or an unresolvable PC-relative
reloc in PIE, it means the programmer has somehow wrongly instructed the
compiler to treat external symbols as local symbols.  A misuse of
-mdirect-extern-access can cause the issue, so we can suggest
-mno-direct-extern-access.  And in all cases (DSO/PIE/PDE) a mismatching
symbol visibility can also cause the issue, so we should also suggest to
check the visibility.

Signed-off-by: Xi Ruoyao <xry111@xry111.site>
2024-12-27 17:52:29 +08:00
Xi Ruoyao
c1a964051b LoongArch: Allow R_LARCH_PCALA_HI20 or R_LARCH_PCREL20_S2 against undefined weak symbols for static PIE
In a static PIE, undefined weak symbols should be just resolved to
runtime address 0, like those symbols with non-default visibility.  This
was silently broken in all prior Binutils releases with "-static-pie
-mdirect-extern-access":

    $ cat t.c
    int x (void) __attribute__ ((weak));

    int
    main (void)
    {
      __builtin_printf("%p\n", x);
    }
    $ gcc t.c -static-pie -mdirect-extern-access
    $ ./a.out
    0x7ffff1d64000

Since commit 4cb77761d6 ("LoongArch: Check PC-relative relocations for
shared libraries), the situation has been improved: the linker errors
out instead of silently producing a wrong output file.

But logically, using -mdirect-extern-access for a static PIE perfectly
makes sense, and we should not prevent that even if the programmer uses
weak symbols.  Linux kernel is such an example, and Linux < 6.10 now
fails to build with Binutils trunk.  (The silent breakage with prior
Binutils releases was "benign" due to some blind luck.)

While since the 6.10 release Linux has removed those potentially
undefined weak symbols (due to performance issue), we still should
support weak symbols in -mdirect-extern-access -static-pie and unbreak
building old kernels.

Link: https://lore.kernel.org/loongarch/20241206085810.112341-1-chenhuacai@loongson.cn/
Signed-off-by: Xi Ruoyao <xry111@xry111.site>
2024-12-27 17:52:29 +08:00
Xi Ruoyao
bd94e7cd84 LoongArch: Fix resolution of undefined weak hidden/protected symbols
An undefined weak hidden/protect symbol should be resolved to runtime
address 0, but we were actually resolving it to link-time address 0.  So
in PIE or DSO the runtime address would be incorrect.

Fix the issue by rewriting pcalau12i to lu12i.w, and pcaddi to addi.w.
The latter does not always work because the immediate field of addi.w is
narrower, report an error in the case the addend is too large.

Signed-off-by: Xi Ruoyao <xry111@xry111.site>
2024-12-27 17:52:29 +08:00
GDB Administrator
e65a355022 Automatic date update in version.in 2024-12-27 00:00:26 +00:00
GDB Administrator
fa93e88f75 Automatic date update in version.in 2024-12-26 00:00:20 +00:00
GDB Administrator
ebc38280ce Automatic date update in version.in 2024-12-25 00:00:15 +00:00
Alan Modra
bbc969306f PR 32324, Stripping BOLT'ed binaries leads to unwanted behaviour
This patch corrects layout for a PT_LOAD header that doesn't include
the ELF file header but does contain PHDRs and sections requiring
alignment.  The required alignment (which was missing) is placed
before the PHDRs.
2024-12-24 14:54:19 +10:30
GDB Administrator
2a09a1253a Automatic date update in version.in 2024-12-24 00:00:13 +00:00
GDB Administrator
ec4fe13e4d Automatic date update in version.in 2024-12-23 00:00:18 +00:00
GDB Administrator
3dc8bef12e Automatic date update in version.in 2024-12-22 00:00:08 +00:00
GDB Administrator
d77a314495 Automatic date update in version.in 2024-12-21 00:00:19 +00:00
GDB Administrator
a426ba6b4a Automatic date update in version.in 2024-12-20 00:00:08 +00:00
Nick Clifton
dd0f53d189 Updated Serbian translation for the bfd sub-directory 2024-12-19 10:35:16 +00:00
Jan Beulich
2c0c13933a bfd/ELF: refine PR binutils/31872 fix
The fix for PR binutils/31872 (commit b20ab53f81) neglected the case
of targets with only RELA support, where nevertheless object files using
REL exist. In particular objcopy will create such objects for x86-64
when converting from an i?86 ELF object (this by itself probably isn't
quite right, but we ought to cope with what our own tools are doing).

Restore the fallback to the RELA lookup, just without re-introducing the
blind NULL de-ref that was there before.
2024-12-19 10:39:38 +01:00
GDB Administrator
4a95bf414d Automatic date update in version.in 2024-12-19 00:00:23 +00:00
Alan Modra
1f79e2e03b target_id for cr16 and vax
Both of these targets extend elf_link_hash_entry, so arguably should
set hash_table_id to something other than GENERIC_ELF_DATA.  The patch
also sorts enum elf_target_id.
2024-12-19 08:16:43 +10:30
Alan Modra
aa7a348b2f Remove bfd_elf_allocate_object object_id param
This is another case where the proper object_id can be read from
elf_backend_data.
2024-12-19 08:12:07 +10:30
Alan Modra
f92b077ee7 Remove _bfd_elf_link_hash_table_init target_id param
hash_table_id can be set from elf_backend_data, now that all targets
have matching ELF_TARGET_ID and hash_table_init target_id.
2024-12-19 08:06:37 +10:30
Alan Modra
a9baa81f50 Add a few elf_backend_data target ids
aarch64, am33, csky, ia64-vms, kvx, and sparc64 all use more than
the base GENERIC_ELF_DATA, but don't set ELF_TARGET_ID.  Fix that.
These are all targets that use other than GENERIC_ELF_DATA in their
object and hash table ids.

	* elf32-am33lin.c,
	* elf32-csky.c,
	* elf64-ia64-vms.c,
	* elf64-sparc.c,
	* elfnn-aarch64.c,
	* elfnn-kvx.c (ELF_TARGET_ID): Define.
2024-12-19 07:56:42 +10:30
GDB Administrator
7195f52f73 Automatic date update in version.in 2024-12-18 00:00:23 +00:00
Alan Modra
a030e43267 Re: score and mmix target_id
elflink.c checks elf_object_id(ibfd) == elf_hash_table_id(hash_table)
in a number of places.  Make them match.
2024-12-17 14:32:46 +10:30
GDB Administrator
e0e0ff9249 Automatic date update in version.in 2024-12-17 00:00:54 +00:00
Alan Modra
bc7b21018e mach-o segment section count assertion
Add an assertion that verifies we have filled the mdata->sections
array in bfd_mach_o_flatten_sections.
2024-12-16 19:37:40 +10:30
Alan Modra
64a91215cd score and mmix target_id
These targets currently use GENERIC_ELF_DATA as their target_id, but
that isn't exactly correct.  While their bfd tdata is generic elf,
their elf_section_data is extended with extra target data.  Add
MMIX_ELF_DATA and SCORE_ELF_DATA.
2024-12-16 19:37:40 +10:30
Alan Modra
c32881686b goodbye aout_section_data
aout_section_data->relocs isn't set by anything, so delete it.
2024-12-16 19:37:40 +10:30
Alan Modra
4d3eb17eb9 record_section_with_aarch64_elf_section_dat
Nowhere in the aarch64 backend is the list created by this function
examined, and in any case there are much simpler ways to determine the
type of elf_section_data attached to a bfd ELF section.  It will
always be according to the target_id of the section owner.

Delete sections_with_aarch64_elf_section_data and everything
associated with it.
2024-12-16 19:37:40 +10:30