[2/2] ld: Add --enable-make-plt configure option

Message ID 20240105215015.1123568-3-hjl.tools@gmail.com
State New
Headers
Series Improve -z mark-plt |

Checks

Context Check Description
linaro-tcwg-bot/tcwg_binutils_build--master-arm success Testing passed
linaro-tcwg-bot/tcwg_binutils_build--master-aarch64 success Testing passed
linaro-tcwg-bot/tcwg_binutils_check--master-aarch64 success Testing passed
linaro-tcwg-bot/tcwg_binutils_check--master-arm success Testing passed

Commit Message

H.J. Lu Jan. 5, 2024, 9:50 p.m. UTC
  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(-)
  

Comments

H.J. Lu Jan. 6, 2024, 2:41 p.m. UTC | #1
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.
  

Patch

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"