Sync from SUSE:SLFO:Main binutils revision 471b681ebcc57f12ec28433a9700d977

This commit is contained in:
Adrian Schröter 2024-05-03 11:18:53 +02:00
commit f17d6f9c5c
38 changed files with 8508 additions and 0 deletions

23
.gitattributes vendored Normal file
View File

@ -0,0 +1,23 @@
## Default LFS
*.7z filter=lfs diff=lfs merge=lfs -text
*.bsp filter=lfs diff=lfs merge=lfs -text
*.bz2 filter=lfs diff=lfs merge=lfs -text
*.gem filter=lfs diff=lfs merge=lfs -text
*.gz filter=lfs diff=lfs merge=lfs -text
*.jar filter=lfs diff=lfs merge=lfs -text
*.lz filter=lfs diff=lfs merge=lfs -text
*.lzma filter=lfs diff=lfs merge=lfs -text
*.obscpio filter=lfs diff=lfs merge=lfs -text
*.oxt filter=lfs diff=lfs merge=lfs -text
*.pdf filter=lfs diff=lfs merge=lfs -text
*.png filter=lfs diff=lfs merge=lfs -text
*.rpm filter=lfs diff=lfs merge=lfs -text
*.tbz filter=lfs diff=lfs merge=lfs -text
*.tbz2 filter=lfs diff=lfs merge=lfs -text
*.tgz filter=lfs diff=lfs merge=lfs -text
*.ttf filter=lfs diff=lfs merge=lfs -text
*.txz filter=lfs diff=lfs merge=lfs -text
*.whl filter=lfs diff=lfs merge=lfs -text
*.xz filter=lfs diff=lfs merge=lfs -text
*.zip filter=lfs diff=lfs merge=lfs -text
*.zst filter=lfs diff=lfs merge=lfs -text

19
_constraints Normal file
View File

@ -0,0 +1,19 @@
<constraints>
<hardware>
<disk>
<size unit="G">6</size>
</disk>
</hardware>
<overwrite>
<conditions>
<arch>ppc</arch>
<arch>ppc64</arch>
<arch>ppc64le</arch>
</conditions>
<hardware>
<physicalmemory>
<size unit="G">4</size>
</physicalmemory>
</hardware>
</overwrite>
</constraints>

26
_multibuild Normal file
View File

@ -0,0 +1,26 @@
<multibuild>
<flavor>aarch64</flavor>
<flavor>hppa</flavor>
<flavor>hppa64</flavor>
<flavor>arm</flavor>
<flavor>i386</flavor>
<flavor>x86_64</flavor>
<flavor>s390</flavor>
<flavor>s390x</flavor>
<flavor>ppc</flavor>
<flavor>ppc64</flavor>
<flavor>ppc64le</flavor>
<flavor>ia64</flavor>
<flavor>sparc</flavor>
<flavor>sparc64</flavor>
<flavor>spu</flavor>
<flavor>avr</flavor>
<flavor>pru</flavor>
<flavor>mips</flavor>
<flavor>m68k</flavor>
<flavor>epiphany</flavor>
<flavor>rx</flavor>
<flavor>riscv64</flavor>
<flavor>xtensa</flavor>
<flavor>bpf</flavor>
</multibuild>

View File

@ -0,0 +1,56 @@
Change default common-page-size to 64K on aarch64. This enables the use
of RELRO since we are using 64K pages.
Index: binutils-2.41/bfd/elfnn-aarch64.c
===================================================================
--- binutils-2.41.orig/bfd/elfnn-aarch64.c 2023-07-03 01:00:00.000000000 +0200
+++ binutils-2.41/bfd/elfnn-aarch64.c 2023-08-16 16:31:51.238779641 +0200
@@ -10251,7 +10251,7 @@ const struct elf_size_info elfNN_aarch64
#define ELF_ARCH bfd_arch_aarch64
#define ELF_MACHINE_CODE EM_AARCH64
#define ELF_MAXPAGESIZE 0x10000
-#define ELF_COMMONPAGESIZE 0x1000
+#define ELF_COMMONPAGESIZE 0x10000
#define bfd_elfNN_bfd_free_cached_info \
elfNN_aarch64_bfd_free_cached_info
Index: binutils-2.41/gold/aarch64.cc
===================================================================
--- binutils-2.41.orig/gold/aarch64.cc 2023-07-03 01:00:00.000000000 +0200
+++ binutils-2.41/gold/aarch64.cc 2023-08-16 16:28:35.959450565 +0200
@@ -3555,7 +3555,7 @@ const Target::Target_info Target_aarch64
"/lib/ld.so.1", // program interpreter
0x400000, // default_text_segment_address
0x10000, // abi_pagesize (overridable by -z max-page-size)
- 0x1000, // common_pagesize (overridable by -z common-page-size)
+ 0x10000, // common_pagesize (overridable by -z common-page-size)
false, // isolate_execinstr
0, // rosegment_gap
elfcpp::SHN_UNDEF, // small_common_shndx
@@ -3584,7 +3584,7 @@ const Target::Target_info Target_aarch64
"/lib/ld.so.1", // program interpreter
0x400000, // default_text_segment_address
0x10000, // abi_pagesize (overridable by -z max-page-size)
- 0x1000, // common_pagesize (overridable by -z common-page-size)
+ 0x10000, // common_pagesize (overridable by -z common-page-size)
false, // isolate_execinstr
0, // rosegment_gap
elfcpp::SHN_UNDEF, // small_common_shndx
@@ -3613,7 +3613,7 @@ const Target::Target_info Target_aarch64
"/lib/ld.so.1", // program interpreter
0x400000, // default_text_segment_address
0x10000, // abi_pagesize (overridable by -z max-page-size)
- 0x1000, // common_pagesize (overridable by -z common-page-size)
+ 0x10000, // common_pagesize (overridable by -z common-page-size)
false, // isolate_execinstr
0, // rosegment_gap
elfcpp::SHN_UNDEF, // small_common_shndx
@@ -3642,7 +3642,7 @@ const Target::Target_info Target_aarch64
"/lib/ld.so.1", // program interpreter
0x400000, // default_text_segment_address
0x10000, // abi_pagesize (overridable by -z max-page-size)
- 0x1000, // common_pagesize (overridable by -z common-page-size)
+ 0x10000, // common_pagesize (overridable by -z common-page-size)
false, // isolate_execinstr
0, // rosegment_gap
elfcpp::SHN_UNDEF, // small_common_shndx

207
add-ulp-section.diff Normal file
View File

@ -0,0 +1,207 @@
This is for userspace live patching, adding some space into
shared libs or executable (in the .ulp section) when one of the
input files contains a section named .ulp.track.
diff --git a/bfd/elf-bfd.h b/bfd/elf-bfd.h
index 101c2fdf50d..f5d9e201fdb 100644
--- a/bfd/elf-bfd.h
+++ b/bfd/elf-bfd.h
@@ -1487,6 +1487,10 @@ struct elf_backend_data
(const bfd *ibfd, bfd *obfd, const Elf_Internal_Shdr *isection,
Elf_Internal_Shdr *osection);
+ bool (*elf_backend_is_ulp_enabled) (bfd *abfd);
+
+ bool (*elf_backend_setup_ulp) (struct bfd_link_info *);
+
/* Used to handle bad SHF_LINK_ORDER input. */
void (*link_order_error_handler) (const char *, ...);
diff --git a/bfd/elflink.c b/bfd/elflink.c
index ce1407fa2dc..5c70bcf6c07 100644
--- a/bfd/elflink.c
+++ b/bfd/elflink.c
@@ -7260,6 +7260,13 @@ bfd_elf_size_dynamic_sections (bfd *output_bfd,
s = bfd_get_linker_section (dynobj, ".gnu.version");
s->flags |= SEC_EXCLUDE;
}
+
+ if (bed->elf_backend_is_ulp_enabled != NULL
+ && bed->elf_backend_setup_ulp != NULL
+ && (*bed->elf_backend_is_ulp_enabled) (info->input_bfds))
+ {
+ (*bed->elf_backend_setup_ulp)(info);
+ }
}
return true;
}
diff --git a/bfd/elfxx-target.h b/bfd/elfxx-target.h
index 4c6b1f20340..1f54509cd08 100644
--- a/bfd/elfxx-target.h
+++ b/bfd/elfxx-target.h
@@ -771,6 +771,14 @@
#define elf_backend_copy_special_section_fields _bfd_elf_copy_special_section_fields
#endif
+#ifndef elf_backend_is_ulp_enabled
+#define elf_backend_is_ulp_enabled NULL
+#endif
+
+#ifndef elf_backend_setup_ulp
+#define elf_backend_setup_ulp NULL
+#endif
+
#ifndef elf_backend_compact_eh_encoding
#define elf_backend_compact_eh_encoding NULL
#endif
@@ -904,6 +912,8 @@ static const struct elf_backend_data elfNN_bed =
elf_backend_maybe_function_sym,
elf_backend_get_reloc_section,
elf_backend_copy_special_section_fields,
+ elf_backend_is_ulp_enabled,
+ elf_backend_setup_ulp,
elf_backend_link_order_error_handler,
elf_backend_relplt_name,
ELF_MACHINE_ALT1,
diff --git a/bfd/elfxx-x86.c b/bfd/elfxx-x86.c
index 62d516aab8d..c0fb718d85c 100644
--- a/bfd/elfxx-x86.c
+++ b/bfd/elfxx-x86.c
@@ -29,6 +29,8 @@
#define ELF64_DYNAMIC_INTERPRETER "/lib/ld64.so.1"
#define ELFX32_DYNAMIC_INTERPRETER "/lib/ldx32.so.1"
+#define ULP_ENTRY_LEN 16
+
bool
_bfd_x86_elf_mkobject (bfd *abfd)
{
@@ -984,6 +986,64 @@ _bfd_elf_x86_valid_reloc_p (asection *input_section,
return valid_p;
}
+/* Check if input bfds are ulp-enabled by containing .ulp.track section */
+
+bool
+_bfd_x86_elf_is_ulp_enabled (struct bfd *input_bfd)
+{
+ while (input_bfd != NULL)
+ for (; input_bfd != NULL; input_bfd = input_bfd->link.next)
+ {
+ if (input_bfd->section_count == 0) continue;
+ if (bfd_get_section_by_name (input_bfd, ".ulp.track")) return true;
+ }
+ return false;
+}
+
+/* To be used by elf_link_hash_traverse when computing the ulp length */
+
+static bool
+bfd_x86_elf_link_compute_ulp (struct elf_link_hash_entry *h, void *data)
+{
+ unsigned long *ulp_length = (unsigned long *) data;
+
+ if (h->dynindx != -1 && h->type == STT_FUNC && !h->def_dynamic)
+ {
+ ++(*ulp_length);
+ }
+ return true;
+}
+
+/* Fill the user-space live patching section */
+
+bool
+_bfd_x86_elf_setup_ulp (struct bfd_link_info *info)
+{
+ struct elf_x86_link_hash_table *htab;
+ asection *ulp;
+ unsigned int ulp_length = 0;
+
+ htab = elf_x86_hash_table (info, X86_64_ELF_DATA);
+
+ elf_link_hash_traverse (elf_hash_table (info),
+ bfd_x86_elf_link_compute_ulp,
+ &ulp_length);
+
+ ulp = htab->ulp;
+
+ ulp->size = ulp_length * ULP_ENTRY_LEN;
+
+ ulp->contents = (bfd_byte *) bfd_malloc (ulp->size);
+ if (ulp->contents == NULL)
+ return false;
+
+ if (!ulp->contents)
+ return false;
+
+ memset(ulp->contents, 0x00, ulp->size);
+ return true;
+}
+
/* Set the sizes of the dynamic sections. */
bool
@@ -3030,7 +3090,26 @@ _bfd_x86_elf_link_setup_gnu_properties
htab->plt_second = sec;
}
- }
+
+ /* create sections to support user-space live patching */
+ if (_bfd_x86_elf_is_ulp_enabled(info->input_bfds))
+ {
+ flagword flags = (bed->dynamic_sec_flags
+ | SEC_ALLOC
+ | SEC_CODE
+ | SEC_LOAD
+ | SEC_READONLY);
+
+ sec = bfd_make_section_anyway_with_flags (dynobj, ".ulp", flags);
+ if (sec == NULL)
+ info->callbacks->einfo (_("%F%P: failed to create ULP section\n"));
+
+ if (!bfd_set_section_alignment (sec, plt_alignment))
+ goto error_alignment;
+
+ htab->ulp = sec;
+ }
+ }
if (!info->no_ld_generated_unwind_info)
{
diff --git a/bfd/elfxx-x86.h b/bfd/elfxx-x86.h
index db11327e96f..89f51382216 100644
--- a/bfd/elfxx-x86.h
+++ b/bfd/elfxx-x86.h
@@ -607,6 +607,7 @@ struct elf_x86_link_hash_table
asection *plt_second_eh_frame;
asection *plt_got;
asection *plt_got_eh_frame;
+ asection *ulp;
sframe_encoder_ctx *plt_cfe_ctx;
asection *plt_sframe;
@@ -694,6 +695,12 @@ extern void _bfd_x86_elf_link_report_relative_reloc
(struct bfd_link_info *, asection *, struct elf_link_hash_entry *,
Elf_Internal_Sym *, const char *, const void *);
+extern bool _bfd_x86_elf_is_ulp_enabled
+ (struct bfd *);
+
+extern bool _bfd_x86_elf_setup_ulp
+ (struct bfd_link_info *);
+
#define bfd_elf64_mkobject \
_bfd_x86_elf_mkobject
#define bfd_elf32_mkobject \
@@ -907,6 +914,10 @@ extern void _bfd_x86_elf_link_report_relative_reloc
_bfd_elf_x86_size_relative_relocs
#define elf_backend_finish_relative_relocs \
_bfd_elf_x86_finish_relative_relocs
+#define elf_backend_is_ulp_enabled \
+ _bfd_x86_elf_is_ulp_enabled
+#define elf_backend_setup_ulp \
+ _bfd_x86_elf_setup_ulp
#define ELF_P_ALIGN ELF_MINPAGESIZE

4
baselibs.conf Normal file
View File

@ -0,0 +1,4 @@
binutils-devel
requires -binutils-<targettype>
obsoletes "binutils-<targettype> < <version>"

BIN
binutils-2.41-branch.diff.gz (Stored with Git LFS) Normal file

Binary file not shown.

BIN
binutils-2.41.tar.bz2 (Stored with Git LFS) Normal file

Binary file not shown.

16
binutils-2.41.tar.bz2.sig Normal file
View File

@ -0,0 +1,16 @@
-----BEGIN PGP SIGNATURE-----
iQIzBAABCAAdFiEEOiS8Ho+0CfqfFDcYE/zvid2ePE8FAmTGcUQACgkQE/zvid2e
PE94TRAAsAGH/rarx1cyAxa8x0yKjcQxERag3KE3NXN+OnRvw2bCOfVx62UA68Dt
nTCsJ46MTSECdMnMj+b6wGNXr4JDv57r4lkJxJN8TjAS+gWrouqbjvaTPOkros3L
1uElw3JLBznDktYvv2aJxBTLSPRXxaD2gMSjVYSZ5X43/ITbNx8mSToevZf2erXB
ev+FY5ROyjPwFZyXTEYqqbbdJ4A6+Fkp1UO9UiQv3leZde29ZSiBbNZUU4u5FH3x
qNq9zTd4Wlk72X1IEK/HFIVAcFbV2bV38V/r64tw5WRndYReXejtEQMm4kvzFZP4
tcgzlTNViTN8FmVNI3P3pByFxC4VmNEbnNCGTDzltuC/RxypqMHWdkBIFU2Zpk4p
oAuRMx+7MJ0MqbZjV+VklZAqbl71oDAtUEi7gwKL/UFsRnmUbjRV00YQrXv1kmm8
FAuK3UJbfX95MkMV9RSB4kwAdGTLv9CpWix+NGIQs17bnYXyuZPQ0OFuYM6xBDlo
IXTS3kvAgKLRni7EQ0xAh3CqQaE5vsLHf7WwTYvi4rWdt0B1hVpFJtpkAhWRrF/N
5Hey/pJgOaS2CqEpbijkfG6mGh/xNYK0T8HnHse1pKjl1U1QEgOtluVI3UF2C/H/
FkrlClxbExTt9+UmuF/wdvttVj7hDooI7Hh11uvOVBabtlUc66E=
=6jCW
-----END PGP SIGNATURE-----

16
binutils-bfd_h.patch Normal file
View File

@ -0,0 +1,16 @@
Remove the #error to avoid issues with legacy not dealing with this
--- bfd/bfd-in.h.orig 2012-11-30 13:44:35.715871571 +0100
+++ bfd/bfd-in.h 2012-11-30 13:44:43.428871298 +0100
@@ -25,11 +25,6 @@
#ifndef __BFD_H_SEEN__
#define __BFD_H_SEEN__
-/* PR 14072: Ensure that config.h is included first. */
-#if !defined PACKAGE && !defined PACKAGE_VERSION
-#error config.h must be included before this header
-#endif
-
#ifdef __cplusplus
extern "C" {
#endif

View File

@ -0,0 +1,13 @@
Index: ld/ldmain.c
===================================================================
--- ld/ldmain.c.orig 2017-07-26 10:07:31.862559913 +0200
+++ ld/ldmain.c 2017-07-26 10:07:31.886560303 +0200
@@ -309,6 +309,8 @@ main (int argc, char **argv)
yydebug = 1;
}
#endif
+ if (getenv ("SUSE_ASNEEDED") && atoi(getenv ("SUSE_ASNEEDED")) > 0)
+ input_flags.add_DT_NEEDED_for_regular = true;
config.build_constructors = true;
config.rpath_separator = ':';

View File

@ -0,0 +1,63 @@
This adjusts some testcases that expect new behaviour:
* that relaxable relocations are generated
* that separate-code is default
- this also implies that default max-page-size is 0x1000, instead of the
old 0x200000, so some testcases need to encode that as well
diff --git a/ld/testsuite/ld-elf/linux-x86.exp b/ld/testsuite/ld-elf/linux-x86.exp
index 2e0cbd37f17..fcd3dd920e4 100644
--- a/ld/testsuite/ld-elf/linux-x86.exp
+++ b/ld/testsuite/ld-elf/linux-x86.exp
@@ -275,7 +275,7 @@ proc check_pr25749a {testname srcfilea srcfileb cflags ldflags lderror} {
}
# Suppress warning for unsupported attribute from older GCC.
- append cflags " -w"
+ append cflags " -w -Wa,-mrelax-relocations=yes"
exec cp $srcdir/$subdir/$srcfilea $srcfilea
exec chmod +w $srcfilea
@@ -396,7 +396,7 @@ proc check_pr25749b {testname srcfilea srcfileb cflags ldflags dsoldflags args}
[list \
"Build lib${testname}.so ($dsoldflags)" \
"-shared $dsoldflags tmpdir/pr25749-bin.o -z noexecstack" \
- "-fPIC -I../bfd" \
+ "-fPIC -I../bfd -Wa,-mrelax-relocations=yes" \
[list $srcfileb] \
{{readelf {-Wr} pr25749.rd}} \
"lib${testname}.so" \
diff --git a/ld/testsuite/ld-i386/report-reloc-1.d b/ld/testsuite/ld-i386/report-reloc-1.d
index 162161592a1..ee96047043d 100644
--- a/ld/testsuite/ld-i386/report-reloc-1.d
+++ b/ld/testsuite/ld-i386/report-reloc-1.d
@@ -1,6 +1,6 @@
#source: report-reloc-1.s
#as: --32
-#ld: -pie -melf_i386 -z report-relative-reloc $NO_DT_RELR_LDFLAGS
+#ld: -pie -melf_i386 -z report-relative-reloc -z separate-code $NO_DT_RELR_LDFLAGS
#warning_output: report-reloc-1.l
#readelf: -r --wide
diff --git a/ld/testsuite/ld-x86-64/report-reloc-1-x32.d b/ld/testsuite/ld-x86-64/report-reloc-1-x32.d
index 63fe7b1bb8a..29a94ff8762 100644
--- a/ld/testsuite/ld-x86-64/report-reloc-1-x32.d
+++ b/ld/testsuite/ld-x86-64/report-reloc-1-x32.d
@@ -1,6 +1,6 @@
#source: report-reloc-1.s
#as: --x32
-#ld: -pie -melf32_x86_64 -z report-relative-reloc $NO_DT_RELR_LDFLAGS
+#ld: -pie -melf32_x86_64 -z report-relative-reloc -z separate-code -z max-page-size=4096 $NO_DT_RELR_LDFLAGS
#warning_output: report-reloc-1.l
#readelf: -r --wide
diff --git a/ld/testsuite/ld-x86-64/report-reloc-1.d b/ld/testsuite/ld-x86-64/report-reloc-1.d
index 69f164c9434..63079acc98a 100644
--- a/ld/testsuite/ld-x86-64/report-reloc-1.d
+++ b/ld/testsuite/ld-x86-64/report-reloc-1.d
@@ -1,6 +1,6 @@
#source: report-reloc-1.s
#as: --64
-#ld: -pie -melf_x86_64 -z report-relative-reloc $NO_DT_RELR_LDFLAGS
+#ld: -pie -melf_x86_64 -z report-relative-reloc -z separate-code -z max-page-size=4096 $NO_DT_RELR_LDFLAGS
#warning_output: report-reloc-1.l
#readelf: -r --wide

View File

@ -0,0 +1,43 @@
This fixes an error message given too eagerly on ppc64le,
when no input files are used and as-needed is in effect. E.g.:
% ld-new --as-needed -o /dev/null -lc
gives an error message about input and output ABI versions being
incompatible. This is because the ABI setting of "unknown" (0)
to "from-input" is done in ppc64_elf_before_check_relocs, which
isn't called for as-needed libraries (via check_directives callback).
merge_private_bfd_data is called for as-needed and not-as-needed inputs
(via notice_as_needed), so copy that code there.
This construct is used in some packages to check for availability
of libraries (e.g. in nvme-cli to check for -luuid). Redircting error
output makes this siletently fail.
Index: binutils-2.35/bfd/elf64-ppc.c
===================================================================
--- binutils-2.35.orig/bfd/elf64-ppc.c 2020-07-24 11:12:19.000000000 +0200
+++ binutils-2.35/bfd/elf64-ppc.c 2020-08-10 17:25:00.205219071 +0200
@@ -5310,11 +5310,17 @@ ppc64_elf_merge_private_bfd_data (bfd *ibfd, struct bfd_link_info *info)
if (iflags & ~EF_PPC64_ABI)
{
- _bfd_error_handler
- /* xgettext:c-format */
- (_("%pB uses unknown e_flags 0x%lx"), ibfd, iflags);
- bfd_set_error (bfd_error_bad_value);
- return false;
+ if (abiversion (info->output_bfd) == 0)
+ set_abiversion (info->output_bfd, abiversion (ibfd));
+ else
+ {
+ _bfd_error_handler
+ /* xgettext:c-format */
+ (_("%pB: ABI version %ld is not compatible with ABI version %ld output"),
+ ibfd, iflags, oflags);
+ bfd_set_error (bfd_error_bad_value);
+ return false;
+ }
}
else if (iflags != oflags && iflags != 0)
{

View File

@ -0,0 +1,25 @@
Also reported as PR25210. There's a problem when using the two
linker options '--fix-cortex-a53-835769 --fix-cortex-a53-843419'
together. This is the default in our distro, but not upstream so
it went unnoticed.
Leads to an error while linking any code that sports one of the
sequences that triggers the errata fixup (gcc being one of those),
namely:
ld: can not size stub section: invalid operation
ld: warning: cannot find entry symbol _start; defaulting to 0000000000400078
ld: linker stubs: file class ELFCLASSNONE incompatible with ELFCLASS64
ld: final link failed: file in wrong format
--- bfd/elfnn-aarch64.c.mm 2019-09-09 13:19:43.000000000 +0000
+++ bfd/elfnn-aarch64.c 2019-11-20 11:44:00.000000000 +0000
@@ -4312,7 +4312,8 @@ elfNN_aarch64_size_stubs (bfd *output_bfd,
|| (input_bfd->flags & BFD_LINKER_CREATED) != 0)
continue;
- if (!_bfd_aarch64_erratum_835769_scan (input_bfd, info,
+ if (input_bfd != stub_bfd
+ && !_bfd_aarch64_erratum_835769_scan (input_bfd, info,
&num_erratum_835769_fixes))
return false;
}

20
binutils-fix-relax.diff Normal file
View File

@ -0,0 +1,20 @@
Fix for bsc#1179341
the movload->movconst relaxation can be done only with REX
rewriting, and hence needs a GOTPCRELX relocation. With old object
files we might still see GOTPCREL relocs, even with REX bytes available.
We still can't do such rewriting and hence need to stay with the old
rewriting into a lea.
diff --git a/bfd/elf64-x86-64.c b/bfd/elf64-x86-64.c
index 549a8be6a6..b89b0023db 100644
--- a/bfd/elf64-x86-64.c
+++ b/bfd/elf64-x86-64.c
@@ -1731,7 +1731,7 @@ elf_x86_64_convert_load_reloc (bfd *abfd,
if (opcode == 0x8b)
{
- if (abs_symbol && local_ref && relocx)
+ if (abs_symbol && local_ref && relocx && rex)
to_reloc_pc32 = false;
if (to_reloc_pc32)

176
binutils-old-makeinfo.diff Normal file
View File

@ -0,0 +1,176 @@
This reverts 8bb23cdbb498ff645bb0937bc8c0cb89e9e5ebd8 which
requires newer makeinfo that we don't have in SLE12.
diff --git a/bfd/doc/bfd.texi b/bfd/doc/bfd.texi
index d8cc1ecca48..f348710845f 100644
--- a/bfd/doc/bfd.texi
+++ b/bfd/doc/bfd.texi
@@ -75,7 +75,7 @@ Copyright @copyright{} 1991-2023 Free Software Foundation, Inc.
@end iftex
@contents
-@node Top
+@node Top, Overview, (dir), (dir)
@ifinfo
This file documents the binary file descriptor library libbfd.
@end ifinfo
@@ -88,7 +88,7 @@ This file documents the binary file descriptor library libbfd.
* BFD Index:: BFD Index
@end menu
-@node Overview
+@node Overview, BFD front end, Top, Top
@chapter Introduction
@cindex BFD
@cindex what is it?
@@ -114,7 +114,7 @@ their own use, for greater efficiency.
* What BFD Version 2 Can Do:: What BFD Version 2 Can Do
@end menu
-@node History
+@node History, How It Works, Overview, Overview
@section History
One spur behind BFD was the desire, on the part of the GNU 960 team at
@@ -137,7 +137,7 @@ and David Henkel-Wallace (@code{gumby@@cygnus.com}).
-@node How It Works
+@node How It Works, What BFD Version 2 Can Do, History, Overview
@section How To Use BFD
To use the library, include @file{bfd.h} and link with @file{libbfd.a}.
@@ -188,11 +188,11 @@ and contain subordinate BFDs. This approach is fine for a.out and coff,
but loses efficiency when applied to formats such as S-records and
IEEE-695.
-@node What BFD Version 2 Can Do
+@node What BFD Version 2 Can Do, , How It Works, Overview
@section What BFD Version 2 Can Do
@include bfdsumm.texi
-@node BFD front end
+@node BFD front end, BFD back ends, Overview, Top
@chapter BFD Front End
@menu
@@ -219,7 +219,7 @@ IEEE-695.
@include bfdt.texi
@include bfdio.texi
-@node Memory Usage
+@node Memory Usage, Sections, Miscellaneous, BFD front end
@section Memory Usage
BFD keeps all of its internal structures in obstacks. There is one obstack
per open BFD file, into which the current state is stored. When a BFD is
@@ -242,46 +242,46 @@ select the greediest open BFD, close it to reclaim the memory, perform
some operation and reopen the BFD again, to get a fresh copy of the data
structures.
-@node Sections
+@node Sections, Symbols, Memory Usage, BFD front end
@include section.texi
-@node Symbols
+@node Symbols, Archives, Sections, BFD front end
@include syms.texi
-@node Archives
+@node Archives, Formats, Symbols, BFD front end
@include archive.texi
-@node Formats
+@node Formats, Relocations, Archives, BFD front end
@include format.texi
-@node Relocations
+@node Relocations, Core Files, Formats, BFD front end
@include reloc.texi
-@node Core Files
+@node Core Files, Targets, Relocations, BFD front end
@include corefile.texi
-@node Targets
+@node Targets, Architectures, Core Files, BFD front end
@include targets.texi
-@node Architectures
+@node Architectures, Opening and Closing, Targets, BFD front end
@include archures.texi
-@node Opening and Closing
+@node Opening and Closing, Internal, Architectures, BFD front end
@include opncls.texi
-@node Internal
+@node Internal, File Caching, Opening and Closing, BFD front end
@include libbfd.texi
-@node File Caching
+@node File Caching, Linker Functions, Internal, BFD front end
@include cache.texi
-@node Linker Functions
+@node Linker Functions, Hash Tables, File Caching, BFD front end
@include linker.texi
-@node Hash Tables
+@node Hash Tables, , Linker Functions, BFD front end
@include hash.texi
-@node BFD back ends
+@node BFD back ends, GNU Free Documentation License, BFD front end, Top
@chapter BFD back ends
@menu
* What to Put Where::
@@ -293,28 +293,28 @@ structures.
* srecord :: s-record backend
@end ignore
@end menu
-@node What to Put Where
+@node What to Put Where, aout, BFD back ends, BFD back ends
@section What to Put Where
All of BFD lives in one directory.
-@node aout
+@node aout, coff, What to Put Where, BFD back ends
@include aoutx.texi
-@node coff
+@node coff, elf, aout, BFD back ends
@include coffcode.texi
-@node elf
+@node elf, mmo, coff, BFD back ends
@include elf.texi
@c Leave this out until the file has some actual contents...
@c @include elfcode.texi
-@node mmo
+@node mmo, , elf, BFD back ends
@include mmo.texi
-@node GNU Free Documentation License
+@node GNU Free Documentation License, BFD Index, BFD back ends, Top
@include fdl.texi
-@node BFD Index
+@node BFD Index, , GNU Free Documentation License, Top
@unnumbered BFD Index
@printindex cp
diff --git a/bfd/doc/webassembly.texi b/bfd/doc/webassembly.texi
index 5a05199d5f7..ad650943a1a 100644
--- a/bfd/doc/webassembly.texi
+++ b/bfd/doc/webassembly.texi
@@ -27,7 +27,7 @@ in some malformed WebAssembly modules being treated as valid.
* File layout::
@end menu
-@node File layout
+@node File layout, WebAssembly
@subsection File layout
For a description of the WebAssembly file format, see
@url{https://github.com/WebAssembly/design/blob/master/BinaryEncoding.md}.

20
binutils-pr22868.diff Normal file
View File

@ -0,0 +1,20 @@
Fixes two testsuite fails in the gold plugin tests of LLVM.
Aka binutils/PR22868
Index: binutils-2.30/gold/resolve.cc
===================================================================
--- binutils-2.30.orig/gold/resolve.cc 2018-01-13 14:31:16.000000000 +0100
+++ binutils-2.30/gold/resolve.cc 2018-03-06 16:58:42.000000000 +0100
@@ -265,10 +265,13 @@ Symbol_table::resolve(Sized_symbol<size>
return;
// Likewise for an absolute symbol defined twice with the same value.
+ // plugin-symbols are always absolute with same value here, so ignore those
if (!is_ordinary
&& st_shndx == elfcpp::SHN_ABS
&& !to_is_ordinary
&& to_shndx == elfcpp::SHN_ABS
+ && object->pluginobj() == NULL
+ && to->object()->pluginobj() == NULL
&& to->value() == sym.get_st_value())
return;

View File

@ -0,0 +1,437 @@
This reverts commit b10b530a4566, because generating 'jgnop'
from 'bcrl' confuses some parsing tools (in particular kernels
recordmcount.pl tool) on s390x.
Due to the way the assembler and disassembler are implemented we need
to disable both, the assembly and disassembly of the problematic
mnemonic (that's only a problem for jgnop vs brcl, but still).
So, just revert the whole commit.
v2: this adjusts the reversion of above commit to care for commit
0cfd6cffde32726ca69cde6ed3cc1ece21b9cf7c that changes the touched
testcases so that it applies again, so it's not a simple revert of
above commit anymore.
(We leave out the patch to ChangeLog in the reversion)
Index: binutils-2.38.50/gas/testsuite/gas/s390/esa-g5.d
===================================================================
--- binutils-2.38.50.orig/gas/testsuite/gas/s390/esa-g5.d 2022-05-13 17:56:05.000000000 +0200
+++ binutils-2.38.50/gas/testsuite/gas/s390/esa-g5.d 2022-05-13 17:56:06.000000000 +0200
@@ -78,14 +78,10 @@ Disassembly of section .text:
.*: 07 29 [ ]*bhr %r9
.*: 07 f9 [ ]*br %r9
.*: a7 95 00 00 [ ]*bras %r9,e2 <foo\+0xe2>
-.*: a7 65 00 00 [ ]*bras %r6,e6 <foo\+0xe6>
-.*: a7 64 00 00 [ ]*jlh ea <foo\+0xea>
-.*: a7 66 00 00 [ ]*brct %r6,ee <foo\+0xee>
-.*: a7 66 00 00 [ ]*brct %r6,f2 <foo\+0xf2>
-.*: 84 69 00 00 [ ]*brxh %r6,%r9,f6 <foo\+0xf6>
-.*: 84 69 00 00 [ ]*brxh %r6,%r9,fa <foo\+0xfa>
-.*: 85 69 00 00 [ ]*brxle %r6,%r9,fe <foo\+0xfe>
-.*: 85 69 00 00 [ ]*brxle %r6,%r9,102 <foo\+0x102>
+.*: a7 64 00 00 [ ]*jlh e6 <foo\+0xe6>
+.*: a7 66 00 00 [ ]*brct %r6,ea <foo\+0xea>
+.*: 84 69 00 00 [ ]*brxh %r6,%r9,ee <foo\+0xee>
+.*: 85 69 00 00 [ ]*brxle %r6,%r9,f2 <foo\+0xf2>
.*: b2 5a 00 69 [ ]*bsa %r6,%r9
.*: b2 58 00 69 [ ]*bsg %r6,%r9
.*: 0b 69 [ ]*bsm %r6,%r9
@@ -184,49 +180,27 @@ Disassembly of section .text:
.*: b2 21 00 69 [ ]*ipte %r6,%r9
.*: b2 29 00 69 [ ]*iske %r6,%r9
.*: b2 23 00 69 [ ]*ivsk %r6,%r9
-.*: a7 f4 00 00 [ ]*j 288 <foo\+0x288>
-.*: a7 84 00 00 [ ]*je 28c <foo\+0x28c>
-.*: a7 24 00 00 [ ]*jh 290 <foo\+0x290>
-.*: a7 a4 00 00 [ ]*jhe 294 <foo\+0x294>
-.*: a7 44 00 00 [ ]*jl 298 <foo\+0x298>
-.*: a7 c4 00 00 [ ]*jle 29c <foo\+0x29c>
-.*: a7 64 00 00 [ ]*jlh 2a0 <foo\+0x2a0>
-.*: a7 44 00 00 [ ]*jl 2a4 <foo\+0x2a4>
-.*: a7 74 00 00 [ ]*jne 2a8 <foo\+0x2a8>
-.*: a7 d4 00 00 [ ]*jnh 2ac <foo\+0x2ac>
-.*: a7 54 00 00 [ ]*jnhe 2b0 <foo\+0x2b0>
-.*: a7 b4 00 00 [ ]*jnl 2b4 <foo\+0x2b4>
-.*: a7 34 00 00 [ ]*jnle 2b8 <foo\+0x2b8>
-.*: a7 94 00 00 [ ]*jnlh 2bc <foo\+0x2bc>
-.*: a7 b4 00 00 [ ]*jnl 2c0 <foo\+0x2c0>
-.*: a7 e4 00 00 [ ]*jno 2c4 <foo\+0x2c4>
-.*: a7 d4 00 00 [ ]*jnh 2c8 <foo\+0x2c8>
-.*: a7 74 00 00 [ ]*jne 2cc <foo\+0x2cc>
-.*: a7 14 00 00 [ ]*jo 2d0 <foo\+0x2d0>
-.*: a7 24 00 00 [ ]*jh 2d4 <foo\+0x2d4>
-.*: a7 84 00 00 [ ]*je 2d8 <foo\+0x2d8>
-.*: a7 04 00 00 [ ]*jnop 2dc <foo\+0x2dc>
-.*: a7 14 00 00 [ ]*jo 2e0 <foo\+0x2e0>
-.*: a7 24 00 00 [ ]*jh 2e4 <foo\+0x2e4>
-.*: a7 24 00 00 [ ]*jh 2e8 <foo\+0x2e8>
-.*: a7 34 00 00 [ ]*jnle 2ec <foo\+0x2ec>
-.*: a7 44 00 00 [ ]*jl 2f0 <foo\+0x2f0>
-.*: a7 44 00 00 [ ]*jl 2f4 <foo\+0x2f4>
-.*: a7 54 00 00 [ ]*jnhe 2f8 <foo\+0x2f8>
-.*: a7 64 00 00 [ ]*jlh 2fc <foo\+0x2fc>
-.*: a7 74 00 00 [ ]*jne 300 <foo\+0x300>
-.*: a7 74 00 00 [ ]*jne 304 <foo\+0x304>
-.*: a7 84 00 00 [ ]*je 308 <foo\+0x308>
-.*: a7 84 00 00 [ ]*je 30c <foo\+0x30c>
-.*: a7 94 00 00 [ ]*jnlh 310 <foo\+0x310>
-.*: a7 a4 00 00 [ ]*jhe 314 <foo\+0x314>
-.*: a7 b4 00 00 [ ]*jnl 318 <foo\+0x318>
-.*: a7 b4 00 00 [ ]*jnl 31c <foo\+0x31c>
-.*: a7 c4 00 00 [ ]*jle 320 <foo\+0x320>
-.*: a7 d4 00 00 [ ]*jnh 324 <foo\+0x324>
-.*: a7 d4 00 00 [ ]*jnh 328 <foo\+0x328>
-.*: a7 e4 00 00 [ ]*jno 32c <foo\+0x32c>
-.*: a7 f4 00 00 [ ]*j 330 <foo\+0x330>
+.*: a7 f4 00 00 [ ]*j 278 <foo\+0x278>
+.*: a7 84 00 00 [ ]*je 27c <foo\+0x27c>
+.*: a7 24 00 00 [ ]*jh 280 <foo\+0x280>
+.*: a7 a4 00 00 [ ]*jhe 284 <foo\+0x284>
+.*: a7 44 00 00 [ ]*jl 288 <foo\+0x288>
+.*: a7 c4 00 00 [ ]*jle 28c <foo\+0x28c>
+.*: a7 64 00 00 [ ]*jlh 290 <foo\+0x290>
+.*: a7 44 00 00 [ ]*jl 294 <foo\+0x294>
+.*: a7 74 00 00 [ ]*jne 298 <foo\+0x298>
+.*: a7 d4 00 00 [ ]*jnh 29c <foo\+0x29c>
+.*: a7 54 00 00 [ ]*jnhe 2a0 <foo\+0x2a0>
+.*: a7 b4 00 00 [ ]*jnl 2a4 <foo\+0x2a4>
+.*: a7 34 00 00 [ ]*jnle 2a8 <foo\+0x2a8>
+.*: a7 94 00 00 [ ]*jnlh 2ac <foo\+0x2ac>
+.*: a7 b4 00 00 [ ]*jnl 2b0 <foo\+0x2b0>
+.*: a7 e4 00 00 [ ]*jno 2b4 <foo\+0x2b4>
+.*: a7 d4 00 00 [ ]*jnh 2b8 <foo\+0x2b8>
+.*: a7 74 00 00 [ ]*jne 2bc <foo\+0x2bc>
+.*: a7 14 00 00 [ ]*jo 2c0 <foo\+0x2c0>
+.*: a7 24 00 00 [ ]*jh 2c4 <foo\+0x2c4>
+.*: a7 84 00 00 [ ]*je 2c8 <foo\+0x2c8>
.*: ed 65 af ff 00 18 [ ]*kdb %f6,4095\(%r5,%r10\)
.*: b3 18 00 69 [ ]*kdbr %f6,%f9
.*: ed 65 af ff 00 08 [ ]*keb %f6,4095\(%r5,%r10\)
@@ -509,4 +483,4 @@ Disassembly of section .text:
.*: f8 58 5f ff af ff [ ]*zap 4095\(6,%r5\),4095\(9,%r10\)
.*: b2 21 b0 69 [ ]*ipte %r6,%r9,%r11
.*: b2 21 bd 69 [ ]*ipte %r6,%r9,%r11,13
-.*: 07 07 [ ]*nopr %r7
+.*: 07 07 [ ]*nopr %r7
Index: binutils-2.38.50/gas/testsuite/gas/s390/esa-g5.s
===================================================================
--- binutils-2.38.50.orig/gas/testsuite/gas/s390/esa-g5.s 2022-05-13 17:56:05.000000000 +0200
+++ binutils-2.38.50/gas/testsuite/gas/s390/esa-g5.s 2022-05-13 17:56:06.000000000 +0200
@@ -72,14 +72,10 @@ foo:
bpr %r9
br %r9
bras %r9,.
- jas %r6,.
brc 6,.
brct 6,.
- jct %r6,.
brxh %r6,%r9,.
- jxh %r6,%r9,.
brxle %r6,%r9,.
- jxle %r6,%r9,.
bsa %r6,%r9
bsg %r6,%r9
bsm %r6,%r9
@@ -199,28 +195,6 @@ foo:
jo .
jp .
jz .
- jnop .
- bro .
- brh .
- brp .
- brnle .
- brl .
- brm .
- brnhe .
- brlh .
- brne .
- brnz .
- bre .
- brz .
- brnlh .
- brhe .
- brnl .
- brnm .
- brle .
- brnh .
- brnp .
- brno .
- bru .
kdb %f6,4095(%r5,%r10)
kdbr %f6,%f9
keb %f6,4095(%r5,%r10)
Index: binutils-2.38.50/gas/testsuite/gas/s390/esa-z900.d
===================================================================
--- binutils-2.38.50.orig/gas/testsuite/gas/s390/esa-z900.d 2022-05-13 17:56:05.000000000 +0200
+++ binutils-2.38.50/gas/testsuite/gas/s390/esa-z900.d 2022-05-13 18:07:33.000000000 +0200
@@ -6,56 +6,31 @@
Disassembly of section .text:
.* <foo>:
-.*: c0 f4 00 00 00 00 [ ]*jg 0 <foo>
-.*: c0 04 00 00 00 00 [ ]*jgnop 6 <foo\+0x6>
-.*: c0 14 00 00 00 00 [ ]*jgo c <foo\+0xc>
-.*: c0 24 00 00 00 00 [ ]*jgh 12 <foo\+0x12>
-.*: c0 24 00 00 00 00 [ ]*jgh 18 <foo\+0x18>
-.*: c0 34 00 00 00 00 [ ]*jgnle 1e <foo\+0x1e>
-.*: c0 44 00 00 00 00 [ ]*jgl 24 <foo\+0x24>
-.*: c0 44 00 00 00 00 [ ]*jgl 2a <foo\+0x2a>
-.*: c0 54 00 00 00 00 [ ]*jgnhe 30 <foo\+0x30>
-.*: c0 64 00 00 00 00 [ ]*jglh 36 <foo\+0x36>
-.*: c0 74 00 00 00 00 [ ]*jgne 3c <foo\+0x3c>
-.*: c0 74 00 00 00 00 [ ]*jgne 42 <foo\+0x42>
-.*: c0 84 00 00 00 00 [ ]*jge 48 <foo\+0x48>
-.*: c0 84 00 00 00 00 [ ]*jge 4e <foo\+0x4e>
-.*: c0 94 00 00 00 00 [ ]*jgnlh 54 <foo\+0x54>
-.*: c0 a4 00 00 00 00 [ ]*jghe 5a <foo\+0x5a>
-.*: c0 b4 00 00 00 00 [ ]*jgnl 60 <foo\+0x60>
-.*: c0 b4 00 00 00 00 [ ]*jgnl 66 <foo\+0x66>
-.*: c0 c4 00 00 00 00 [ ]*jgle 6c <foo\+0x6c>
-.*: c0 d4 00 00 00 00 [ ]*jgnh 72 <foo\+0x72>
-.*: c0 d4 00 00 00 00 [ ]*jgnh 78 <foo\+0x78>
-.*: c0 e4 00 00 00 00 [ ]*jgno 7e <foo\+0x7e>
-.*: c0 f4 00 00 00 00 [ ]*jg 84 <foo\+0x84>
-.*: c0 14 00 00 00 00 [ ]*jgo 8a <foo\+0x8a>
-.*: c0 24 00 00 00 00 [ ]*jgh 90 <foo\+0x90>
-.*: c0 24 00 00 00 00 [ ]*jgh 96 <foo\+0x96>
-.*: c0 34 00 00 00 00 [ ]*jgnle 9c <foo\+0x9c>
-.*: c0 44 00 00 00 00 [ ]*jgl a2 <foo\+0xa2>
-.*: c0 44 00 00 00 00 [ ]*jgl a8 <foo\+0xa8>
-.*: c0 54 00 00 00 00 [ ]*jgnhe ae <foo\+0xae>
-.*: c0 64 00 00 00 00 [ ]*jglh b4 <foo\+0xb4>
-.*: c0 74 00 00 00 00 [ ]*jgne ba <foo\+0xba>
-.*: c0 74 00 00 00 00 [ ]*jgne c0 <foo\+0xc0>
-.*: c0 84 00 00 00 00 [ ]*jge c6 <foo\+0xc6>
-.*: c0 84 00 00 00 00 [ ]*jge cc <foo\+0xcc>
-.*: c0 94 00 00 00 00 [ ]*jgnlh d2 <foo\+0xd2>
-.*: c0 a4 00 00 00 00 [ ]*jghe d8 <foo\+0xd8>
-.*: c0 b4 00 00 00 00 [ ]*jgnl de <foo\+0xde>
-.*: c0 b4 00 00 00 00 [ ]*jgnl e4 <foo\+0xe4>
-.*: c0 c4 00 00 00 00 [ ]*jgle ea <foo\+0xea>
-.*: c0 d4 00 00 00 00 [ ]*jgnh f0 <foo\+0xf0>
-.*: c0 d4 00 00 00 00 [ ]*jgnh f6 <foo\+0xf6>
-.*: c0 e4 00 00 00 00 [ ]*jgno fc <foo\+0xfc>
-.*: c0 f4 00 00 00 00 [ ]*jg 102 <foo\+0x102>
-.*: c0 65 00 00 00 00 [ ]*brasl %r6,108 <foo\+0x108>
-.*: c0 65 00 00 00 00 [ ]*brasl %r6,10e <foo\+0x10e>
-.*: c0 65 80 00 00 00 [ ]*brasl %r6,114 <foo\+0x114>
-.*: c0 65 80 00 00 00 [ ]*brasl %r6,11a <foo\+0x11a>
-.*: c0 65 7f ff ff ff [ ]*brasl %r6,11e <foo\+0x11e>
-.*: c0 65 7f ff ff ff [ ]*brasl %r6,124 <foo\+0x124>
+.*: c0 f4 00 00 00 00 [ ]*jg 0 \<foo\>
+.*: c0 14 00 00 00 00 [ ]*jgo 6 \<foo\+0x6>
+.*: c0 24 00 00 00 00 [ ]*jgh c \<foo\+0xc>
+.*: c0 24 00 00 00 00 [ ]*jgh 12 \<foo\+0x12>
+.*: c0 34 00 00 00 00 [ ]*jgnle 18 \<foo\+0x18>
+.*: c0 44 00 00 00 00 [ ]*jgl 1e \<foo\+0x1e>
+.*: c0 44 00 00 00 00 [ ]*jgl 24 \<foo\+0x24>
+.*: c0 54 00 00 00 00 [ ]*jgnhe 2a \<foo\+0x2a>
+.*: c0 64 00 00 00 00 [ ]*jglh 30 \<foo\+0x30>
+.*: c0 74 00 00 00 00 [ ]*jgne 36 \<foo\+0x36>
+.*: c0 74 00 00 00 00 [ ]*jgne 3c \<foo\+0x3c>
+.*: c0 84 00 00 00 00 [ ]*jge 42 \<foo\+0x42>
+.*: c0 84 00 00 00 00 [ ]*jge 48 \<foo\+0x48>
+.*: c0 94 00 00 00 00 [ ]*jgnlh 4e \<foo\+0x4e>
+.*: c0 a4 00 00 00 00 [ ]*jghe 54 \<foo\+0x54>
+.*: c0 b4 00 00 00 00 [ ]*jgnl 5a \<foo\+0x5a>
+.*: c0 b4 00 00 00 00 [ ]*jgnl 60 \<foo\+0x60>
+.*: c0 c4 00 00 00 00 [ ]*jgle 66 \<foo\+0x66>
+.*: c0 d4 00 00 00 00 [ ]*jgnh 6c \<foo\+0x6c>
+.*: c0 d4 00 00 00 00 [ ]*jgnh 72 \<foo\+0x72>
+.*: c0 e4 00 00 00 00 [ ]*jgno 78 \<foo\+0x78>
+.*: c0 f4 00 00 00 00 [ ]*jg 7e \<foo\+0x7e>
+.*: c0 65 00 00 00 00 [ ]*brasl %r6,84 \<foo\+0x84>
+.*: c0 65 80 00 00 00 [ ]*brasl %r6,8a <foo\+0x8a>
+.*: c0 65 7f ff ff ff [ ]*brasl %r6,8e <foo\+0x8e>
.*: 01 0b [ ]*tam
.*: 01 0c [ ]*sam24
.*: 01 0d [ ]*sam31
@@ -66,7 +41,7 @@ Disassembly of section .text:
.*: b9 97 00 69 [ ]*dlr %r6,%r9
.*: b9 98 00 69 [ ]*alcr %r6,%r9
.*: b9 99 00 69 [ ]*slbr %r6,%r9
-.*: c0 60 00 00 00 00 [ ]*larl %r6,14e <foo\+0x14e>
+.*: c0 60 00 00 00 00 [ ]*larl %r6,b8 <foo\+0xb8>
.*: e3 65 af ff 00 1e [ ]*lrv %r6,4095\(%r5,%r10\)
.*: e3 65 af ff 00 1f [ ]*lrvh %r6,4095\(%r5,%r10\)
.*: e3 65 af ff 00 3e [ ]*strv %r6,4095\(%r5,%r10\)
@@ -76,4 +51,3 @@ Disassembly of section .text:
.*: e3 65 af ff 00 98 [ ]*alc %r6,4095\(%r5,%r10\)
.*: e3 65 af ff 00 99 [ ]*slb %r6,4095\(%r5,%r10\)
.*: eb 69 5f ff 00 1d [ ]*rll %r6,%r9,4095\(%r5\)
-.*: 07 07 [ ]*nopr %r7
Index: binutils-2.38.50/gas/testsuite/gas/s390/esa-z900.s
===================================================================
--- binutils-2.38.50.orig/gas/testsuite/gas/s390/esa-z900.s 2022-05-13 17:56:05.000000000 +0200
+++ binutils-2.38.50/gas/testsuite/gas/s390/esa-z900.s 2022-05-13 17:57:59.000000000 +0200
@@ -1,7 +1,6 @@
.text
foo:
brcl 15,.
- jgnop .
jgo .
jgh .
jgp .
@@ -23,33 +22,9 @@ foo:
jgnp .
jgno .
jg .
- brol .
- brhl .
- brpl .
- brnlel .
- brll .
- brml .
- brnhel .
- brlhl .
- brnel .
- brnzl .
- brel .
- brzl .
- brnlhl .
- brhel .
- brnll .
- brnml .
- brlel .
- brnhl .
- brnpl .
- brnol .
- brul .
brasl %r6,.
- jasl %r6,.
brasl %r6,.-0x100000000
- jasl %r6,.-0x100000000
brasl %r6,.+0xfffffffe
- jasl %r6,.+0xfffffffe
tam
sam24
sam31
Index: binutils-2.38.50/gas/testsuite/gas/s390/zarch-z900.d
===================================================================
--- binutils-2.38.50.orig/gas/testsuite/gas/s390/zarch-z900.d 2022-05-13 17:56:05.000000000 +0200
+++ binutils-2.38.50/gas/testsuite/gas/s390/zarch-z900.d 2022-05-13 17:56:06.000000000 +0200
@@ -20,11 +20,8 @@ Disassembly of section .text:
.*: e3 95 af ff 00 46 [ ]*bctg %r9,4095\(%r5,%r10\)
.*: b9 46 00 96 [ ]*bctgr %r9,%r6
.*: a7 97 00 00 [ ]*brctg %r9,40 \<foo\+0x40\>
-.*: a7 67 00 00 [ ]*brctg %r6,44 <foo\+0x44>
-.*: ec 96 00 00 00 44 [ ]*brxhg %r9,%r6,48 <foo\+0x48>
-.*: ec 69 00 00 00 44 [ ]*brxhg %r6,%r9,4e <foo\+0x4e>
-.*: ec 96 00 00 00 45 [ ]*brxlg %r9,%r6,54 <foo\+0x54>
-.*: ec 69 00 00 00 45 [ ]*brxlg %r6,%r9,5a <foo\+0x5a>
+.*: ec 96 00 00 00 44 [ ]*brxhg %r9,%r6,44 <foo\+0x44>
+.*: ec 96 00 00 00 45 [ ]*brxlg %r9,%r6,4a <foo\+0x4a>
.*: eb 96 5f ff 00 44 [ ]*bxhg %r9,%r6,4095\(%r5\)
.*: eb 96 5f ff 00 45 [ ]*bxleg %r9,%r6,4095\(%r5\)
.*: b3 a5 00 96 [ ]*cdgbr %f9,%r6
Index: binutils-2.38.50/gas/testsuite/gas/s390/zarch-z900.s
===================================================================
--- binutils-2.38.50.orig/gas/testsuite/gas/s390/zarch-z900.s 2022-05-13 17:56:05.000000000 +0200
+++ binutils-2.38.50/gas/testsuite/gas/s390/zarch-z900.s 2022-05-13 17:56:06.000000000 +0200
@@ -14,11 +14,8 @@ foo:
bctg %r9,4095(%r5,%r10)
bctgr %r9,%r6
brctg %r9,.
- jctg %r6,.
brxhg %r9,%r6,.
- jxhg %r6,%r9,.
brxlg %r9,%r6,.
- jxleg %r6,%r9,.
bxhg %r9,%r6,4095(%r5)
bxleg %r9,%r6,4095(%r5)
cdgbr %f9,%r6
Index: binutils-2.38.50/ld/testsuite/ld-s390/tlsbin_64.dd
===================================================================
--- binutils-2.38.50.orig/ld/testsuite/ld-s390/tlsbin_64.dd 2022-05-13 17:56:05.000000000 +0200
+++ binutils-2.38.50/ld/testsuite/ld-s390/tlsbin_64.dd 2022-05-13 17:56:06.000000000 +0200
@@ -87,26 +87,26 @@ Disassembly of section .text:
+[0-9a-f]+: 41 22 90 00 la %r2,0\(%r2,%r9\)
# GD -> LE with global variable defined in executable
+[0-9a-f]+: e3 20 d0 10 00 04 lg %r2,16\(%r13\)
- +[0-9a-f]+: c0 04 00 00 00 00 jgnop [0-9a-f]+ <fn2\+0xca>
+ +[0-9a-f]+: c0 04 00 00 00 00 brcl 0,[0-9a-f]+ <fn2\+0xca>
+[0-9a-f]+: 41 22 90 00 la %r2,0\(%r2,%r9\)
# GD -> LE with local variable defined in executable
+[0-9a-f]+: e3 20 d0 18 00 04 lg %r2,24\(%r13\)
- +[0-9a-f]+: c0 04 00 00 00 00 jgnop [0-9a-f]+ <fn2\+0xda>
+ +[0-9a-f]+: c0 04 00 00 00 00 brcl 0,[0-9a-f]+ <fn2\+0xda>
+[0-9a-f]+: 41 22 90 00 la %r2,0\(%r2,%r9\)
# GD -> LE with hidden variable defined in executable
+[0-9a-f]+: e3 20 d0 20 00 04 lg %r2,32\(%r13\)
- +[0-9a-f]+: c0 04 00 00 00 00 jgnop [0-9a-f]+ <fn2\+0xea>
+ +[0-9a-f]+: c0 04 00 00 00 00 brcl 0,[0-9a-f]+ <fn2\+0xea>
+[0-9a-f]+: 41 22 90 00 la %r2,0\(%r2,%r9\)
# LD -> LE
+[0-9a-f]+: e3 20 d0 28 00 04 lg %r2,40\(%r13\)
- +[0-9a-f]+: c0 04 00 00 00 00 jgnop [0-9a-f]+ <fn2\+0xfa>
+ +[0-9a-f]+: c0 04 00 00 00 00 brcl 0,[0-9a-f]+ <fn2\+0xfa>
+[0-9a-f]+: 41 32 90 00 la %r3,0\(%r2,%r9\)
+[0-9a-f]+: e3 40 d0 30 00 04 lg %r4,48\(%r13\)
+[0-9a-f]+: 41 54 30 00 la %r5,0\(%r4,%r3\)
+[0-9a-f]+: e3 40 d0 38 00 04 lg %r4,56\(%r13\)
+[0-9a-f]+: 41 54 30 00 la %r5,0\(%r4,%r3\)
+[0-9a-f]+: e3 20 d0 40 00 04 lg %r2,64\(%r13\)
- +[0-9a-f]+: c0 04 00 00 00 00 jgnop [0-9a-f]+ <fn2\+0x11e>
+ +[0-9a-f]+: c0 04 00 00 00 00 brcl 0,[0-9a-f]+ <fn2\+0x11e>
+[0-9a-f]+: 41 32 90 00 la %r3,0\(%r2,%r9\)
+[0-9a-f]+: e3 40 d0 48 00 04 lg %r4,72\(%r13\)
+[0-9a-f]+: 41 54 30 00 la %r5,0\(%r4,%r3\)
Index: binutils-2.38.50/opcodes/s390-opc.txt
===================================================================
--- binutils-2.38.50.orig/opcodes/s390-opc.txt 2022-05-13 17:56:05.000000000 +0200
+++ binutils-2.38.50/opcodes/s390-opc.txt 2022-05-13 17:56:06.000000000 +0200
@@ -246,14 +246,10 @@ d7 xc SS_L0RDRD "exclusive OR" g5 esa,za
f8 zap SS_LLRDRD "zero and add" g5 esa,zarch
a70a ahi RI_RI "add halfword immediate" g5 esa,zarch
84 brxh RSI_RRP "branch relative on index high" g5 esa,zarch
-84 jxh RSI_RRP "branch relative on index high" g5 esa,zarch
85 brxle RSI_RRP "branch relative on index low or equal" g5 esa,zarch
-85 jxle RSI_RRP "branch relative on index low or equal" g5 esa,zarch
a705 bras RI_RP "branch relative and save" g5 esa,zarch
-a705 jas RI_RP "branch relative and save" g5 esa,zarch
a704 brc RI_UP "branch relative on condition" g5 esa,zarch
a706 brct RI_RP "branch relative on count" g5 esa,zarch
-a706 jct RI_RP "branch relative on count" g5 esa,zarch
b241 cksm RRE_RR "checksum" g5 esa,zarch
a70e chi RI_RI "compare halfword immediate" g5 esa,zarch
a9 clcle RS_RRRD "compare logical long extended" g5 esa,zarch
@@ -272,11 +268,8 @@ a701 tml RI_RU "test under mask low" g5
4700 nop RX_0RRD "no operation" g5 esa,zarch optparm
4700 b*8 RX_0RRD "conditional branch" g5 esa,zarch
47f0 b RX_0RRD "unconditional branch" g5 esa,zarch
-a704 jnop RI_0P "nop jump" g5 esa,zarch
a704 j*8 RI_0P "conditional jump" g5 esa,zarch
-a704 br*8 RI_0P "conditional jump" g5 esa,zarch
a7f4 j RI_0P "unconditional jump" g5 esa,zarch
-a7f4 bru RI_0P "unconditional jump" g5 esa,zarch
b34a axbr RRE_FEFE "add extended bfp" g5 esa,zarch
b31a adbr RRE_FF "add long bfp" g5 esa,zarch
ed000000001a adb RXE_FRRD "add long bfp" g5 esa,zarch
@@ -444,9 +437,7 @@ e3000000001b slgf RXE_RRRD "subtract log
e3000000000c msg RXE_RRRD "multiply single 64" z900 zarch
e3000000001c msgf RXE_RRRD "multiply single 64<32" z900 zarch
ec0000000044 brxhg RIE_RRP "branch relative on index high 64" z900 zarch
-ec0000000044 jxhg RIE_RRP "branch relative on index high 64" z900 zarch
ec0000000045 brxlg RIE_RRP "branch relative on index low or equal 64" z900 zarch
-ec0000000045 jxleg RIE_RRP "branch relative on index low or equal 64" z900 zarch
eb0000000044 bxhg RSE_RRRD "branch on index high 64" z900 zarch
eb0000000045 bxleg RSE_RRRD "branch on index low or equal 64" z900 zarch
eb000000000c srlg RSE_RRRD "shift right single logical 64" z900 zarch
@@ -471,15 +462,10 @@ eb0000000080 icmh RSE_RURD "insert chara
a702 tmhh RI_RU "test under mask high high" z900 zarch
a703 tmhl RI_RU "test under mask high low" z900 zarch
c004 brcl RIL_UP "branch relative on condition long" z900 esa,zarch
-c004 jgnop RIL_0P "nop jump long" z900 esa,zarch
c004 jg*8 RIL_0P "conditional jump long" z900 esa,zarch
-c004 br*8l RIL_0P "conditional jump long" z900 esa,zarch
c0f4 jg RIL_0P "unconditional jump long" z900 esa,zarch
-c0f4 brul RIL_0P "unconditional jump long" z900 esa,zarch
c005 brasl RIL_RP "branch relative and save long" z900 esa,zarch
-c005 jasl RIL_RP "branch relative and save long" z900 esa,zarch
a707 brctg RI_RP "branch relative on count 64" z900 zarch
-a707 jctg RI_RP "branch relative on count 64" z900 zarch
a709 lghi RI_RI "load halfword immediate 64" z900 zarch
a70b aghi RI_RI "add halfword immediate 64" z900 zarch
a70d mghi RI_RI "multiply halfword immediate 64" z900 zarch

View File

@ -0,0 +1,34 @@
Some packages of ours rely on the output of nm to not contain
symversions. E.g. perf uses 'nm -D' to construct a linker input
file with symbol names. ld errors on the '@' characters. Until
those packages are fixed we use this patch. We have to carry it
for old code streams forever.
diff --git a/binutils/nm.c b/binutils/nm.c
index 2637756c647..253714ef179 100644
--- a/binutils/nm.c
+++ b/binutils/nm.c
@@ -666,7 +666,7 @@ print_symname (const char *form, struct extended_symbol_info *info,
name = convert_utf8 (name);
}
- if (info != NULL && info->elfinfo && with_symbol_versions)
+ if (info != NULL && info->elfinfo && with_symbol_versions && 0)
{
const char *version_string;
bool hidden;
diff --git a/ld/testsuite/ld-elf/pr25708.d b/ld/testsuite/ld-elf/pr25708.d
index 60b8e31807a..1b62e25347e 100644
--- a/ld/testsuite/ld-elf/pr25708.d
+++ b/ld/testsuite/ld-elf/pr25708.d
@@ -2,8 +2,9 @@
#ld: -shared -version-script pr13195.t
#nm: -D --with-symbol-versions
#target: *-*-linux* *-*-gnu* arm*-*-uclinuxfdpiceabi
-#xfail: hppa64-*-* ![check_shared_lib_support]
+#xfail: *-*-* ![check_shared_lib_support]
# h8300 doesn't support -shared, and hppa64 creates .foo
+# our binutils revert the printing of symversions with nm -D
#..
0+ A VERS_2.0

View File

@ -0,0 +1,578 @@
This reverts the below commit to not generate PLT32 relocs
on branches by default. Used for old distros to not have to
update several packages/tools that can't handle them. I.e.
a compatibility patch.
The patch isn't exactly the reverse of commit bd7ab16b
because commit 83924b38 later moved the checking code
around somewhat.
The changes in nop-[345].d and pr22842b.S are followups to
not break the testsuite because of this revert.
As are the changes to x86-64-branch-2.d and x86-64-branch-3.d.
commit bd7ab16b4537788ad53521c45469a1bdae84ad4a
Author: H.J. Lu <hjl.tools@gmail.com>
Date: Tue Feb 13 07:34:22 2018 -0800
x86-64: Generate branch with PLT32 relocation
Since there is no need to prepare for PLT branch on x86-64, generate
R_X86_64_PLT32, instead of R_X86_64_PC32, if possible, which can be
used as a marker for 32-bit PC-relative branches.
To compile Linux kernel, this patch:
From: "H.J. Lu" <hjl.tools@gmail.com>
Subject: [PATCH] x86: Treat R_X86_64_PLT32 as R_X86_64_PC32
On i386, there are 2 types of PLTs, PIC and non-PIC. PIE and shared
objects must use PIC PLT. To use PIC PLT, you need to load
_GLOBAL_OFFSET_TABLE_ into EBX first. There is no need for that on
x86-64 since x86-64 uses PC-relative PLT.
On x86-64, for 32-bit PC-relative branches, we can generate PLT32
relocation, instead of PC32 relocation, which can also be used as
a marker for 32-bit PC-relative branches. Linker can always reduce
PLT32 relocation to PC32 if function is defined locally. Local
functions should use PC32 relocation. As far as Linux kernel is
concerned, R_X86_64_PLT32 can be treated the same as R_X86_64_PC32
since Linux kernel doesn't use PLT.
is needed. It is available on hjl/plt32/master branch at
https://github.com/hjl-tools/linux
bfd/
PR gas/22791
* elf64-x86-64.c (is_32bit_relative_branch): Removed.
(elf_x86_64_relocate_section): Check PIC relocations in PIE.
Remove is_32bit_relative_branch usage. Disallow PC32 reloc
against protected function in shared object.
gas/
PR gas/22791
* config/tc-i386.c (need_plt32_p): New function.
(output_jump): Generate BFD_RELOC_X86_64_PLT32 if possible.
(md_estimate_size_before_relax): Likewise.
* testsuite/gas/i386/reloc64.d: Updated.
* testsuite/gas/i386/x86-64-jump.d: Likewise.
* testsuite/gas/i386/x86-64-mpx-branch-1.d: Likewise.
* testsuite/gas/i386/x86-64-mpx-branch-2.d: Likewise.
* testsuite/gas/i386/x86-64-relax-2.d: Likewise.
* testsuite/gas/i386/x86-64-relax-3.d: Likewise.
* testsuite/gas/i386/ilp32/reloc64.d: Likewise.
* testsuite/gas/i386/ilp32/x86-64-branch.d: Likewise.
ld/
PR gas/22791
* testsuite/ld-x86-64/mpx1c.rd: Updated.
* testsuite/ld-x86-64/pr22791-1.err: New file.
* testsuite/ld-x86-64/pr22791-1a.c: Likewise.
* testsuite/ld-x86-64/pr22791-1b.s: Likewise.
* testsuite/ld-x86-64/pr22791-2.rd: Likewise.
* testsuite/ld-x86-64/pr22791-2a.s: Likewise.
* testsuite/ld-x86-64/pr22791-2b.c: Likewise.
* testsuite/ld-x86-64/pr22791-2c.s: Likewise.
* testsuite/ld-x86-64/x86-64.exp: Run PR ld/22791 tests.
diff --git a/bfd/elf64-x86-64.c b/bfd/elf64-x86-64.c
index dc416a7f..b9f96729 100644
--- a/bfd/elf64-x86-64.c
+++ b/bfd/elf64-x86-64.c
@@ -1817,6 +1817,24 @@ elf_x86_64_convert_load_reloc (bfd *abfd,
return true;
}
+/* Is the instruction before OFFSET in CONTENTS a 32bit relative
+ branch? */
+
+static bool
+is_32bit_relative_branch (bfd_byte *contents, bfd_vma offset)
+{
+ /* Opcode Instruction
+ 0xe8 call
+ 0xe9 jump
+ 0x0f 0x8x conditional jump */
+ return ((offset > 0
+ && (contents [offset - 1] == 0xe8
+ || contents [offset - 1] == 0xe9))
+ || (offset > 1
+ && contents [offset - 2] == 0x0f
+ && (contents [offset - 1] & 0xf0) == 0x80));
+}
+
/* Look through the relocs for a section during the first phase, and
calculate needed space in the global offset table, and procedure
linkage table. */
@@ -3159,9 +3177,6 @@ elf_x86_64_relocate_section (bfd *output_bfd,
&& (eh == NULL
|| !UNDEFINED_WEAK_RESOLVED_TO_ZERO (info,
eh)))
- || (bfd_link_pie (info)
- && !SYMBOL_DEFINED_NON_SHARED_P (h)
- && h->def_dynamic)
|| (no_copyreloc_p
&& h->def_dynamic
&& !(h->root.u.def.section->flags & SEC_CODE))))
@@ -3170,20 +3185,25 @@ elf_x86_64_relocate_section (bfd *output_bfd,
|| bfd_link_dll (info)))
{
bool fail = false;
+ bool branch
+ = ((r_type == R_X86_64_PC32
+ || r_type == R_X86_64_PC32_BND)
+ && is_32bit_relative_branch (contents, rel->r_offset));
+
if (SYMBOL_REFERENCES_LOCAL_P (info, h))
{
/* Symbol is referenced locally. Make sure it is
- defined locally. */
- fail = !SYMBOL_DEFINED_NON_SHARED_P (h);
+ defined locally or for a branch. */
+ fail = !SYMBOL_DEFINED_NON_SHARED_P (h) && !branch;
}
else if (bfd_link_pie (info))
{
/* We can only use PC-relative relocations in PIE
- from non-code sections. */
+ from non-code sections or branches. */
if (h->root.type == bfd_link_hash_undefweak
|| (h->type == STT_FUNC
&& (sec->flags & SEC_CODE) != 0))
- fail = true;
+ fail = !branch;
}
else if (no_copyreloc_p || bfd_link_dll (info))
{
@@ -3192,9 +3212,10 @@ elf_x86_64_relocate_section (bfd *output_bfd,
relocations against default and protected
symbols since address of protected function
and location of protected data may not be in
- the shared object. */
+ the shared object. We do allow branch to symbol
+ with non-default visibility. */
fail = (ELF_ST_VISIBILITY (h->other) == STV_DEFAULT
- || ELF_ST_VISIBILITY (h->other) == STV_PROTECTED);
+ || !branch);
}
if (fail)
diff --git a/gas/config/tc-i386.c b/gas/config/tc-i386.c
index d3441988e34..8f8fb086cd8 100644
--- a/gas/config/tc-i386.c
+++ b/gas/config/tc-i386.c
@@ -8793,55 +8793,12 @@ output_branch (void)
frag_var (rs_machine_dependent, 5, i.reloc[0], subtype, sym, off, p);
}
-#if defined (OBJ_ELF) || defined (OBJ_MAYBE_ELF)
-/* Return TRUE iff PLT32 relocation should be used for branching to
- symbol S. */
-
-static bool
-need_plt32_p (symbolS *s)
-{
- /* PLT32 relocation is ELF only. */
- if (!IS_ELF)
- return false;
-
-#ifdef TE_SOLARIS
- /* Don't emit PLT32 relocation on Solaris: neither native linker nor
- krtld support it. */
- return false;
-#endif
-
- /* Since there is no need to prepare for PLT branch on x86-64, we
- can generate R_X86_64_PLT32, instead of R_X86_64_PC32, which can
- be used as a marker for 32-bit PC-relative branches. */
- if (!object_64bit)
- return false;
-
- if (s == NULL)
- return false;
-
- /* Weak or undefined symbol need PLT32 relocation. */
- if (S_IS_WEAK (s) || !S_IS_DEFINED (s))
- return true;
-
- /* Non-global symbol doesn't need PLT32 relocation. */
- if (! S_IS_EXTERNAL (s))
- return false;
-
- /* Other global symbols need PLT32 relocation. NB: Symbol with
- non-default visibilities are treated as normal global symbol
- so that PLT32 relocation can be used as a marker for 32-bit
- PC-relative branches. It is useful for linker relaxation. */
- return true;
-}
-#endif
-
static void
output_jump (void)
{
char *p;
int size;
fixS *fixP;
- bfd_reloc_code_real_type jump_reloc = i.reloc[0];
if (i.tm.opcode_modifier.jump == JUMP_BYTE)
{
@@ -8990,17 +8947,8 @@ output_jump (void)
abort ();
}
-#if defined (OBJ_ELF) || defined (OBJ_MAYBE_ELF)
- if (flag_code == CODE_64BIT && size == 4
- && jump_reloc == NO_RELOC && i.op[0].disps->X_add_number == 0
- && need_plt32_p (i.op[0].disps->X_add_symbol))
- jump_reloc = BFD_RELOC_X86_64_PLT32;
-#endif
-
- jump_reloc = reloc (size, 1, 1, jump_reloc);
-
fixP = fix_new_exp (frag_now, p - frag_now->fr_literal, size,
- i.op[0].disps, 1, jump_reloc);
+ i.op[0].disps, 1, reloc (size, 1, 1, i.reloc[0]));
/* All jumps handled here are signed, but don't unconditionally use a
signed limit check for 32 and 16 bit jumps as we want to allow wrap
@@ -12299,11 +12247,6 @@ md_estimate_size_before_relax (fragS *fragP, segT segment)
reloc_type = (enum bfd_reloc_code_real) fragP->fr_var;
else if (size == 2)
reloc_type = BFD_RELOC_16_PCREL;
-#if defined (OBJ_ELF) || defined (OBJ_MAYBE_ELF)
- else if (fragP->tc_frag_data.code64 && fragP->fr_offset == 0
- && need_plt32_p (fragP->fr_symbol))
- reloc_type = BFD_RELOC_X86_64_PLT32;
-#endif
else
reloc_type = BFD_RELOC_32_PCREL;
diff --git a/gas/testsuite/gas/i386/ilp32/reloc64.d b/gas/testsuite/gas/i386/ilp32/reloc64.d
index 78ca3fd9e38..a961679754a 100644
--- a/gas/testsuite/gas/i386/ilp32/reloc64.d
+++ b/gas/testsuite/gas/i386/ilp32/reloc64.d
@@ -17,7 +17,7 @@ Disassembly of section \.text:
.*[ ]+R_X86_64_PC8[ ]+xtrn\+0x0*1
.*[ ]+R_X86_64_PC32[ ]+xtrn-0x0*4
.*[ ]+R_X86_64_PC32[ ]+xtrn-0x0*4
-.*[ ]+R_X86_64_PLT32[ ]+xtrn-0x0*4
+.*[ ]+R_X86_64_PC32[ ]+xtrn-0x0*4
.*[ ]+R_X86_64_PC8[ ]+xtrn-0x0*1
.*[ ]+R_X86_64_GOT32[ ]+xtrn
.*[ ]+R_X86_64_GOT32[ ]+xtrn
diff --git a/gas/testsuite/gas/i386/ilp32/x86-64-branch.d b/gas/testsuite/gas/i386/ilp32/x86-64-branch.d
index acf8c42ca97..57845fdc208 100644
--- a/gas/testsuite/gas/i386/ilp32/x86-64-branch.d
+++ b/gas/testsuite/gas/i386/ilp32/x86-64-branch.d
@@ -20,9 +20,9 @@ Disassembly of section .text:
[ ]*[a-f0-9]+: 66 ff 20 data16 jmp \*\(%rax\)
[ ]*[a-f0-9]+: e8 00 00 00 00 call (0x)?1f <.*> 1b: R_X86_64_PC32 \*ABS\*\+0x10003c
[ ]*[a-f0-9]+: e9 00 00 00 00 jmp (0x)?24 <.*> 20: R_X86_64_PC32 \*ABS\*\+0x10003c
-[ ]*[a-f0-9]+: 66 e8 00 00 00 00 data16 call (0x)?2a <.*> 26: R_X86_64_PLT32 foo-0x4
-[ ]*[a-f0-9]+: 66 e9 00 00 00 00 data16 jmp (0x)?30 <.*> 2c: R_X86_64_PLT32 foo-0x4
-[ ]*[a-f0-9]+: 66 0f 82 00 00 00 00 data16 jb (0x)?37 <.*> 33: R_X86_64_PLT32 foo-0x4
+[ ]*[a-f0-9]+: 66 e8 00 00 00 00 data16 call (0x)?2a <.*> 26: R_X86_64_PC32 foo-0x4
+[ ]*[a-f0-9]+: 66 e9 00 00 00 00 data16 jmp (0x)?30 <.*> 2c: R_X86_64_PC32 foo-0x4
+[ ]*[a-f0-9]+: 66 0f 82 00 00 00 00 data16 jb (0x)?37 <.*> 33: R_X86_64_PC32 foo-0x4
[ ]*[a-f0-9]+: 66 c3 data16 ret
[ ]*[a-f0-9]+: 66 c2 08 00 data16 ret \$0x8
[ ]*[a-f0-9]+: 3e 74 03[ ]+je,pt +[0-9a-fx]+ <.*>
diff --git a/gas/testsuite/gas/i386/reloc64.d b/gas/testsuite/gas/i386/reloc64.d
index 540a9b77d35..ea16c68de4b 100644
--- a/gas/testsuite/gas/i386/reloc64.d
+++ b/gas/testsuite/gas/i386/reloc64.d
@@ -20,7 +20,7 @@ Disassembly of section \.text:
.*[ ]+R_X86_64_PC8[ ]+xtrn\+0x0*1
.*[ ]+R_X86_64_PC32[ ]+xtrn-0x0*4
.*[ ]+R_X86_64_PC32[ ]+xtrn-0x0*4
-.*[ ]+R_X86_64_PLT32[ ]+xtrn-0x0*4
+.*[ ]+R_X86_64_PC32[ ]+xtrn-0x0*4
.*[ ]+R_X86_64_PC8[ ]+xtrn-0x0*1
.*[ ]+R_X86_64_GOT64[ ]+xtrn
.*[ ]+R_X86_64_GOT32[ ]+xtrn
diff --git a/gas/testsuite/gas/i386/x86-64-branch-2.d b/gas/testsuite/gas/i386/x86-64-branch-2.d
index fab75a6394c..e025de90b68 100644
--- a/gas/testsuite/gas/i386/x86-64-branch-2.d
+++ b/gas/testsuite/gas/i386/x86-64-branch-2.d
@@ -9,12 +9,12 @@ Disassembly of section .text:
0+ <bar-0xb>:
[ ]*[a-f0-9]+: 66 e9 00 00 jmpw 4 <bar-0x7> 2: R_X86_64_PC16 foo-0x2
-[ ]*[a-f0-9]+: 66 48 e9 00 00 00 00 data16 rex\.W jmp b <bar> 7: R_X86_64_PLT32 foo-0x4
+[ ]*[a-f0-9]+: 66 48 e9 00 00 00 00 data16 rex\.W jmp b <bar> 7: R_X86_64_PC32 foo-0x4
0+b <bar>:
[ ]*[a-f0-9]+: 89 c3 mov %eax,%ebx
[ ]*[a-f0-9]+: 66 e8 00 00 callw 11 <bar\+0x6> f: R_X86_64_PC16 foo-0x2
-[ ]*[a-f0-9]+: 66 48 e8 00 00 00 00 data16 rex\.W call 18 <bar\+0xd> 14: R_X86_64_PLT32 foo-0x4
+[ ]*[a-f0-9]+: 66 48 e8 00 00 00 00 data16 rex\.W call 18 <bar\+0xd> 14: R_X86_64_PC32 foo-0x4
[ ]*[a-f0-9]+: 66 c3 retw
[ ]*[a-f0-9]+: 66 c2 08 00 retw \$0x8
#pass
diff --git a/gas/testsuite/gas/i386/x86-64-jump.d b/gas/testsuite/gas/i386/x86-64-jump.d
index 7d2c994ce26..58ad424badb 100644
--- a/gas/testsuite/gas/i386/x86-64-jump.d
+++ b/gas/testsuite/gas/i386/x86-64-jump.d
@@ -9,7 +9,7 @@ Disassembly of section .text:
0+ <.text>:
[ ]*[a-f0-9]+: eb fe jmp (0x0|0 <.text>)
-[ ]*[a-f0-9]+: e9 00 00 00 00 jmp 0x7 3: R_X86_64_PLT32 xxx-0x4
+[ ]*[a-f0-9]+: e9 00 00 00 00 jmp 0x7 3: R_X86_64_PC32 xxx-0x4
[ ]*[a-f0-9]+: ff 24 25 00 00 00 00 jmp \*0x0 a: R_X86_64_32S xxx
[ ]*[a-f0-9]+: ff e7 jmp \*%rdi
[ ]*[a-f0-9]+: ff 27 jmp \*\(%rdi\)
@@ -18,7 +18,7 @@ Disassembly of section .text:
[ ]*[a-f0-9]+: ff 2c 25 00 00 00 00 ljmp \*0x0 24: R_X86_64_32S xxx
[ ]*[a-f0-9]+: 66 ff 2c 25 00 00 00 00 ljmpw \*0x0 2c: R_X86_64_32S xxx
[ ]*[a-f0-9]+: e8 cb ff ff ff call 0x0
-[ ]*[a-f0-9]+: e8 00 00 00 00 call 0x3a 36: R_X86_64_PLT32 xxx-0x4
+[ ]*[a-f0-9]+: e8 00 00 00 00 call 0x3a 36: R_X86_64_PC32 xxx-0x4
[ ]*[a-f0-9]+: ff 14 25 00 00 00 00 call \*0x0 3d: R_X86_64_32S xxx
[ ]*[a-f0-9]+: ff d7 call \*%rdi
[ ]*[a-f0-9]+: ff 17 call \*\(%rdi\)
diff --git a/gas/testsuite/gas/i386/x86-64-nop-3.d b/gas/testsuite/gas/i386/x86-64-nop-3.d
index 1975481cc59..436487b5a99 100644
--- a/gas/testsuite/gas/i386/x86-64-nop-3.d
+++ b/gas/testsuite/gas/i386/x86-64-nop-3.d
@@ -18,5 +18,5 @@ Disassembly of section .text:
Disassembly of section .altinstr_replacement:
0+ <.altinstr_replacement>:
- +[a-f0-9]+: e9 00 00 00 00 jmp 5 <_start\+0x5> 1: R_X86_64_PLT32 foo-0x4
+ +[a-f0-9]+: e9 00 00 00 00 jmp 5 <_start\+0x5> 1: R_X86_64_PC32 foo-0x4
#pass
diff --git a/gas/testsuite/gas/i386/x86-64-nop-4.d b/gas/testsuite/gas/i386/x86-64-nop-4.d
index 2da858db994..e390628b335 100644
--- a/gas/testsuite/gas/i386/x86-64-nop-4.d
+++ b/gas/testsuite/gas/i386/x86-64-nop-4.d
@@ -21,5 +21,5 @@ Disassembly of section .altinstr_replacement:
+[a-f0-9]+: 89 c0 mov %eax,%eax
+[a-f0-9]+: 89 c0 mov %eax,%eax
+[a-f0-9]+: 89 c0 mov %eax,%eax
- +[a-f0-9]+: e9 00 00 00 00 jmp b <_start\+0xb> 7: R_X86_64_PLT32 foo-0x4
+ +[a-f0-9]+: e9 00 00 00 00 jmp b <_start\+0xb> 7: R_X86_64_PC32 foo-0x4
#pass
diff --git a/gas/testsuite/gas/i386/x86-64-nop-5.d b/gas/testsuite/gas/i386/x86-64-nop-5.d
index d5c84c1edf8..69820d54de8 100644
--- a/gas/testsuite/gas/i386/x86-64-nop-5.d
+++ b/gas/testsuite/gas/i386/x86-64-nop-5.d
@@ -24,5 +24,5 @@ Disassembly of section .altinstr_replacement:
+[a-f0-9]+: 89 c0 mov %eax,%eax
+[a-f0-9]+: 89 c0 mov %eax,%eax
+[a-f0-9]+: 89 c0 mov %eax,%eax
- +[a-f0-9]+: e9 00 00 00 00 jmp d <_start\+0xd> 9: R_X86_64_PLT32 foo-0x4
+ +[a-f0-9]+: e9 00 00 00 00 jmp d <_start\+0xd> 9: R_X86_64_PC32 foo-0x4
#pass
diff --git a/gas/testsuite/gas/i386/x86-64-relax-2.d b/gas/testsuite/gas/i386/x86-64-relax-2.d
index fba47c14850..0949ab23907 100644
--- a/gas/testsuite/gas/i386/x86-64-relax-2.d
+++ b/gas/testsuite/gas/i386/x86-64-relax-2.d
@@ -11,12 +11,12 @@ Disassembly of section .text:
0+ <foo>:
[ ]*[a-f0-9]+: eb 24 jmp 26 <local>
[ ]*[a-f0-9]+: eb 1e jmp 22 <hidden_def>
-[ ]*[a-f0-9]+: e9 00 00 00 00 jmp 9 <foo\+0x9> 5: R_X86_64_PLT32 global_def-0x4
+[ ]*[a-f0-9]+: e9 00 00 00 00 jmp 9 <foo\+0x9> 5: R_X86_64_PC32 global_def-0x4
[ ]*[a-f0-9]+: e9 00 00 00 00 jmp e <foo\+0xe> a: R_X86_64_PLT32 global_def-0x4
-[ ]*[a-f0-9]+: e9 00 00 00 00 jmp 13 <foo\+0x13> f: R_X86_64_PLT32 weak_def-0x4
-[ ]*[a-f0-9]+: e9 00 00 00 00 jmp 18 <foo\+0x18> 14: R_X86_64_PLT32 weak_hidden_undef-0x4
-[ ]*[a-f0-9]+: e9 00 00 00 00 jmp 1d <foo\+0x1d> 19: R_X86_64_PLT32 weak_hidden_def-0x4
-[ ]*[a-f0-9]+: e9 00 00 00 00 jmp 22 <hidden_def> 1e: R_X86_64_PLT32 hidden_undef-0x4
+[ ]*[a-f0-9]+: e9 00 00 00 00 jmp 13 <foo\+0x13> f: R_X86_64_PC32 weak_def-0x4
+[ ]*[a-f0-9]+: e9 00 00 00 00 jmp 18 <foo\+0x18> 14: R_X86_64_PC32 weak_hidden_undef-0x4
+[ ]*[a-f0-9]+: e9 00 00 00 00 jmp 1d <foo\+0x1d> 19: R_X86_64_PC32 weak_hidden_def-0x4
+[ ]*[a-f0-9]+: e9 00 00 00 00 jmp 22 <hidden_def> 1e: R_X86_64_PC32 hidden_undef-0x4
0+22 <hidden_def>:
[ ]*[a-f0-9]+: c3 ret
diff --git a/gas/testsuite/gas/i386/x86-64-relax-3.d b/gas/testsuite/gas/i386/x86-64-relax-3.d
index 01df9ef340e..d16e6a55395 100644
--- a/gas/testsuite/gas/i386/x86-64-relax-3.d
+++ b/gas/testsuite/gas/i386/x86-64-relax-3.d
@@ -12,10 +12,10 @@ Disassembly of section .text:
[ ]*[a-f0-9]+: eb 1b jmp 1f <hidden_def>
[ ]*[a-f0-9]+: eb 1b jmp 21 <global_def>
[ ]*[a-f0-9]+: e9 00 00 00 00 jmp b <foo\+0xb> 7: R_X86_64_PLT32 global_def-0x4
-[ ]*[a-f0-9]+: e9 00 00 00 00 jmp 10 <foo\+0x10> c: R_X86_64_PLT32 weak_def-0x4
-[ ]*[a-f0-9]+: e9 00 00 00 00 jmp 15 <foo\+0x15> 11: R_X86_64_PLT32 weak_hidden_undef-0x4
-[ ]*[a-f0-9]+: e9 00 00 00 00 jmp 1a <foo\+0x1a> 16: R_X86_64_PLT32 weak_hidden_def-0x4
-[ ]*[a-f0-9]+: e9 00 00 00 00 jmp 1f <hidden_def> 1b: R_X86_64_PLT32 hidden_undef-0x4
+[ ]*[a-f0-9]+: e9 00 00 00 00 jmp 10 <foo\+0x10> c: R_X86_64_PC32 weak_def-0x4
+[ ]*[a-f0-9]+: e9 00 00 00 00 jmp 15 <foo\+0x15> 11: R_X86_64_PC32 weak_hidden_undef-0x4
+[ ]*[a-f0-9]+: e9 00 00 00 00 jmp 1a <foo\+0x1a> 16: R_X86_64_PC32 weak_hidden_def-0x4
+[ ]*[a-f0-9]+: e9 00 00 00 00 jmp 1f <hidden_def> 1b: R_X86_64_PC32 hidden_undef-0x4
0+1f <hidden_def>:
[ ]*[a-f0-9]+: c3 ret
diff --git a/ld/testsuite/ld-x86-64/pr22791-1.err b/ld/testsuite/ld-x86-64/pr22791-1.err
deleted file mode 100644
index 8c5565992e7..00000000000
--- a/ld/testsuite/ld-x86-64/pr22791-1.err
+++ /dev/null
@@ -1,2 +0,0 @@
-.*relocation R_X86_64_PC32 against symbol `foo' can not be used when making a PIE object; recompile with -fPIE
-#...
diff --git a/ld/testsuite/ld-x86-64/pr22791-1a.c b/ld/testsuite/ld-x86-64/pr22791-1a.c
deleted file mode 100644
index cd0130cacdf..00000000000
--- a/ld/testsuite/ld-x86-64/pr22791-1a.c
+++ /dev/null
@@ -1,4 +0,0 @@
-void
-foo (void)
-{
-}
diff --git a/ld/testsuite/ld-x86-64/pr22791-1b.s b/ld/testsuite/ld-x86-64/pr22791-1b.s
deleted file mode 100644
index 9751db49aa5..00000000000
--- a/ld/testsuite/ld-x86-64/pr22791-1b.s
+++ /dev/null
@@ -1,7 +0,0 @@
- .text
- .globl main
- .type main, @function
-main:
- movl foo(%rip), %eax
- .size main, .-main
- .section .note.GNU-stack
diff --git a/ld/testsuite/ld-x86-64/pr22791-2.rd b/ld/testsuite/ld-x86-64/pr22791-2.rd
deleted file mode 100644
index 70deb30d84d..00000000000
--- a/ld/testsuite/ld-x86-64/pr22791-2.rd
+++ /dev/null
@@ -1,6 +0,0 @@
-#failif
-#...
-.*\(TEXTREL\).*
-#...
-[0-9a-f ]+R_X86_64_NONE.*
-#...
diff --git a/ld/testsuite/ld-x86-64/pr22791-2a.s b/ld/testsuite/ld-x86-64/pr22791-2a.s
deleted file mode 100644
index 0a855024d74..00000000000
--- a/ld/testsuite/ld-x86-64/pr22791-2a.s
+++ /dev/null
@@ -1,8 +0,0 @@
- .text
- .p2align 4,,15
- .globl foo
- .type foo, @function
-foo:
- jmp bar
- .size foo, .-foo
- .section .note.GNU-stack,"",@progbits
diff --git a/ld/testsuite/ld-x86-64/pr22791-2b.c b/ld/testsuite/ld-x86-64/pr22791-2b.c
deleted file mode 100644
index 79ef27c0857..00000000000
--- a/ld/testsuite/ld-x86-64/pr22791-2b.c
+++ /dev/null
@@ -1,7 +0,0 @@
-#include <stdio.h>
-
-void
-bar (void)