public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* [PATCH 0/2] Improve -z mark-plt
@ 2024-01-05 21:50 H.J. Lu
  2024-01-05 21:50 ` [PATCH 1/2] elf: Add elf_backend_add_glibc_version_dependency H.J. Lu
  2024-01-05 21:50 ` [PATCH 2/2] ld: Add --enable-make-plt configure option H.J. Lu
  0 siblings, 2 replies; 4+ messages in thread
From: H.J. Lu @ 2024-01-05 21:50 UTC (permalink / raw)
  To: binutils

Add --enable-make-plt linker configure option to mark PLT entries with
DT_X86_64_PLT, DT_X86_64_PLTSZ and DT_X86_64_PLTENT dynamic tags by
default.

When -z mark-plt is used to add DT_X86_64_PLT, DT_X86_64_PLTSZ and
DT_X86_64_PLTENT, the r_addend field of the R_X86_64_JUMP_SLOT relocation
stores the offset of the indirect branch instruction.  However, glibc
versions which don't have this commit in glibc 2.36:

commit f8587a61892cbafd98ce599131bf4f103466f084
Author: H.J. Lu <hjl.tools@gmail.com>
Date:   Fri May 20 19:21:48 2022 -0700

    x86-64: Ignore r_addend for R_X86_64_GLOB_DAT/R_X86_64_JUMP_SLOT

    According to x86-64 psABI, r_addend should be ignored for R_X86_64_GLOB_DAT
    and R_X86_64_JUMP_SLOT.  Since linkers always set their r_addends to 0, we
    can ignore their r_addends.

    Reviewed-by: Fangrui Song <maskray@google.com>

won't ignore the r_addend value in the R_X86_64_JUMP_SLOT relocation.
Although this commit has been backported to glibc 2.33/2.34/2.35 release
branches, it is safer to require glibc 2.36 for such binaries.

Extend the glibc version dependency of GLIBC_ABI_DT_RELR for DT_RELR to
also add GLIBC_2.36 version dependency for -z mark-plt on the the shared C
library if it provides a GLIBC_2.XX symbol version.

H.J. Lu (2):
  elf: Add elf_backend_add_glibc_version_dependency
  ld: Add --enable-make-plt configure option

 bfd/elf-bfd.h                                 |  23 +++
 bfd/elf64-x86-64.c                            |  27 ++++
 bfd/elflink.c                                 | 146 ++++++++++--------
 bfd/elfxx-target.h                            |   5 +
 ld/NEWS                                       |   5 +
 ld/config.in                                  |   4 +
 ld/configure                                  |  26 +++-
 ld/configure.ac                               |  17 ++
 ld/emulparams/x86-64-plt.sh                   |   7 +-
 ld/emultempl/elf-x86.em                       |  17 ++
 .../ld-elf/indirect-extern-access-2.rd        |   2 +-
 ld/testsuite/ld-elf/pr23161d.rd               |   2 +-
 ld/testsuite/ld-ifunc/ifunc-16-x86-64-now.d   |   2 +-
 ld/testsuite/ld-ifunc/ifunc-16-x86-64.d       |   2 +-
 .../ld-ifunc/ifunc-2-local-x86-64-now.d       |   2 +-
 ld/testsuite/ld-ifunc/ifunc-2-local-x86-64.d  |   2 +-
 ld/testsuite/ld-ifunc/ifunc-2-x86-64-now.d    |   2 +-
 ld/testsuite/ld-ifunc/ifunc-2-x86-64.d        |   2 +-
 ld/testsuite/ld-ifunc/ifunc-20-x86-64.d       |   2 +-
 ld/testsuite/ld-ifunc/ifunc-25c-x86.d         |   2 +-
 ld/testsuite/ld-ifunc/ifunc-5b-x86-64.d       |   2 +-
 ld/testsuite/ld-ifunc/pr17154-x86-64-now.d    |   2 +-
 ld/testsuite/ld-ifunc/pr17154-x86-64.d        |   2 +-
 ld/testsuite/ld-x86-64/mark-plt-1a.rd         |   7 +
 ld/testsuite/ld-x86-64/mark-plt-1b.rd         |   7 +
 ld/testsuite/ld-x86-64/x86-64.exp             |  47 +++++-
 26 files changed, 281 insertions(+), 83 deletions(-)
 create mode 100644 ld/testsuite/ld-x86-64/mark-plt-1a.rd
 create mode 100644 ld/testsuite/ld-x86-64/mark-plt-1b.rd

-- 
2.43.0


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH 1/2] elf: Add elf_backend_add_glibc_version_dependency
  2024-01-05 21:50 [PATCH 0/2] Improve -z mark-plt H.J. Lu
@ 2024-01-05 21:50 ` H.J. Lu
  2024-01-05 21:50 ` [PATCH 2/2] ld: Add --enable-make-plt configure option H.J. Lu
  1 sibling, 0 replies; 4+ messages in thread
From: H.J. Lu @ 2024-01-05 21:50 UTC (permalink / raw)
  To: binutils

When -z mark-plt is used to add DT_X86_64_PLT, DT_X86_64_PLTSZ and
DT_X86_64_PLTENT, the r_addend field of the R_X86_64_JUMP_SLOT relocation
stores the offset of the indirect branch instruction.  However, glibc
versions which don't have this commit in glibc 2.36:

commit f8587a61892cbafd98ce599131bf4f103466f084
Author: H.J. Lu <hjl.tools@gmail.com>
Date:   Fri May 20 19:21:48 2022 -0700

    x86-64: Ignore r_addend for R_X86_64_GLOB_DAT/R_X86_64_JUMP_SLOT

    According to x86-64 psABI, r_addend should be ignored for R_X86_64_GLOB_DAT
    and R_X86_64_JUMP_SLOT.  Since linkers always set their r_addends to 0, we
    can ignore their r_addends.

    Reviewed-by: Fangrui Song <maskray@google.com>

won't ignore the r_addend value in the R_X86_64_JUMP_SLOT relocation.
Although this commit has been backported to glibc 2.33/2.34/2.35 release
branches, it is safer to require glibc 2.36 for such binaries.

Extend the glibc version dependency of GLIBC_ABI_DT_RELR for DT_RELR to
also add GLIBC_2.36 version dependency for -z mark-plt on the the shared C
library if it provides a GLIBC_2.XX symbol version.

	* elflink.c (elf_find_verdep_info): Moved to ...
	* elf-bfd.h (elf_find_verdep_info): Here.
	(elf_backend_data): Add elf_backend_add_glibc_version_dependency.
	(_bfd_elf_link_add_glibc_version_dependency): New function.
	(_bfd_elf_link_add_dt_relr_dependency): Likewise.
	* elf64-x86-64.c (elf_x86_64_add_glibc_version_dependency):
	Likewise.
	(elf_backend_add_glibc_version_dependency): New.
	* elflink.c (elf_link_add_dt_relr_dependency): Renamed to ...
	(elf_link_add_glibc_verneed): This.  Modified to support other
	glibc dependencies.
	(_bfd_elf_link_add_glibc_version_dependency): Likewise.
	(_bfd_elf_link_add_dt_relr_dependency): Likewise.
	(bfd_elf_size_dynamic_sections): Call
	elf_backend_add_glibc_version_dependency instead of
	elf_link_add_dt_relr_dependency.
	* elfxx-target.h (elf_backend_add_glibc_version_dependency): New.
	(elfNN_bed): Add elf_backend_add_glibc_version_dependency.

ld/

	* testsuite/ld-x86-64/mark-plt-1a.rd: New file.
	* testsuite/ld-x86-64/mark-plt-1b.rd: Likewise.
	* testsuite/ld-x86-64/x86-64.exp: Run -z mark-plt test for
	GLIBC_2.36 dependency.
---
 bfd/elf-bfd.h                         |  23 ++++
 bfd/elf64-x86-64.c                    |  27 +++++
 bfd/elflink.c                         | 146 +++++++++++++++-----------
 bfd/elfxx-target.h                    |   5 +
 ld/testsuite/ld-x86-64/mark-plt-1a.rd |   7 ++
 ld/testsuite/ld-x86-64/mark-plt-1b.rd |   7 ++
 ld/testsuite/ld-x86-64/x86-64.exp     |  14 +++
 7 files changed, 167 insertions(+), 62 deletions(-)
 create mode 100644 ld/testsuite/ld-x86-64/mark-plt-1a.rd
 create mode 100644 ld/testsuite/ld-x86-64/mark-plt-1b.rd

diff --git a/bfd/elf-bfd.h b/bfd/elf-bfd.h
index a611349e3d9..3ed22fa6c52 100644
--- a/bfd/elf-bfd.h
+++ b/bfd/elf-bfd.h
@@ -957,6 +957,19 @@ typedef struct elf_property_list
   struct elf_property property;
 } elf_property_list;
 
+/* This structure is used to pass information to
+   elf_backend_add_glibc_version_dependency.  */
+
+struct elf_find_verdep_info
+{
+  /* General link information.  */
+  struct bfd_link_info *info;
+  /* The number of dependencies.  */
+  unsigned int vers;
+  /* Whether we had a failure.  */
+  bool failed;
+};
+
 struct bfd_elf_section_reloc_data;
 
 struct elf_backend_data
@@ -1488,6 +1501,10 @@ struct elf_backend_data
   bool (*elf_backend_write_section)
     (bfd *, struct bfd_link_info *, asection *, bfd_byte *);
 
+  /* This function adds glibc version dependency.  */
+  void (*elf_backend_add_glibc_version_dependency)
+    (struct elf_find_verdep_info *);
+
   /* This function, if defined, returns TRUE if it is section symbols
      only that are considered local for the purpose of partitioning the
      symbol table into local and global symbols.  This should be NULL
@@ -2583,6 +2600,12 @@ extern bool _bfd_elf_link_output_relocs
   (bfd *, asection *, Elf_Internal_Shdr *, Elf_Internal_Rela *,
    struct elf_link_hash_entry **);
 
+extern void _bfd_elf_link_add_glibc_version_dependency
+  (struct elf_find_verdep_info *, const char *[]);
+
+extern void _bfd_elf_link_add_dt_relr_dependency
+  (struct elf_find_verdep_info *);
+
 extern bool _bfd_elf_adjust_dynamic_copy
   (struct bfd_link_info *, struct elf_link_hash_entry *, asection *);
 
diff --git a/bfd/elf64-x86-64.c b/bfd/elf64-x86-64.c
index ec001599cc1..1a2e64c031f 100644
--- a/bfd/elf64-x86-64.c
+++ b/bfd/elf64-x86-64.c
@@ -5568,6 +5568,31 @@ elf_x86_64_link_setup_gnu_properties (struct bfd_link_info *info)
   return _bfd_x86_elf_link_setup_gnu_properties (info, &init_table);
 }
 
+static void
+elf_x86_64_add_glibc_version_dependency
+  (struct elf_find_verdep_info *rinfo)
+{
+  unsigned int i = 0;
+  const char *version[3] = { NULL, NULL, NULL };
+  struct elf_x86_link_hash_table *htab;
+
+  if (rinfo->info->enable_dt_relr)
+    {
+      version[i] = "GLIBC_ABI_DT_RELR";
+      i++;
+    }
+
+  htab = elf_x86_hash_table (rinfo->info, X86_64_ELF_DATA);
+  if (htab != NULL && htab->params->mark_plt)
+    {
+      version[i] = "GLIBC_2.36";
+      i++;
+    }
+
+  if (i != 0)
+    _bfd_elf_link_add_glibc_version_dependency (rinfo, version);
+}
+
 static const struct bfd_elf_special_section
 elf_x86_64_special_sections[]=
 {
@@ -5652,6 +5677,8 @@ elf_x86_64_special_sections[]=
   elf_x86_64_link_setup_gnu_properties
 #define elf_backend_hide_symbol \
   _bfd_x86_elf_hide_symbol
+#define elf_backend_add_glibc_version_dependency \
+  elf_x86_64_add_glibc_version_dependency
 
 #undef	elf64_bed
 #define elf64_bed elf64_x86_64_bed
diff --git a/bfd/elflink.c b/bfd/elflink.c
index a577c957514..c2494b3e12e 100644
--- a/bfd/elflink.c
+++ b/bfd/elflink.c
@@ -46,19 +46,6 @@ struct elf_info_failed
   bool failed;
 };
 
-/* This structure is used to pass information to
-   _bfd_elf_link_find_version_dependencies.  */
-
-struct elf_find_verdep_info
-{
-  /* General link information.  */
-  struct bfd_link_info *info;
-  /* The number of dependencies.  */
-  unsigned int vers;
-  /* Whether we had a failure.  */
-  bool failed;
-};
-
 static bool _bfd_elf_fix_symbol_flags
   (struct elf_link_hash_entry *, struct elf_info_failed *);
 
@@ -2217,64 +2204,64 @@ _bfd_elf_export_symbol (struct elf_link_hash_entry *h, void *data)
   return true;
 }
 \f
-/* Return true if GLIBC_ABI_DT_RELR is added to the list of version
-   dependencies successfully.  GLIBC_ABI_DT_RELR will be put into the
-   .gnu.version_r section.  */
+/* Return the glibc version reference if VERSION_DEP is added to the
+   list of glibc version dependencies successfully.  VERSION_DEP will
+   be put into the .gnu.version_r section.  */
 
-static bool
-elf_link_add_dt_relr_dependency (struct elf_find_verdep_info *rinfo)
+static Elf_Internal_Verneed *
+elf_link_add_glibc_verneed (struct elf_find_verdep_info *rinfo,
+			    Elf_Internal_Verneed *glibc_verref,
+			    const char *version_dep)
 {
-  bfd *glibc_bfd = NULL;
   Elf_Internal_Verneed *t;
   Elf_Internal_Vernaux *a;
   size_t amt;
-  const char *relr = "GLIBC_ABI_DT_RELR";
 
-  /* See if we already know about GLIBC_PRIVATE_DT_RELR.  */
-  for (t = elf_tdata (rinfo->info->output_bfd)->verref;
-       t != NULL;
-       t = t->vn_nextref)
+  if (glibc_verref != NULL)
     {
-      const char *soname = bfd_elf_get_dt_soname (t->vn_bfd);
-      /* Skip the shared library if it isn't libc.so.  */
-      if (!soname || !startswith (soname, "libc.so."))
-	continue;
+      t = glibc_verref;
 
       for (a = t->vn_auxptr; a != NULL; a = a->vna_nextptr)
 	{
-	  /* Return if GLIBC_PRIVATE_DT_RELR dependency has been
-	     added.  */
-	  if (a->vna_nodename == relr
-	      || strcmp (a->vna_nodename, relr) == 0)
-	    return true;
-
-	  /* Check if libc.so provides GLIBC_2.XX version.  */
-	  if (!glibc_bfd && startswith (a->vna_nodename, "GLIBC_2."))
-	    glibc_bfd = t->vn_bfd;
+	  /* Return if VERSION_DEP dependency has been added.  */
+	  if (a->vna_nodename == version_dep
+	      || strcmp (a->vna_nodename, version_dep) == 0)
+	    return t;
 	}
-
-      break;
     }
+  else
+    {
+      bool is_glibc;
 
-  /* Skip if it isn't linked against glibc.  */
-  if (glibc_bfd == NULL)
-    return true;
+      for (t = elf_tdata (rinfo->info->output_bfd)->verref;
+	   t != NULL;
+	   t = t->vn_nextref)
+	{
+	  const char *soname = bfd_elf_get_dt_soname (t->vn_bfd);
+	  if (soname != NULL && startswith (soname, "libc.so."))
+	    break;
+	}
 
-  /* This is a new version.  Add it to tree we are building.  */
-  if (t == NULL)
-    {
-      amt = sizeof *t;
-      t = (Elf_Internal_Verneed *) bfd_zalloc (rinfo->info->output_bfd,
-					       amt);
+      /* Skip the shared library if it isn't libc.so.  */
       if (t == NULL)
+	return t;
+
+      is_glibc = false;
+      for (a = t->vn_auxptr; a != NULL; a = a->vna_nextptr)
 	{
-	  rinfo->failed = true;
-	  return false;
+	  /* Return if VERSION_DEP dependency has been added.  */
+	  if (a->vna_nodename == version_dep
+	      || strcmp (a->vna_nodename, version_dep) == 0)
+	    return t;
+
+	  /* Check if libc.so provides GLIBC_2.XX version.  */
+	  if (!is_glibc && startswith (a->vna_nodename, "GLIBC_2."))
+	    is_glibc = true;
 	}
 
-      t->vn_bfd = glibc_bfd;
-      t->vn_nextref = elf_tdata (rinfo->info->output_bfd)->verref;
-      elf_tdata (rinfo->info->output_bfd)->verref = t;
+      /* Skip if it isn't linked against glibc.  */
+      if (!is_glibc)
+	return NULL;
     }
 
   amt = sizeof *a;
@@ -2282,10 +2269,10 @@ elf_link_add_dt_relr_dependency (struct elf_find_verdep_info *rinfo)
   if (a == NULL)
     {
       rinfo->failed = true;
-      return false;
+      return NULL;
     }
 
-  a->vna_nodename = relr;
+  a->vna_nodename = version_dep;
   a->vna_flags = 0;
   a->vna_nextptr = t->vn_auxptr;
   a->vna_other = rinfo->vers + 1;
@@ -2293,7 +2280,45 @@ elf_link_add_dt_relr_dependency (struct elf_find_verdep_info *rinfo)
 
   t->vn_auxptr = a;
 
-  return true;
+  return t;
+}
+
+/* Add VERSION_DEP to the list of version dependencies when linked
+   against glibc.  */
+
+void
+_bfd_elf_link_add_glibc_version_dependency
+  (struct elf_find_verdep_info *rinfo,
+   const char *version_dep[])
+{
+  Elf_Internal_Verneed *t = NULL;
+
+  do
+    {
+      t = elf_link_add_glibc_verneed (rinfo, t, *version_dep);
+      /* Return if there is no glibc version reference.  */
+      if (t == NULL)
+	return;
+      version_dep++;
+    }
+  while (*version_dep != NULL);
+}
+
+/* Add GLIBC_ABI_DT_RELR to the list of version dependencies when
+   linked against glibc.  */
+
+void
+_bfd_elf_link_add_dt_relr_dependency (struct elf_find_verdep_info *rinfo)
+{
+  if (rinfo->info->enable_dt_relr)
+    {
+      const char *version[] =
+	{
+	  "GLIBC_ABI_DT_RELR",
+	  NULL
+	};
+      _bfd_elf_link_add_glibc_version_dependency (rinfo, version);
+    }
 }
 
 /* Look through the symbols which are defined in other shared
@@ -7047,12 +7072,9 @@ bfd_elf_size_dynamic_sections (bfd *output_bfd,
       if (sinfo.failed)
 	return false;
 
-      if (info->enable_dt_relr)
-	{
-	  elf_link_add_dt_relr_dependency (&sinfo);
-	  if (sinfo.failed)
-	    return false;
-	}
+      bed->elf_backend_add_glibc_version_dependency (&sinfo);
+      if (sinfo.failed)
+	return false;
 
       if (elf_tdata (output_bfd)->verref == NULL)
 	s->flags |= SEC_EXCLUDE;
diff --git a/bfd/elfxx-target.h b/bfd/elfxx-target.h
index d4b14a022e3..a7f2fc6e320 100644
--- a/bfd/elfxx-target.h
+++ b/bfd/elfxx-target.h
@@ -667,6 +667,10 @@
 #ifndef elf_backend_write_section
 #define elf_backend_write_section		NULL
 #endif
+#ifndef elf_backend_add_glibc_version_dependency
+#define elf_backend_add_glibc_version_dependency \
+  _bfd_elf_link_add_dt_relr_dependency
+#endif
 #ifndef elf_backend_elfsym_local_is_section
 #define elf_backend_elfsym_local_is_section	NULL
 #endif
@@ -897,6 +901,7 @@ static const struct elf_backend_data elfNN_bed =
   elf_backend_can_make_multiple_eh_frame,
   elf_backend_encode_eh_address,
   elf_backend_write_section,
+  elf_backend_add_glibc_version_dependency,
   elf_backend_elfsym_local_is_section,
   elf_backend_mips_irix_compat,
   elf_backend_mips_rtype_to_howto,
diff --git a/ld/testsuite/ld-x86-64/mark-plt-1a.rd b/ld/testsuite/ld-x86-64/mark-plt-1a.rd
new file mode 100644
index 00000000000..1234fbe038c
--- /dev/null
+++ b/ld/testsuite/ld-x86-64/mark-plt-1a.rd
@@ -0,0 +1,7 @@
+#...
+Version needs section '.gnu.version_r' contains 1 entry:
+ Addr: 0x[0-9a-f]+ +Offset: 0x[0-9a-f]+ +Link: +[0-9]+ +\(.dynstr\)
+ +0+: Version: 1 +File: libc\.so\.6(|\.1) +Cnt: +[0-9]+
+#...
+  0x[a-f0-9]+:   Name: GLIBC_2.36  Flags: none  Version: [0-9]+
+#pass
diff --git a/ld/testsuite/ld-x86-64/mark-plt-1b.rd b/ld/testsuite/ld-x86-64/mark-plt-1b.rd
new file mode 100644
index 00000000000..6556a6d939e
--- /dev/null
+++ b/ld/testsuite/ld-x86-64/mark-plt-1b.rd
@@ -0,0 +1,7 @@
+#...
+Version needs section '.gnu.version_r' contains 1 entry:
+ Addr: 0x[0-9a-f]+ +Offset: 0x[0-9a-f]+ +Link: +[0-9]+ +\(.dynstr\)
+ +0+: Version: 1 +File: libc\.so\.6(|\.1) +Cnt: +[0-9]+
+#...
+  0x[a-f0-9]+:   Name: GLIBC_ABI_DT_RELR  Flags: none  Version: [0-9]+
+#pass
diff --git a/ld/testsuite/ld-x86-64/x86-64.exp b/ld/testsuite/ld-x86-64/x86-64.exp
index ebb3d882067..f656218df41 100644
--- a/ld/testsuite/ld-x86-64/x86-64.exp
+++ b/ld/testsuite/ld-x86-64/x86-64.exp
@@ -2251,4 +2251,18 @@ run_dump_test "mark-plt-1b-x32"
 run_dump_test "mark-plt-1c-x32"
 run_dump_test "mark-plt-1d-x32"
 
+if { [check_compiler_available] } {
+    run_cc_link_tests [list \
+	[list \
+	    "Build mark-plt-1.so" \
+	    "-shared -Wl,-z,mark-plt,-z,pack-relative-relocs" \
+	    "-fPIC" \
+	    { mark-plt-1.s } \
+	    {{readelf {-W --version-info} mark-plt-1a.rd} \
+	     {readelf {-W --version-info} mark-plt-1b.rd}} \
+	    "mark-plt-1.so" \
+	] \
+    ]
+}
+
 set ASFLAGS "$saved_ASFLAGS"
-- 
2.43.0


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH 2/2] ld: Add --enable-make-plt configure option
  2024-01-05 21:50 [PATCH 0/2] Improve -z mark-plt H.J. Lu
  2024-01-05 21:50 ` [PATCH 1/2] elf: Add elf_backend_add_glibc_version_dependency H.J. Lu
@ 2024-01-05 21:50 ` H.J. Lu
  2024-01-06 14:41   ` H.J. Lu
  1 sibling, 1 reply; 4+ messages in thread
From: H.J. Lu @ 2024-01-05 21:50 UTC (permalink / raw)
  To: binutils

Add --enable-make-plt linker configure option to mark PLT entries with
DT_X86_64_PLT, DT_X86_64_PLTSZ and DT_X86_64_PLTENT dynamic tags by
default.

	* NEWS: Mention -z mark-plt/-z nomark-plt and --enable-make-plt.
	* config.in: Regenerated.
	* configure: Likewise.
	* configure.ac: Add --enable-make-plt.
	(DEFAULT_LD_Z_MARK_PLT): New AC_DEFINE_UNQUOTED.
	* emulparams/x86-64-plt.sh (PARSE_AND_LIST_OPTIONS_X86_64_PLT):
	Support DEFAULT_LD_Z_MARK_PLT.
	* emultempl/elf-x86.em (elf_x86_64_before_parse): New function.
	(LDEMUL_BEFORE_PARSE): New.  Set to elf_x86_64_before_parse for
	x86-64 targets.
	* testsuite/ld-elf/indirect-extern-access-2.rd: Allow non-zero
	r_addend for JUMP_SLOT relocation.
	* testsuite/ld-elf/pr23161d.rd: Likewise.
	* testsuite/ld-ifunc/ifunc-25c-x86.d: Likewise.
	* testsuite/ld-ifunc/ifunc-16-x86-64-now.d: Pass -z nomark-plt
	to linker.
	* testsuite/ld-ifunc/ifunc-16-x86-64.d: Likewise.
	* testsuite/ld-ifunc/ifunc-2-local-x86-64-now.d: Likewise.
	* testsuite/ld-ifunc/ifunc-2-local-x86-64.d: Likewise.
	* testsuite/ld-ifunc/ifunc-2-x86-64-now.d: Likewise.
	* testsuite/ld-ifunc/ifunc-2-x86-64.d: Likewise.
	* testsuite/ld-ifunc/ifunc-20-x86-64.d: Likewise.
	* testsuite/ld-ifunc/ifunc-5b-x86-64.d: Likewise.
	* testsuite/ld-ifunc/pr17154-x86-64-now.d: Likewise.
	* testsuite/ld-ifunc/pr17154-x86-64.d: Likewise.
	* testsuite/ld-x86-64/x86-64.exp (LDFLAGS): Save and restore
	the original linker flags.  Append -z nomark-plt.
	Run i386 tests before appending -z nomark-plt to LDFLAGS.
---
 ld/NEWS                                       |  5 +++
 ld/config.in                                  |  4 +++
 ld/configure                                  | 26 +++++++++++++--
 ld/configure.ac                               | 17 ++++++++++
 ld/emulparams/x86-64-plt.sh                   |  7 +++-
 ld/emultempl/elf-x86.em                       | 17 ++++++++++
 .../ld-elf/indirect-extern-access-2.rd        |  2 +-
 ld/testsuite/ld-elf/pr23161d.rd               |  2 +-
 ld/testsuite/ld-ifunc/ifunc-16-x86-64-now.d   |  2 +-
 ld/testsuite/ld-ifunc/ifunc-16-x86-64.d       |  2 +-
 .../ld-ifunc/ifunc-2-local-x86-64-now.d       |  2 +-
 ld/testsuite/ld-ifunc/ifunc-2-local-x86-64.d  |  2 +-
 ld/testsuite/ld-ifunc/ifunc-2-x86-64-now.d    |  2 +-
 ld/testsuite/ld-ifunc/ifunc-2-x86-64.d        |  2 +-
 ld/testsuite/ld-ifunc/ifunc-20-x86-64.d       |  2 +-
 ld/testsuite/ld-ifunc/ifunc-25c-x86.d         |  2 +-
 ld/testsuite/ld-ifunc/ifunc-5b-x86-64.d       |  2 +-
 ld/testsuite/ld-ifunc/pr17154-x86-64-now.d    |  2 +-
 ld/testsuite/ld-ifunc/pr17154-x86-64.d        |  2 +-
 ld/testsuite/ld-x86-64/x86-64.exp             | 33 ++++++++++++++++---
 20 files changed, 114 insertions(+), 21 deletions(-)

diff --git a/ld/NEWS b/ld/NEWS
index a2c0b7fbcfe..3d3bb59b71b 100644
--- a/ld/NEWS
+++ b/ld/NEWS
@@ -1,5 +1,10 @@
 -*- text -*-
 
+* Add -z mark-plt/-z nomark-plt options to x86-64 ELF linker to mark PLT
+  entries with DT_X86_64_PLT, DT_X86_64_PLTSZ and DT_X86_64_PLTENT dynamic
+  tags.  Also added --enable-make-plt configure option to mark PLT entries
+  by default.
+
 * Support Intel APX relocations.
 
 * On RISC-V, add ld target option --[no-]check-uleb128.  Should rebuild the
diff --git a/ld/config.in b/ld/config.in
index 86d90d53752..52d62f06ff0 100644
--- a/ld/config.in
+++ b/ld/config.in
@@ -45,6 +45,10 @@
    default. */
 #undef DEFAULT_LD_WARN_RWX_SEGMENTS
 
+/* Define to 1 if you want to enable -z mark-plt in ELF x86-64 linker by
+   default. */
+#undef DEFAULT_LD_Z_MARK_PLT
+
 /* Define to 1 if you want to enable -z relro in ELF linker by default. */
 #undef DEFAULT_LD_Z_RELRO
 
diff --git a/ld/configure b/ld/configure
index 07eb669d906..d01dbfae296 100755
--- a/ld/configure
+++ b/ld/configure
@@ -852,6 +852,7 @@ enable_new_dtags
 enable_relro
 enable_textrel_check
 enable_separate_code
+enable_mark_plt
 enable_warn_execstack
 enable_error_execstack
 enable_warn_rwx_segments
@@ -1546,6 +1547,7 @@ Optional Features:
   --enable-textrel-check=[yes|no|warning|error]
                           enable DT_TEXTREL check in ELF linker
   --enable-separate-code  enable -z separate-code in ELF linker by default
+  --enable-make-plt       enable -z mark-plt in ELF x86-64 linker by default
   --enable-warn-execstack enable warnings when creating an executable stack
   --enable-error-execstack
                           turn executable stack warnings into errors
@@ -11681,7 +11683,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 11684 "configure"
+#line 11686 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -11787,7 +11789,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 11790 "configure"
+#line 11792 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -15682,6 +15684,17 @@ esac
 fi
 
 
+# Decide if -z mark-plt should be enabled in ELF x86-64 linker by default.
+ac_default_ld_z_mark_plt=unset
+# Check whether --enable-mark-plt was given.
+if test "${enable_mark_plt+set}" = set; then :
+  enableval=$enable_mark_plt; case "${enableval}" in
+  yes) ac_default_ld_z_mark_plt=1 ;;
+  no) ac_default_ld_z_mark_plt=0 ;;
+esac
+fi
+
+
 
 # By default warn when an executable stack is created due to object files
 # requesting such, not when the user specifies -z execstack.
@@ -19365,6 +19378,15 @@ cat >>confdefs.h <<_ACEOF
 _ACEOF
 
 
+if test "${ac_default_ld_z_mark_plt}" = unset; then
+  ac_default_ld_z_mark_plt=0
+fi
+
+cat >>confdefs.h <<_ACEOF
+#define DEFAULT_LD_Z_MARK_PLT $ac_default_ld_z_mark_plt
+_ACEOF
+
+
 
 
 cat >>confdefs.h <<_ACEOF
diff --git a/ld/configure.ac b/ld/configure.ac
index b46f415fe9b..9036090889e 100644
--- a/ld/configure.ac
+++ b/ld/configure.ac
@@ -213,6 +213,16 @@ AC_ARG_ENABLE(separate-code,
   no) ac_default_ld_z_separate_code=0 ;;
 esac])
 
+# Decide if -z mark-plt should be enabled in ELF x86-64 linker by default.
+ac_default_ld_z_mark_plt=unset
+AC_ARG_ENABLE(mark-plt,
+	      AS_HELP_STRING([--enable-make-plt],
+	      [enable -z mark-plt in ELF x86-64 linker by default]),
+[case "${enableval}" in
+  yes) ac_default_ld_z_mark_plt=1 ;;
+  no) ac_default_ld_z_mark_plt=0 ;;
+esac])
+
 
 # By default warn when an executable stack is created due to object files
 # requesting such, not when the user specifies -z execstack.
@@ -562,6 +572,13 @@ AC_DEFINE_UNQUOTED(DEFAULT_LD_Z_SEPARATE_CODE,
   $ac_default_ld_z_separate_code,
   [Define to 1 if you want to enable -z separate-code in ELF linker by default.])
 
+if test "${ac_default_ld_z_mark_plt}" = unset; then
+  ac_default_ld_z_mark_plt=0
+fi
+AC_DEFINE_UNQUOTED(DEFAULT_LD_Z_MARK_PLT,
+  $ac_default_ld_z_mark_plt,
+  [Define to 1 if you want to enable -z mark-plt in ELF x86-64 linker by default.])
+
 
 AC_DEFINE_UNQUOTED(DEFAULT_LD_WARN_EXECSTACK,
   $ac_default_ld_warn_execstack,
diff --git a/ld/emulparams/x86-64-plt.sh b/ld/emulparams/x86-64-plt.sh
index 92732401dc7..d1a5c65937f 100644
--- a/ld/emulparams/x86-64-plt.sh
+++ b/ld/emulparams/x86-64-plt.sh
@@ -1,5 +1,10 @@
 PARSE_AND_LIST_OPTIONS_X86_64_PLT='
-  fprintf (file, _("\
+  if (DEFAULT_LD_Z_MARK_PLT != 0)
+    fprintf (file, _("\
+  -z mark-plt                 Mark PLT with dynamic tags (default)\n\
+  -z nomark-plt               Do not mark PLT with dynamic tags\n"));
+  else
+    fprintf (file, _("\
   -z mark-plt                 Mark PLT with dynamic tags\n\
   -z nomark-plt               Do not mark PLT with dynamic tags (default)\n"));
 '
diff --git a/ld/emultempl/elf-x86.em b/ld/emultempl/elf-x86.em
index 0ccad72ab9a..a6eda14253f 100644
--- a/ld/emultempl/elf-x86.em
+++ b/ld/emultempl/elf-x86.em
@@ -56,3 +56,20 @@ EOF
 
 LDEMUL_BEFORE_PARSE=elf_x86_before_parse
 fi
+
+case x${OUTPUT_FORMAT} in
+  x*x86-64*)
+fragment <<EOF
+
+static void
+elf_x86_64_before_parse (void)
+{
+  params.mark_plt = DEFAULT_LD_Z_MARK_PLT;
+
+  elf_x86_before_parse ();
+}
+EOF
+
+    LDEMUL_BEFORE_PARSE=elf_x86_64_before_parse
+    ;;
+esac
diff --git a/ld/testsuite/ld-elf/indirect-extern-access-2.rd b/ld/testsuite/ld-elf/indirect-extern-access-2.rd
index 9c7d72fae25..89c9e2ed336 100644
--- a/ld/testsuite/ld-elf/indirect-extern-access-2.rd
+++ b/ld/testsuite/ld-elf/indirect-extern-access-2.rd
@@ -1,5 +1,5 @@
 #...
-[a-f0-9]+ +[0-9a-f]+ +R_.*_JUMP_SLO(T|) +[a-f0-9]+ +indirect_extern_access( \+ 0|)
+[a-f0-9]+ +[0-9a-f]+ +R_.*_JUMP_SLO(T|) +[a-f0-9]+ +indirect_extern_access( \+ [a-f0-9]+|)
 #...
 Displaying notes found in: .note.gnu.property
 [ 	]+Owner[ 	]+Data size[ 	]+Description
diff --git a/ld/testsuite/ld-elf/pr23161d.rd b/ld/testsuite/ld-elf/pr23161d.rd
index 338cfad336b..e7756b3f61b 100644
--- a/ld/testsuite/ld-elf/pr23161d.rd
+++ b/ld/testsuite/ld-elf/pr23161d.rd
@@ -1,6 +1,6 @@
 Relocation section '\.rel(a|)\.plt' at offset 0x[0-9a-f]+ contains 1 entry:
  +Offset +Info +Type +Sym.* Value +Sym.* Name( \+ Addend|)
-[a-f0-9]+ +[0-9a-f]+ +R_.*_JUMP_SLOT +[a-f0-9]+ +foo( \+ 0|)
+[a-f0-9]+ +[0-9a-f]+ +R_.*_JUMP_SLOT +[a-f0-9]+ +foo( \+ [a-f0-9]+|)
 
 Symbol table '\.dynsym' contains [0-9]+ entries:
  +Num: +Value +Size Type +Bind +Vis +Ndx Name
diff --git a/ld/testsuite/ld-ifunc/ifunc-16-x86-64-now.d b/ld/testsuite/ld-ifunc/ifunc-16-x86-64-now.d
index db6c0e285a1..32ab488ca7a 100644
--- a/ld/testsuite/ld-ifunc/ifunc-16-x86-64-now.d
+++ b/ld/testsuite/ld-ifunc/ifunc-16-x86-64-now.d
@@ -1,6 +1,6 @@
 #source: ifunc-16-x86.s
 #as: --64
-#ld: -z now -shared -melf_x86_64
+#ld: -z now -z nomark-plt -shared -melf_x86_64
 #readelf: -r --wide
 #target: x86_64-*-*
 
diff --git a/ld/testsuite/ld-ifunc/ifunc-16-x86-64.d b/ld/testsuite/ld-ifunc/ifunc-16-x86-64.d
index d69626d3021..06c1ed90b92 100644
--- a/ld/testsuite/ld-ifunc/ifunc-16-x86-64.d
+++ b/ld/testsuite/ld-ifunc/ifunc-16-x86-64.d
@@ -1,6 +1,6 @@
 #source: ifunc-16-x86.s
 #as: --64
-#ld: -shared -melf_x86_64
+#ld: -z nomark-plt -shared -melf_x86_64
 #readelf: -r --wide
 #target: x86_64-*-*
 
diff --git a/ld/testsuite/ld-ifunc/ifunc-2-local-x86-64-now.d b/ld/testsuite/ld-ifunc/ifunc-2-local-x86-64-now.d
index e038b37a6d6..6d98d66ebd4 100644
--- a/ld/testsuite/ld-ifunc/ifunc-2-local-x86-64-now.d
+++ b/ld/testsuite/ld-ifunc/ifunc-2-local-x86-64-now.d
@@ -1,6 +1,6 @@
 #source: ifunc-2-local-x86-64.s
 #as: --64
-#ld: -z now -shared -melf_x86_64 --hash-style=sysv -z max-page-size=0x200000 -z noseparate-code $NO_DT_RELR_LDFLAGS
+#ld: -z now -shared -melf_x86_64 --hash-style=sysv -z max-page-size=0x200000 -z noseparate-code -z nomark-plt $NO_DT_RELR_LDFLAGS
 #objdump: -dw
 #target: x86_64-*-*
 
diff --git a/ld/testsuite/ld-ifunc/ifunc-2-local-x86-64.d b/ld/testsuite/ld-ifunc/ifunc-2-local-x86-64.d
index 14a57280327..4d2f4bff82c 100644
--- a/ld/testsuite/ld-ifunc/ifunc-2-local-x86-64.d
+++ b/ld/testsuite/ld-ifunc/ifunc-2-local-x86-64.d
@@ -1,5 +1,5 @@
 #as: --64
-#ld: -shared -melf_x86_64 --hash-style=sysv -z noseparate-code
+#ld: -shared -melf_x86_64 --hash-style=sysv -z noseparate-code -z nomark-plt
 #objdump: -dw
 #target: x86_64-*-*
 
diff --git a/ld/testsuite/ld-ifunc/ifunc-2-x86-64-now.d b/ld/testsuite/ld-ifunc/ifunc-2-x86-64-now.d
index 47db0125612..8b248d393b0 100644
--- a/ld/testsuite/ld-ifunc/ifunc-2-x86-64-now.d
+++ b/ld/testsuite/ld-ifunc/ifunc-2-x86-64-now.d
@@ -1,6 +1,6 @@
 #source: ifunc-2-x86-64.s
 #as: --64
-#ld: -z now -shared -melf_x86_64 --hash-style=sysv -z max-page-size=0x200000 -z noseparate-code $NO_DT_RELR_LDFLAGS
+#ld: -z now -shared -melf_x86_64 --hash-style=sysv -z max-page-size=0x200000 -z noseparate-code -z nomark-plt $NO_DT_RELR_LDFLAGS
 #objdump: -dw
 #target: x86_64-*-*
 
diff --git a/ld/testsuite/ld-ifunc/ifunc-2-x86-64.d b/ld/testsuite/ld-ifunc/ifunc-2-x86-64.d
index 2a1f2698a2a..8eb7583a3d3 100644
--- a/ld/testsuite/ld-ifunc/ifunc-2-x86-64.d
+++ b/ld/testsuite/ld-ifunc/ifunc-2-x86-64.d
@@ -1,5 +1,5 @@
 #as: --64
-#ld: -shared -melf_x86_64 --hash-style=sysv -z max-page-size=0x200000 -z noseparate-code
+#ld: -shared -melf_x86_64 --hash-style=sysv -z max-page-size=0x200000 -z noseparate-code -z nomark-plt
 #objdump: -dw
 #target: x86_64-*-*
 
diff --git a/ld/testsuite/ld-ifunc/ifunc-20-x86-64.d b/ld/testsuite/ld-ifunc/ifunc-20-x86-64.d
index 0ea46a6a2d2..5cd12aa4e3f 100644
--- a/ld/testsuite/ld-ifunc/ifunc-20-x86-64.d
+++ b/ld/testsuite/ld-ifunc/ifunc-20-x86-64.d
@@ -1,5 +1,5 @@
 #source: ifunc-20.s
-#ld: -shared -m elf_x86_64 -z nocombreloc
+#ld: -shared -m elf_x86_64 -z nocombreloc -z nomark-plt
 #as: --64
 #readelf: -r --wide
 #target: x86_64-*-*
diff --git a/ld/testsuite/ld-ifunc/ifunc-25c-x86.d b/ld/testsuite/ld-ifunc/ifunc-25c-x86.d
index e2401a9f160..c278c5784d6 100644
--- a/ld/testsuite/ld-ifunc/ifunc-25c-x86.d
+++ b/ld/testsuite/ld-ifunc/ifunc-25c-x86.d
@@ -9,4 +9,4 @@ Relocation section '.rel(a|).dyn' at offset 0x[0-9a-f]+ contains 1 entry:
 
 Relocation section '.rel(a|).plt' at offset 0x[0-9a-f]+ contains 1 entry:
  +Offset +Info +Type +Sym.* Value +Symbol's Name.*
-[0-9a-f]+[ ]+[0-9a-f]+[ ]+R_(386|X86_64)_JUMP_SLOT +foo\(\) +foo( \+ 0|)
+[0-9a-f]+[ ]+[0-9a-f]+[ ]+R_(386|X86_64)_JUMP_SLOT +foo\(\) +foo( \+ [0-9a-f]+|)
diff --git a/ld/testsuite/ld-ifunc/ifunc-5b-x86-64.d b/ld/testsuite/ld-ifunc/ifunc-5b-x86-64.d
index 02aff6b7c85..715271f65ff 100644
--- a/ld/testsuite/ld-ifunc/ifunc-5b-x86-64.d
+++ b/ld/testsuite/ld-ifunc/ifunc-5b-x86-64.d
@@ -1,6 +1,6 @@
 #source: ifunc-5-x86-64.s
 #as: --64
-#ld: -melf_x86_64 -shared -z nocombreloc
+#ld: -melf_x86_64 -shared -z nocombreloc -z nomark-plt
 #readelf: -r --wide
 #target: x86_64-*-*
 
diff --git a/ld/testsuite/ld-ifunc/pr17154-x86-64-now.d b/ld/testsuite/ld-ifunc/pr17154-x86-64-now.d
index f6920272b63..4d2ae8413f2 100644
--- a/ld/testsuite/ld-ifunc/pr17154-x86-64-now.d
+++ b/ld/testsuite/ld-ifunc/pr17154-x86-64-now.d
@@ -1,6 +1,6 @@
 #source: pr17154-x86.s
 #as: --64
-#ld: -z now -shared -melf_x86_64 --hash-style=sysv -z max-page-size=0x200000 -z noseparate-code $NO_DT_RELR_LDFLAGS
+#ld: -z now -shared -melf_x86_64 --hash-style=sysv -z max-page-size=0x200000 -z noseparate-code -z nomark-plt $NO_DT_RELR_LDFLAGS
 #objdump: -dw
 #target: x86_64-*-*
 
diff --git a/ld/testsuite/ld-ifunc/pr17154-x86-64.d b/ld/testsuite/ld-ifunc/pr17154-x86-64.d
index 90918426ee5..fbe6e225d5c 100644
--- a/ld/testsuite/ld-ifunc/pr17154-x86-64.d
+++ b/ld/testsuite/ld-ifunc/pr17154-x86-64.d
@@ -1,6 +1,6 @@
 #source: pr17154-x86.s
 #as: --64
-#ld: -shared -melf_x86_64 --hash-style=sysv -z max-page-size=0x200000 -z noseparate-code $NO_DT_RELR_LDFLAGS
+#ld: -shared -melf_x86_64 --hash-style=sysv -z max-page-size=0x200000 -z noseparate-code -z nomark-plt $NO_DT_RELR_LDFLAGS
 #objdump: -dw
 #target: x86_64-*-*
 
diff --git a/ld/testsuite/ld-x86-64/x86-64.exp b/ld/testsuite/ld-x86-64/x86-64.exp
index f656218df41..06fbb73bc26 100644
--- a/ld/testsuite/ld-x86-64/x86-64.exp
+++ b/ld/testsuite/ld-x86-64/x86-64.exp
@@ -30,6 +30,33 @@ set emul "elf_x86_64"
 set saved_ASFLAGS "$ASFLAGS"
 set ASFLAGS "$ASFLAGS -mx86-used-note=no"
 
+# Don't add the unsupported -z nomark-plt linker option to i386 tests.
+run_ld_link_tests [list \
+    [list \
+	"Helper 32bit object 1" \
+	"-r -melf_i386" \
+	"" \
+	"--32" \
+	{mixed1b.s} \
+	{} \
+	"libmixe1b.o" \
+    ] \
+    [list \
+	"Helper 32bit object 2" \
+	"-r -melf_i386" \
+	"" \
+	"--32" \
+	{mixed2b.s} \
+	{} \
+	"libmixe2b.o" \
+    ] \
+]
+
+run_dump_test "ia32-1"
+
+set saved_LDFLAGS "$LDFLAGS"
+set LDFLAGS "$LDFLAGS -z nomark-plt"
+
 # List contains test-items with 3 items followed by 2 lists:
 # 0:name 1:ld early options 2:ld late options 3:assembler options
 # 4:filenames of assembler files 5: action and options. 6: name of output file
@@ -88,12 +115,8 @@ set x86_64tests {
      {{objdump -dwr tlsie1.dd}} "tlsie1"}
     {"Helper 64bit object 1" "-r -melf_x86_64" ""
      "--64" {mixed1a.s} {} "libmixe1a.o"}
-    {"Helper 32bit object 1" "-r -melf_i386" ""
-     "--32" {mixed1b.s} {} "libmixe1b.o"}
     {"Helper 64bit object 2" "-r -melf_x86_64" ""
      "--64" {mixed2a.s} {} "libmixe2a.o"}
-    {"Helper 32bit object 2" "-r -melf_i386" ""
-     "--32" {mixed2b.s} {} "libmixe2b.o"}
     {"Split by file with 'l' flag on section."
      "-split-by-file -r -melf_x86_64" ""
      "--64" {split-by-file1.s split-by-file2.s}
@@ -559,7 +582,6 @@ run_dump_test "ilp32-9"
 run_dump_test "ilp32-10"
 run_dump_test "ilp32-11"
 run_dump_test "ilp32-12"
-run_dump_test "ia32-1"
 run_dump_test "ia32-2"
 run_dump_test "ia32-3"
 run_dump_test "lp64-1"
@@ -2266,3 +2288,4 @@ if { [check_compiler_available] } {
 }
 
 set ASFLAGS "$saved_ASFLAGS"
+set LDFLAGS "$saved_LDFLAGS"
-- 
2.43.0


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH 2/2] ld: Add --enable-make-plt configure option
  2024-01-05 21:50 ` [PATCH 2/2] ld: Add --enable-make-plt configure option H.J. Lu
@ 2024-01-06 14:41   ` H.J. Lu
  0 siblings, 0 replies; 4+ messages in thread
From: H.J. Lu @ 2024-01-06 14:41 UTC (permalink / raw)
  To: binutils

On Fri, Jan 5, 2024 at 1:50 PM H.J. Lu <hjl.tools@gmail.com> wrote:
>
> Add --enable-make-plt linker configure option to mark PLT entries with
> DT_X86_64_PLT, DT_X86_64_PLTSZ and DT_X86_64_PLTENT dynamic tags by
> default.
>
>         * NEWS: Mention -z mark-plt/-z nomark-plt and --enable-make-plt.
>         * config.in: Regenerated.
>         * configure: Likewise.
>         * configure.ac: Add --enable-make-plt.
>         (DEFAULT_LD_Z_MARK_PLT): New AC_DEFINE_UNQUOTED.
>         * emulparams/x86-64-plt.sh (PARSE_AND_LIST_OPTIONS_X86_64_PLT):
>         Support DEFAULT_LD_Z_MARK_PLT.
>         * emultempl/elf-x86.em (elf_x86_64_before_parse): New function.
>         (LDEMUL_BEFORE_PARSE): New.  Set to elf_x86_64_before_parse for
>         x86-64 targets.
>         * testsuite/ld-elf/indirect-extern-access-2.rd: Allow non-zero
>         r_addend for JUMP_SLOT relocation.
>         * testsuite/ld-elf/pr23161d.rd: Likewise.
>         * testsuite/ld-ifunc/ifunc-25c-x86.d: Likewise.
>         * testsuite/ld-ifunc/ifunc-16-x86-64-now.d: Pass -z nomark-plt
>         to linker.
>         * testsuite/ld-ifunc/ifunc-16-x86-64.d: Likewise.
>         * testsuite/ld-ifunc/ifunc-2-local-x86-64-now.d: Likewise.
>         * testsuite/ld-ifunc/ifunc-2-local-x86-64.d: Likewise.
>         * testsuite/ld-ifunc/ifunc-2-x86-64-now.d: Likewise.
>         * testsuite/ld-ifunc/ifunc-2-x86-64.d: Likewise.
>         * testsuite/ld-ifunc/ifunc-20-x86-64.d: Likewise.
>         * testsuite/ld-ifunc/ifunc-5b-x86-64.d: Likewise.
>         * testsuite/ld-ifunc/pr17154-x86-64-now.d: Likewise.
>         * testsuite/ld-ifunc/pr17154-x86-64.d: Likewise.
>         * testsuite/ld-x86-64/x86-64.exp (LDFLAGS): Save and restore
>         the original linker flags.  Append -z nomark-plt.
>         Run i386 tests before appending -z nomark-plt to LDFLAGS.
> ---
>  ld/NEWS                                       |  5 +++
>  ld/config.in                                  |  4 +++
>  ld/configure                                  | 26 +++++++++++++--
>  ld/configure.ac                               | 17 ++++++++++
>  ld/emulparams/x86-64-plt.sh                   |  7 +++-
>  ld/emultempl/elf-x86.em                       | 17 ++++++++++
>  .../ld-elf/indirect-extern-access-2.rd        |  2 +-
>  ld/testsuite/ld-elf/pr23161d.rd               |  2 +-
>  ld/testsuite/ld-ifunc/ifunc-16-x86-64-now.d   |  2 +-
>  ld/testsuite/ld-ifunc/ifunc-16-x86-64.d       |  2 +-
>  .../ld-ifunc/ifunc-2-local-x86-64-now.d       |  2 +-
>  ld/testsuite/ld-ifunc/ifunc-2-local-x86-64.d  |  2 +-
>  ld/testsuite/ld-ifunc/ifunc-2-x86-64-now.d    |  2 +-
>  ld/testsuite/ld-ifunc/ifunc-2-x86-64.d        |  2 +-
>  ld/testsuite/ld-ifunc/ifunc-20-x86-64.d       |  2 +-
>  ld/testsuite/ld-ifunc/ifunc-25c-x86.d         |  2 +-
>  ld/testsuite/ld-ifunc/ifunc-5b-x86-64.d       |  2 +-
>  ld/testsuite/ld-ifunc/pr17154-x86-64-now.d    |  2 +-
>  ld/testsuite/ld-ifunc/pr17154-x86-64.d        |  2 +-
>  ld/testsuite/ld-x86-64/x86-64.exp             | 33 ++++++++++++++++---
>  20 files changed, 114 insertions(+), 21 deletions(-)
>
> diff --git a/ld/NEWS b/ld/NEWS
> index a2c0b7fbcfe..3d3bb59b71b 100644
> --- a/ld/NEWS
> +++ b/ld/NEWS
> @@ -1,5 +1,10 @@
>  -*- text -*-
>
> +* Add -z mark-plt/-z nomark-plt options to x86-64 ELF linker to mark PLT
> +  entries with DT_X86_64_PLT, DT_X86_64_PLTSZ and DT_X86_64_PLTENT dynamic
> +  tags.  Also added --enable-make-plt configure option to mark PLT entries
> +  by default.
> +
>  * Support Intel APX relocations.
>
>  * On RISC-V, add ld target option --[no-]check-uleb128.  Should rebuild the
> diff --git a/ld/config.in b/ld/config.in
> index 86d90d53752..52d62f06ff0 100644
> --- a/ld/config.in
> +++ b/ld/config.in
> @@ -45,6 +45,10 @@
>     default. */
>  #undef DEFAULT_LD_WARN_RWX_SEGMENTS
>
> +/* Define to 1 if you want to enable -z mark-plt in ELF x86-64 linker by
> +   default. */
> +#undef DEFAULT_LD_Z_MARK_PLT
> +
>  /* Define to 1 if you want to enable -z relro in ELF linker by default. */
>  #undef DEFAULT_LD_Z_RELRO
>
> diff --git a/ld/configure b/ld/configure
> index 07eb669d906..d01dbfae296 100755
> --- a/ld/configure
> +++ b/ld/configure
> @@ -852,6 +852,7 @@ enable_new_dtags
>  enable_relro
>  enable_textrel_check
>  enable_separate_code
> +enable_mark_plt
>  enable_warn_execstack
>  enable_error_execstack
>  enable_warn_rwx_segments
> @@ -1546,6 +1547,7 @@ Optional Features:
>    --enable-textrel-check=[yes|no|warning|error]
>                            enable DT_TEXTREL check in ELF linker
>    --enable-separate-code  enable -z separate-code in ELF linker by default
> +  --enable-make-plt       enable -z mark-plt in ELF x86-64 linker by default
>    --enable-warn-execstack enable warnings when creating an executable stack
>    --enable-error-execstack
>                            turn executable stack warnings into errors
> @@ -11681,7 +11683,7 @@ else
>    lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
>    lt_status=$lt_dlunknown
>    cat > conftest.$ac_ext <<_LT_EOF
> -#line 11684 "configure"
> +#line 11686 "configure"
>  #include "confdefs.h"
>
>  #if HAVE_DLFCN_H
> @@ -11787,7 +11789,7 @@ else
>    lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
>    lt_status=$lt_dlunknown
>    cat > conftest.$ac_ext <<_LT_EOF
> -#line 11790 "configure"
> +#line 11792 "configure"
>  #include "confdefs.h"
>
>  #if HAVE_DLFCN_H
> @@ -15682,6 +15684,17 @@ esac
>  fi
>
>
> +# Decide if -z mark-plt should be enabled in ELF x86-64 linker by default.
> +ac_default_ld_z_mark_plt=unset
> +# Check whether --enable-mark-plt was given.
> +if test "${enable_mark_plt+set}" = set; then :
> +  enableval=$enable_mark_plt; case "${enableval}" in
> +  yes) ac_default_ld_z_mark_plt=1 ;;
> +  no) ac_default_ld_z_mark_plt=0 ;;
> +esac
> +fi
> +
> +
>
>  # By default warn when an executable stack is created due to object files
>  # requesting such, not when the user specifies -z execstack.
> @@ -19365,6 +19378,15 @@ cat >>confdefs.h <<_ACEOF
>  _ACEOF
>
>
> +if test "${ac_default_ld_z_mark_plt}" = unset; then
> +  ac_default_ld_z_mark_plt=0
> +fi
> +
> +cat >>confdefs.h <<_ACEOF
> +#define DEFAULT_LD_Z_MARK_PLT $ac_default_ld_z_mark_plt
> +_ACEOF
> +
> +
>
>
>  cat >>confdefs.h <<_ACEOF
> diff --git a/ld/configure.ac b/ld/configure.ac
> index b46f415fe9b..9036090889e 100644
> --- a/ld/configure.ac
> +++ b/ld/configure.ac
> @@ -213,6 +213,16 @@ AC_ARG_ENABLE(separate-code,
>    no) ac_default_ld_z_separate_code=0 ;;
>  esac])
>
> +# Decide if -z mark-plt should be enabled in ELF x86-64 linker by default.
> +ac_default_ld_z_mark_plt=unset
> +AC_ARG_ENABLE(mark-plt,
> +             AS_HELP_STRING([--enable-make-plt],
> +             [enable -z mark-plt in ELF x86-64 linker by default]),
> +[case "${enableval}" in
> +  yes) ac_default_ld_z_mark_plt=1 ;;
> +  no) ac_default_ld_z_mark_plt=0 ;;
> +esac])
> +
>
>  # By default warn when an executable stack is created due to object files
>  # requesting such, not when the user specifies -z execstack.
> @@ -562,6 +572,13 @@ AC_DEFINE_UNQUOTED(DEFAULT_LD_Z_SEPARATE_CODE,
>    $ac_default_ld_z_separate_code,
>    [Define to 1 if you want to enable -z separate-code in ELF linker by default.])
>
> +if test "${ac_default_ld_z_mark_plt}" = unset; then
> +  ac_default_ld_z_mark_plt=0
> +fi
> +AC_DEFINE_UNQUOTED(DEFAULT_LD_Z_MARK_PLT,
> +  $ac_default_ld_z_mark_plt,
> +  [Define to 1 if you want to enable -z mark-plt in ELF x86-64 linker by default.])
> +
>
>  AC_DEFINE_UNQUOTED(DEFAULT_LD_WARN_EXECSTACK,
>    $ac_default_ld_warn_execstack,
> diff --git a/ld/emulparams/x86-64-plt.sh b/ld/emulparams/x86-64-plt.sh
> index 92732401dc7..d1a5c65937f 100644
> --- a/ld/emulparams/x86-64-plt.sh
> +++ b/ld/emulparams/x86-64-plt.sh
> @@ -1,5 +1,10 @@
>  PARSE_AND_LIST_OPTIONS_X86_64_PLT='
> -  fprintf (file, _("\
> +  if (DEFAULT_LD_Z_MARK_PLT != 0)
> +    fprintf (file, _("\
> +  -z mark-plt                 Mark PLT with dynamic tags (default)\n\
> +  -z nomark-plt               Do not mark PLT with dynamic tags\n"));
> +  else
> +    fprintf (file, _("\
>    -z mark-plt                 Mark PLT with dynamic tags\n\
>    -z nomark-plt               Do not mark PLT with dynamic tags (default)\n"));
>  '
> diff --git a/ld/emultempl/elf-x86.em b/ld/emultempl/elf-x86.em
> index 0ccad72ab9a..a6eda14253f 100644
> --- a/ld/emultempl/elf-x86.em
> +++ b/ld/emultempl/elf-x86.em
> @@ -56,3 +56,20 @@ EOF
>
>  LDEMUL_BEFORE_PARSE=elf_x86_before_parse
>  fi
> +
> +case x${OUTPUT_FORMAT} in
> +  x*x86-64*)
> +fragment <<EOF
> +
> +static void
> +elf_x86_64_before_parse (void)
> +{
> +  params.mark_plt = DEFAULT_LD_Z_MARK_PLT;
> +
> +  elf_x86_before_parse ();
> +}
> +EOF
> +
> +    LDEMUL_BEFORE_PARSE=elf_x86_64_before_parse
> +    ;;
> +esac
> diff --git a/ld/testsuite/ld-elf/indirect-extern-access-2.rd b/ld/testsuite/ld-elf/indirect-extern-access-2.rd
> index 9c7d72fae25..89c9e2ed336 100644
> --- a/ld/testsuite/ld-elf/indirect-extern-access-2.rd
> +++ b/ld/testsuite/ld-elf/indirect-extern-access-2.rd
> @@ -1,5 +1,5 @@
>  #...
> -[a-f0-9]+ +[0-9a-f]+ +R_.*_JUMP_SLO(T|) +[a-f0-9]+ +indirect_extern_access( \+ 0|)
> +[a-f0-9]+ +[0-9a-f]+ +R_.*_JUMP_SLO(T|) +[a-f0-9]+ +indirect_extern_access( \+ [a-f0-9]+|)
>  #...
>  Displaying notes found in: .note.gnu.property
>  [      ]+Owner[        ]+Data size[    ]+Description
> diff --git a/ld/testsuite/ld-elf/pr23161d.rd b/ld/testsuite/ld-elf/pr23161d.rd
> index 338cfad336b..e7756b3f61b 100644
> --- a/ld/testsuite/ld-elf/pr23161d.rd
> +++ b/ld/testsuite/ld-elf/pr23161d.rd
> @@ -1,6 +1,6 @@
>  Relocation section '\.rel(a|)\.plt' at offset 0x[0-9a-f]+ contains 1 entry:
>   +Offset +Info +Type +Sym.* Value +Sym.* Name( \+ Addend|)
> -[a-f0-9]+ +[0-9a-f]+ +R_.*_JUMP_SLOT +[a-f0-9]+ +foo( \+ 0|)
> +[a-f0-9]+ +[0-9a-f]+ +R_.*_JUMP_SLOT +[a-f0-9]+ +foo( \+ [a-f0-9]+|)
>
>  Symbol table '\.dynsym' contains [0-9]+ entries:
>   +Num: +Value +Size Type +Bind +Vis +Ndx Name
> diff --git a/ld/testsuite/ld-ifunc/ifunc-16-x86-64-now.d b/ld/testsuite/ld-ifunc/ifunc-16-x86-64-now.d
> index db6c0e285a1..32ab488ca7a 100644
> --- a/ld/testsuite/ld-ifunc/ifunc-16-x86-64-now.d
> +++ b/ld/testsuite/ld-ifunc/ifunc-16-x86-64-now.d
> @@ -1,6 +1,6 @@
>  #source: ifunc-16-x86.s
>  #as: --64
> -#ld: -z now -shared -melf_x86_64
> +#ld: -z now -z nomark-plt -shared -melf_x86_64
>  #readelf: -r --wide
>  #target: x86_64-*-*
>
> diff --git a/ld/testsuite/ld-ifunc/ifunc-16-x86-64.d b/ld/testsuite/ld-ifunc/ifunc-16-x86-64.d
> index d69626d3021..06c1ed90b92 100644
> --- a/ld/testsuite/ld-ifunc/ifunc-16-x86-64.d
> +++ b/ld/testsuite/ld-ifunc/ifunc-16-x86-64.d
> @@ -1,6 +1,6 @@
>  #source: ifunc-16-x86.s
>  #as: --64
> -#ld: -shared -melf_x86_64
> +#ld: -z nomark-plt -shared -melf_x86_64
>  #readelf: -r --wide
>  #target: x86_64-*-*
>
> diff --git a/ld/testsuite/ld-ifunc/ifunc-2-local-x86-64-now.d b/ld/testsuite/ld-ifunc/ifunc-2-local-x86-64-now.d
> index e038b37a6d6..6d98d66ebd4 100644
> --- a/ld/testsuite/ld-ifunc/ifunc-2-local-x86-64-now.d
> +++ b/ld/testsuite/ld-ifunc/ifunc-2-local-x86-64-now.d
> @@ -1,6 +1,6 @@
>  #source: ifunc-2-local-x86-64.s
>  #as: --64
> -#ld: -z now -shared -melf_x86_64 --hash-style=sysv -z max-page-size=0x200000 -z noseparate-code $NO_DT_RELR_LDFLAGS
> +#ld: -z now -shared -melf_x86_64 --hash-style=sysv -z max-page-size=0x200000 -z noseparate-code -z nomark-plt $NO_DT_RELR_LDFLAGS
>  #objdump: -dw
>  #target: x86_64-*-*
>
> diff --git a/ld/testsuite/ld-ifunc/ifunc-2-local-x86-64.d b/ld/testsuite/ld-ifunc/ifunc-2-local-x86-64.d
> index 14a57280327..4d2f4bff82c 100644
> --- a/ld/testsuite/ld-ifunc/ifunc-2-local-x86-64.d
> +++ b/ld/testsuite/ld-ifunc/ifunc-2-local-x86-64.d
> @@ -1,5 +1,5 @@
>  #as: --64
> -#ld: -shared -melf_x86_64 --hash-style=sysv -z noseparate-code
> +#ld: -shared -melf_x86_64 --hash-style=sysv -z noseparate-code -z nomark-plt
>  #objdump: -dw
>  #target: x86_64-*-*
>
> diff --git a/ld/testsuite/ld-ifunc/ifunc-2-x86-64-now.d b/ld/testsuite/ld-ifunc/ifunc-2-x86-64-now.d
> index 47db0125612..8b248d393b0 100644
> --- a/ld/testsuite/ld-ifunc/ifunc-2-x86-64-now.d
> +++ b/ld/testsuite/ld-ifunc/ifunc-2-x86-64-now.d
> @@ -1,6 +1,6 @@
>  #source: ifunc-2-x86-64.s
>  #as: --64
> -#ld: -z now -shared -melf_x86_64 --hash-style=sysv -z max-page-size=0x200000 -z noseparate-code $NO_DT_RELR_LDFLAGS
> +#ld: -z now -shared -melf_x86_64 --hash-style=sysv -z max-page-size=0x200000 -z noseparate-code -z nomark-plt $NO_DT_RELR_LDFLAGS
>  #objdump: -dw
>  #target: x86_64-*-*
>
> diff --git a/ld/testsuite/ld-ifunc/ifunc-2-x86-64.d b/ld/testsuite/ld-ifunc/ifunc-2-x86-64.d
> index 2a1f2698a2a..8eb7583a3d3 100644
> --- a/ld/testsuite/ld-ifunc/ifunc-2-x86-64.d
> +++ b/ld/testsuite/ld-ifunc/ifunc-2-x86-64.d
> @@ -1,5 +1,5 @@
>  #as: --64
> -#ld: -shared -melf_x86_64 --hash-style=sysv -z max-page-size=0x200000 -z noseparate-code
> +#ld: -shared -melf_x86_64 --hash-style=sysv -z max-page-size=0x200000 -z noseparate-code -z nomark-plt
>  #objdump: -dw
>  #target: x86_64-*-*
>
> diff --git a/ld/testsuite/ld-ifunc/ifunc-20-x86-64.d b/ld/testsuite/ld-ifunc/ifunc-20-x86-64.d
> index 0ea46a6a2d2..5cd12aa4e3f 100644
> --- a/ld/testsuite/ld-ifunc/ifunc-20-x86-64.d
> +++ b/ld/testsuite/ld-ifunc/ifunc-20-x86-64.d
> @@ -1,5 +1,5 @@
>  #source: ifunc-20.s
> -#ld: -shared -m elf_x86_64 -z nocombreloc
> +#ld: -shared -m elf_x86_64 -z nocombreloc -z nomark-plt
>  #as: --64
>  #readelf: -r --wide
>  #target: x86_64-*-*
> diff --git a/ld/testsuite/ld-ifunc/ifunc-25c-x86.d b/ld/testsuite/ld-ifunc/ifunc-25c-x86.d
> index e2401a9f160..c278c5784d6 100644
> --- a/ld/testsuite/ld-ifunc/ifunc-25c-x86.d
> +++ b/ld/testsuite/ld-ifunc/ifunc-25c-x86.d
> @@ -9,4 +9,4 @@ Relocation section '.rel(a|).dyn' at offset 0x[0-9a-f]+ contains 1 entry:
>
>  Relocation section '.rel(a|).plt' at offset 0x[0-9a-f]+ contains 1 entry:
>   +Offset +Info +Type +Sym.* Value +Symbol's Name.*
> -[0-9a-f]+[ ]+[0-9a-f]+[ ]+R_(386|X86_64)_JUMP_SLOT +foo\(\) +foo( \+ 0|)
> +[0-9a-f]+[ ]+[0-9a-f]+[ ]+R_(386|X86_64)_JUMP_SLOT +foo\(\) +foo( \+ [0-9a-f]+|)
> diff --git a/ld/testsuite/ld-ifunc/ifunc-5b-x86-64.d b/ld/testsuite/ld-ifunc/ifunc-5b-x86-64.d
> index 02aff6b7c85..715271f65ff 100644
> --- a/ld/testsuite/ld-ifunc/ifunc-5b-x86-64.d
> +++ b/ld/testsuite/ld-ifunc/ifunc-5b-x86-64.d
> @@ -1,6 +1,6 @@
>  #source: ifunc-5-x86-64.s
>  #as: --64
> -#ld: -melf_x86_64 -shared -z nocombreloc
> +#ld: -melf_x86_64 -shared -z nocombreloc -z nomark-plt
>  #readelf: -r --wide
>  #target: x86_64-*-*
>
> diff --git a/ld/testsuite/ld-ifunc/pr17154-x86-64-now.d b/ld/testsuite/ld-ifunc/pr17154-x86-64-now.d
> index f6920272b63..4d2ae8413f2 100644
> --- a/ld/testsuite/ld-ifunc/pr17154-x86-64-now.d
> +++ b/ld/testsuite/ld-ifunc/pr17154-x86-64-now.d
> @@ -1,6 +1,6 @@
>  #source: pr17154-x86.s
>  #as: --64
> -#ld: -z now -shared -melf_x86_64 --hash-style=sysv -z max-page-size=0x200000 -z noseparate-code $NO_DT_RELR_LDFLAGS
> +#ld: -z now -shared -melf_x86_64 --hash-style=sysv -z max-page-size=0x200000 -z noseparate-code -z nomark-plt $NO_DT_RELR_LDFLAGS
>  #objdump: -dw
>  #target: x86_64-*-*
>
> diff --git a/ld/testsuite/ld-ifunc/pr17154-x86-64.d b/ld/testsuite/ld-ifunc/pr17154-x86-64.d
> index 90918426ee5..fbe6e225d5c 100644
> --- a/ld/testsuite/ld-ifunc/pr17154-x86-64.d
> +++ b/ld/testsuite/ld-ifunc/pr17154-x86-64.d
> @@ -1,6 +1,6 @@
>  #source: pr17154-x86.s
>  #as: --64
> -#ld: -shared -melf_x86_64 --hash-style=sysv -z max-page-size=0x200000 -z noseparate-code $NO_DT_RELR_LDFLAGS
> +#ld: -shared -melf_x86_64 --hash-style=sysv -z max-page-size=0x200000 -z noseparate-code -z nomark-plt $NO_DT_RELR_LDFLAGS
>  #objdump: -dw
>  #target: x86_64-*-*
>
> diff --git a/ld/testsuite/ld-x86-64/x86-64.exp b/ld/testsuite/ld-x86-64/x86-64.exp
> index f656218df41..06fbb73bc26 100644
> --- a/ld/testsuite/ld-x86-64/x86-64.exp
> +++ b/ld/testsuite/ld-x86-64/x86-64.exp
> @@ -30,6 +30,33 @@ set emul "elf_x86_64"
>  set saved_ASFLAGS "$ASFLAGS"
>  set ASFLAGS "$ASFLAGS -mx86-used-note=no"
>
> +# Don't add the unsupported -z nomark-plt linker option to i386 tests.
> +run_ld_link_tests [list \
> +    [list \
> +       "Helper 32bit object 1" \
> +       "-r -melf_i386" \
> +       "" \
> +       "--32" \
> +       {mixed1b.s} \
> +       {} \
> +       "libmixe1b.o" \
> +    ] \
> +    [list \
> +       "Helper 32bit object 2" \
> +       "-r -melf_i386" \
> +       "" \
> +       "--32" \
> +       {mixed2b.s} \
> +       {} \
> +       "libmixe2b.o" \
> +    ] \
> +]
> +
> +run_dump_test "ia32-1"
> +
> +set saved_LDFLAGS "$LDFLAGS"
> +set LDFLAGS "$LDFLAGS -z nomark-plt"
> +
>  # List contains test-items with 3 items followed by 2 lists:
>  # 0:name 1:ld early options 2:ld late options 3:assembler options
>  # 4:filenames of assembler files 5: action and options. 6: name of output file
> @@ -88,12 +115,8 @@ set x86_64tests {
>       {{objdump -dwr tlsie1.dd}} "tlsie1"}
>      {"Helper 64bit object 1" "-r -melf_x86_64" ""
>       "--64" {mixed1a.s} {} "libmixe1a.o"}
> -    {"Helper 32bit object 1" "-r -melf_i386" ""
> -     "--32" {mixed1b.s} {} "libmixe1b.o"}
>      {"Helper 64bit object 2" "-r -melf_x86_64" ""
>       "--64" {mixed2a.s} {} "libmixe2a.o"}
> -    {"Helper 32bit object 2" "-r -melf_i386" ""
> -     "--32" {mixed2b.s} {} "libmixe2b.o"}
>      {"Split by file with 'l' flag on section."
>       "-split-by-file -r -melf_x86_64" ""
>       "--64" {split-by-file1.s split-by-file2.s}
> @@ -559,7 +582,6 @@ run_dump_test "ilp32-9"
>  run_dump_test "ilp32-10"
>  run_dump_test "ilp32-11"
>  run_dump_test "ilp32-12"
> -run_dump_test "ia32-1"
>  run_dump_test "ia32-2"
>  run_dump_test "ia32-3"
>  run_dump_test "lp64-1"
> @@ -2266,3 +2288,4 @@ if { [check_compiler_available] } {
>  }
>
>  set ASFLAGS "$saved_ASFLAGS"
> +set LDFLAGS "$saved_LDFLAGS"
> --
> 2.43.0
>

There are some typos.  I will split this patch into 2 and will
check in a patch to add -z nomark-plt to x86 tests first.

-- 
H.J.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2024-01-06 14:42 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-01-05 21:50 [PATCH 0/2] Improve -z mark-plt H.J. Lu
2024-01-05 21:50 ` [PATCH 1/2] elf: Add elf_backend_add_glibc_version_dependency H.J. Lu
2024-01-05 21:50 ` [PATCH 2/2] ld: Add --enable-make-plt configure option H.J. Lu
2024-01-06 14:41   ` H.J. Lu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).