[PATCH] gas, x86: add -mno-plt32 option to disable PLT32 relocations
H.J. Lu
hjl.tools@gmail.com
Fri Dec 10 15:29:37 GMT 2021
On Wed, Oct 20, 2021 at 2:59 AM Todor Buyukliev via Binutils
<binutils@sourceware.org> wrote:
>
> hi all,
>
> here’s a patch that we need. it’s against 2.34. can it be merged to master?
>
> regards,
> todor
1. Need an entry in NEWS.
2. Need document change.
3. -mno-plt32 option name is misleading. It doesn't disable PLT32 for
call foo@PLT
It just avoids PLT32 for
call foo
>
> [PATCH] gas, x86: add -mno-plt32 option to disable PLT32 relocations
>
> ---
> gas/ChangeLog | 9 +++++++++
> gas/config/tc-i386.c | 15 +++++++++++++++
> 2 files changed, 24 insertions(+)
>
> diff --git a/gas/ChangeLog b/gas/ChangeLog
> index ac92d076ef9..f70c8d45db9 100644
> --- a/gas/ChangeLog
> +++ b/gas/ChangeLog
> @@ -1,3 +1,12 @@
> +2021-05-28 Todor Buyukliev <tbuyukliev@vmware.com>
> +
> + * config/t-i386.c (disable_plt32): New declaration.
> + (md_show_usage): Add -mno-plt32.
> + (need_plt32_p): Return false if disable_plt32 is set.
> + (OPTION_MNO_PLT32): New define.
> + (md_longopts): Support mno-plt32 option.
> + (md_parse_option): Likewise.
> +
> 2020-02-10 H.J. Lu <hongjiu.lu@intel.com>
> PR gas/25516
> diff --git a/gas/config/tc-i386.c b/gas/config/tc-i386.c
> index 3f1d4cab7e5..1af97c0d149 100644
> --- a/gas/config/tc-i386.c
> +++ b/gas/config/tc-i386.c
> @@ -592,6 +592,9 @@ static int use_big_obj = 0;
> #if defined (OBJ_ELF) || defined (OBJ_MAYBE_ELF)
> /* 1 if generating code for a shared library. */
> static int shared = 0;
> +
> +/* Non-zero to disable PLT32 relocations. */
> +static int disable_plt32 = 0;
> #endif
> /* 1 for intel syntax,
> @@ -7991,6 +7994,10 @@ need_plt32_p (symbolS *s)
> return FALSE;
> #endif
> + /* Don't emit PLT32 relocation if asked to. */
> + if (disable_plt32)
> + return FALSE;
> +
> /* 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. */
> @@ -12051,6 +12058,7 @@ const char *md_shortopts = "qnO::";
> #define OPTION_MALIGN_BRANCH_PREFIX_SIZE (OPTION_MD_BASE + 28)
> #define OPTION_MALIGN_BRANCH (OPTION_MD_BASE + 29)
> #define OPTION_MBRANCHES_WITH_32B_BOUNDARIES (OPTION_MD_BASE + 30)
> +#define OPTION_MNO_PLT32 (OPTION_MD_BASE + 31)
> struct option md_longopts[] =
> {
> @@ -12063,6 +12071,7 @@ struct option md_longopts[] =
> {"x32", no_argument, NULL, OPTION_X32},
> {"mshared", no_argument, NULL, OPTION_MSHARED},
> {"mx86-used-note", required_argument, NULL, OPTION_X86_USED_NOTE},
> + {"mno-plt32", no_argument, NULL, OPTION_MNO_PLT32},
> #endif
> {"divide", no_argument, NULL, OPTION_DIVIDE},
> {"march", required_argument, NULL, OPTION_MARCH},
> @@ -12193,6 +12202,10 @@ md_parse_option (int c, const char *arg)
> else
> as_fatal (_("32bit x86_64 is only supported for ELF"));
> break;
> +
> + case OPTION_MNO_PLT32:
> + disable_plt32 = 1;
> + break;
> #endif
> case OPTION_32:
> @@ -12791,6 +12804,8 @@ md_show_usage (FILE *stream)
> fprintf (stream, _("(default: no)\n"));
> fprintf (stream, _("\
> generate x86 used ISA and feature properties\n"));
> + fprintf (stream, _("\
> + -mno-plt32 don't generate PLT32 relocations\n"));
> #endif
> #if defined (TE_PE) || defined (TE_PEP)
> fprintf (stream, _("\
> --
>
--
H.J.
More information about the Binutils
mailing list