From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pj1-x102e.google.com (mail-pj1-x102e.google.com [IPv6:2607:f8b0:4864:20::102e]) by sourceware.org (Postfix) with ESMTPS id 939E33858403 for ; Fri, 10 Dec 2021 15:30:13 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 939E33858403 Received: by mail-pj1-x102e.google.com with SMTP id np3so7060388pjb.4 for ; Fri, 10 Dec 2021 07:30:13 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=4IUzlrVT4jqejtmEk7lBc3LY4mAU/QXeN1yxsmrfGzQ=; b=0aUNkbnMcJv+gV5f+6dfpLMADx23RI6Ctd2z0tmbOxI9Id5QcHf7IscMRF9f+ERRj/ w+i4nzAM6hJ6LKupU8Nfo4cC8v9isepEoDaMXba7CFVN/ib9V3RvC7eBzVib5jJ/sgSt mrh+Z6Pl9XCaVLVfQop+/nsuIFHgyUai20Q3C1Hwy9qLbwzniEUjz6gc5Akv3F4ksvfc x/wQBkfyOdCGBIijT3oxNgqDlkrjkAbU+mtDJsZaltaAtLhhYOHzCHva8SE8lW1e0skx KVdbIhn3KUqGcsYbHoq9bIFhmHMd4PGhU89jEqOQBTJ2LH0WQBsc4RWTgIhDe7z912tp pWpQ== X-Gm-Message-State: AOAM532hN9qDxtMAW68CwN2rJPnFCy+XDjR+fkYPjd85qBkbmzSSx33M ljGI3FrY773nwgVnmnj6XDmmBvdltKTRk2jAfqwSKAiJR0o= X-Google-Smtp-Source: ABdhPJwXqrYCga7LFsTMz1u84ZuRo6xXlKSHE4LjaKFzj+vlKuIn/DkCtiEWNfbQoQ5l4ocOCIxj3PvHN5t+VWzJ3Pg= X-Received: by 2002:a17:90b:3b82:: with SMTP id pc2mr24862030pjb.120.1639150212725; Fri, 10 Dec 2021 07:30:12 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: From: "H.J. Lu" Date: Fri, 10 Dec 2021 07:29:37 -0800 Message-ID: Subject: Re: [PATCH] gas, x86: add -mno-plt32 option to disable PLT32 relocations To: Todor Buyukliev Cc: "binutils@sourceware.org" Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-3028.9 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: binutils@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Binutils mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 10 Dec 2021 15:30:15 -0000 On Wed, Oct 20, 2021 at 2:59 AM Todor Buyukliev via Binutils wrote: > > hi all, > > here=E2=80=99s a patch that we need. it=E2=80=99s 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 > + > + * 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 > 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 =3D 0; > #if defined (OBJ_ELF) || defined (OBJ_MAYBE_ELF) > /* 1 if generating code for a shared library. */ > static int shared =3D 0; > + > +/* Non-zero to disable PLT32 relocations. */ > +static int disable_plt32 =3D 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 =3D "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[] =3D > { > @@ -12063,6 +12071,7 @@ struct option md_longopts[] =3D > {"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 =3D 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, _("\ > -- > --=20 H.J.