From 33990e5ced2caa8126d614a9fa5c707ea9cfcc0c Mon Sep 17 00:00:00 2001 From: GDB Administrator Date: Mon, 23 Dec 2024 00:01:14 +0000 Subject: [PATCH 01/10] Automatic date update in version.in --- bfd/version.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bfd/version.h b/bfd/version.h index e9af7d85c8d..336dcfd5cae 100644 --- a/bfd/version.h +++ b/bfd/version.h @@ -16,7 +16,7 @@ In releases, the date is not included in either version strings or sonames. */ -#define BFD_VERSION_DATE 20241222 +#define BFD_VERSION_DATE 20241223 #define BFD_VERSION @bfd_version@ #define BFD_VERSION_STRING @bfd_version_package@ @bfd_version_string@ #define REPORT_BUGS_TO @report_bugs_to@ From b194ae062ee434f8995a96a191d49290c3d94fab Mon Sep 17 00:00:00 2001 From: GDB Administrator Date: Tue, 24 Dec 2024 00:00:58 +0000 Subject: [PATCH 02/10] Automatic date update in version.in --- bfd/version.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bfd/version.h b/bfd/version.h index 336dcfd5cae..e4313fc1739 100644 --- a/bfd/version.h +++ b/bfd/version.h @@ -16,7 +16,7 @@ In releases, the date is not included in either version strings or sonames. */ -#define BFD_VERSION_DATE 20241223 +#define BFD_VERSION_DATE 20241224 #define BFD_VERSION @bfd_version@ #define BFD_VERSION_STRING @bfd_version_package@ @bfd_version_string@ #define REPORT_BUGS_TO @report_bugs_to@ From 551c1430e5c2baf8536200daf0bca7de270451f2 Mon Sep 17 00:00:00 2001 From: GDB Administrator Date: Wed, 25 Dec 2024 00:00:52 +0000 Subject: [PATCH 03/10] Automatic date update in version.in --- bfd/version.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bfd/version.h b/bfd/version.h index e4313fc1739..3f195eedb4b 100644 --- a/bfd/version.h +++ b/bfd/version.h @@ -16,7 +16,7 @@ In releases, the date is not included in either version strings or sonames. */ -#define BFD_VERSION_DATE 20241224 +#define BFD_VERSION_DATE 20241225 #define BFD_VERSION @bfd_version@ #define BFD_VERSION_STRING @bfd_version_package@ @bfd_version_string@ #define REPORT_BUGS_TO @report_bugs_to@ From 923497873f837bab74b6a850b63b46e27a79d924 Mon Sep 17 00:00:00 2001 From: GDB Administrator Date: Thu, 26 Dec 2024 00:01:55 +0000 Subject: [PATCH 04/10] Automatic date update in version.in --- bfd/version.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bfd/version.h b/bfd/version.h index 3f195eedb4b..b2f3c7d0b72 100644 --- a/bfd/version.h +++ b/bfd/version.h @@ -16,7 +16,7 @@ In releases, the date is not included in either version strings or sonames. */ -#define BFD_VERSION_DATE 20241225 +#define BFD_VERSION_DATE 20241226 #define BFD_VERSION @bfd_version@ #define BFD_VERSION_STRING @bfd_version_package@ @bfd_version_string@ #define REPORT_BUGS_TO @report_bugs_to@ From 0cdfcb9b8c4b726e755367c30cd54131e3f017eb Mon Sep 17 00:00:00 2001 From: GDB Administrator Date: Fri, 27 Dec 2024 00:02:07 +0000 Subject: [PATCH 05/10] Automatic date update in version.in --- bfd/version.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bfd/version.h b/bfd/version.h index b2f3c7d0b72..db5d0e4d72b 100644 --- a/bfd/version.h +++ b/bfd/version.h @@ -16,7 +16,7 @@ In releases, the date is not included in either version strings or sonames. */ -#define BFD_VERSION_DATE 20241226 +#define BFD_VERSION_DATE 20241227 #define BFD_VERSION @bfd_version@ #define BFD_VERSION_STRING @bfd_version_package@ @bfd_version_string@ #define REPORT_BUGS_TO @report_bugs_to@ From e2d776f7b9c2ba59bdf2d885d0f9d6bb2c1d5d81 Mon Sep 17 00:00:00 2001 From: GDB Administrator Date: Sat, 28 Dec 2024 00:02:36 +0000 Subject: [PATCH 06/10] Automatic date update in version.in --- bfd/version.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bfd/version.h b/bfd/version.h index db5d0e4d72b..0d2a84b0150 100644 --- a/bfd/version.h +++ b/bfd/version.h @@ -16,7 +16,7 @@ In releases, the date is not included in either version strings or sonames. */ -#define BFD_VERSION_DATE 20241227 +#define BFD_VERSION_DATE 20241228 #define BFD_VERSION @bfd_version@ #define BFD_VERSION_STRING @bfd_version_package@ @bfd_version_string@ #define REPORT_BUGS_TO @report_bugs_to@ From a8563dba75c92e04dbc63bdbee03b0ebc8889fa8 Mon Sep 17 00:00:00 2001 From: Xi Ruoyao Date: Fri, 27 Dec 2024 16:26:28 +0800 Subject: [PATCH 07/10] LoongArch: Fix broken DESC => IE transition for 2.43 branch If code compiled with -fPIC -mtls-dialect=desc is linked into a PDE or PIE, and the code refers to external DSO symbols, we can produce broken link unit as check_relocs expects DESC => IE transition to happen and emits a TLS IE entry in the GOT, but a too early "continue" in relax_section actually jumps over the DESC => IE transition so the code sequence is unchanged and still expecting a TLS descriptor (instead of an IE entry) in the GOT. The bug is already fixed in master branch by commit 5c3d09c1855b ("LoongArch: Optimize the relaxation process") so this fix is only needed for the 2.43 branch. Reported-by: Icenowy Zheng Closes: https://gcc.gnu.org/PR118114 Tested-by: Icenowy Zheng Signed-off-by: Xi Ruoyao --- bfd/elfnn-loongarch.c | 45 ++++++++++++++++++++++--------------------- 1 file changed, 23 insertions(+), 22 deletions(-) diff --git a/bfd/elfnn-loongarch.c b/bfd/elfnn-loongarch.c index 312707bb00b..7760b5279f8 100644 --- a/bfd/elfnn-loongarch.c +++ b/bfd/elfnn-loongarch.c @@ -5325,8 +5325,8 @@ loongarch_elf_relax_section (bfd *abfd, asection *sec, for (unsigned int i = 0; i < sec->reloc_count; i++) { char symtype; - bfd_vma symval; - asection *sym_sec; + bfd_vma symval = 0; /* "= 0" for https://gcc.gnu.org/PR118216 */ + asection *sym_sec = NULL; bool local_got = false; Elf_Internal_Rela *rel = relocs + i; struct elf_link_hash_entry *h = NULL; @@ -5418,14 +5418,33 @@ loongarch_elf_relax_section (bfd *abfd, asection *sec, symval = h->root.u.def.value; sym_sec = h->root.u.def.section; } - else - continue; if (h && LARCH_REF_LOCAL (info, h)) local_got = true; symtype = h->type; } + /* If the conditions for tls type transition are met, type + transition is performed instead of relax. + During the transition from DESC->IE/LE, there are 2 situations + depending on the different configurations of the relax/norelax + option. + If the -relax option is used, the extra nops will be removed, + and this transition is performed in pass 0. + If the --no-relax option is used, nop will be retained, and + this transition is performed in pass 1. */ + if (IS_LOONGARCH_TLS_TRANS_RELOC (r_type) + && (i + 1 != sec->reloc_count) + && ELFNN_R_TYPE (rel[1].r_info) == R_LARCH_RELAX + && loongarch_can_trans_tls (abfd, info, h, r_symndx, r_type)) + { + loongarch_tls_perform_trans (abfd, sec, rel, h, info); + r_type = ELFNN_R_TYPE (rel->r_info); + } + + if (!sym_sec) + continue; + if (sym_sec->sec_info_type == SEC_INFO_TYPE_MERGE && (sym_sec->flags & SEC_MERGE)) { @@ -5453,24 +5472,6 @@ loongarch_elf_relax_section (bfd *abfd, asection *sec, symval += sec_addr (sym_sec); - /* If the conditions for tls type transition are met, type - transition is performed instead of relax. - During the transition from DESC->IE/LE, there are 2 situations - depending on the different configurations of the relax/norelax - option. - If the -relax option is used, the extra nops will be removed, - and this transition is performed in pass 0. - If the --no-relax option is used, nop will be retained, and - this transition is performed in pass 1. */ - if (IS_LOONGARCH_TLS_TRANS_RELOC (r_type) - && (i + 1 != sec->reloc_count) - && ELFNN_R_TYPE (rel[1].r_info) == R_LARCH_RELAX - && loongarch_can_trans_tls (abfd, info, h, r_symndx, r_type)) - { - loongarch_tls_perform_trans (abfd, sec, rel, h, info); - r_type = ELFNN_R_TYPE (rel->r_info); - } - switch (r_type) { case R_LARCH_ALIGN: From 2c1975500d0bbe4fe6e839cda446bc0e91e85ece Mon Sep 17 00:00:00 2001 From: GDB Administrator Date: Sun, 29 Dec 2024 00:01:52 +0000 Subject: [PATCH 08/10] Automatic date update in version.in --- bfd/version.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bfd/version.h b/bfd/version.h index 0d2a84b0150..99e421ac4b8 100644 --- a/bfd/version.h +++ b/bfd/version.h @@ -16,7 +16,7 @@ In releases, the date is not included in either version strings or sonames. */ -#define BFD_VERSION_DATE 20241228 +#define BFD_VERSION_DATE 20241229 #define BFD_VERSION @bfd_version@ #define BFD_VERSION_STRING @bfd_version_package@ @bfd_version_string@ #define REPORT_BUGS_TO @report_bugs_to@ From e17aa8bbd84f54cd96f92a2c5b23bf08b5376601 Mon Sep 17 00:00:00 2001 From: GDB Administrator Date: Mon, 30 Dec 2024 00:02:15 +0000 Subject: [PATCH 09/10] Automatic date update in version.in --- bfd/version.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bfd/version.h b/bfd/version.h index 99e421ac4b8..8d554955a12 100644 --- a/bfd/version.h +++ b/bfd/version.h @@ -16,7 +16,7 @@ In releases, the date is not included in either version strings or sonames. */ -#define BFD_VERSION_DATE 20241229 +#define BFD_VERSION_DATE 20241230 #define BFD_VERSION @bfd_version@ #define BFD_VERSION_STRING @bfd_version_package@ @bfd_version_string@ #define REPORT_BUGS_TO @report_bugs_to@ From bb9a0a36e78aa564021b377a4a7fab4851b2c22b Mon Sep 17 00:00:00 2001 From: mengqinggang Date: Thu, 26 Dec 2024 14:14:12 +0800 Subject: [PATCH 10/10] LoongArch: Add relaxation support for call36 that jump to PLT entry Part of commit a104f0a3e620 ("LoongArch: Add more relaxation support for call36") in master. This part is needed for 2.43 branch to fix a link failure of QtWebEngine-6.8.1, which can be demonstrated with a reduced test case (with -shared): .text .zero 1 << 27 # pretending we have a lot of code in .text .globl f # preemptible, thus must be called via PLT f: move $a0, $r0 ret g: pcaddu18i $t0, %call36(f) jr $t0 Signed-off-by: Xi Ruoyao --- bfd/elfnn-loongarch.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/bfd/elfnn-loongarch.c b/bfd/elfnn-loongarch.c index 7760b5279f8..610713a9d7e 100644 --- a/bfd/elfnn-loongarch.c +++ b/bfd/elfnn-loongarch.c @@ -5410,6 +5410,11 @@ loongarch_elf_relax_section (bfd *abfd, asection *sec, && GOT_TLS_GD_BOTH_P (tls_type)) symval += 2 * GOT_ENTRY_SIZE; } + else if (h->plt.offset != MINUS_ONE) + { + sym_sec = htab->elf.splt ? htab->elf.splt : htab->elf.iplt; + symval = h->plt.offset; + } else if ((h->root.type == bfd_link_hash_defined || h->root.type == bfd_link_hash_defweak) && h->root.u.def.section != NULL