This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: [PATCH] PR gold/17640
- From: "H.J. Lu" <hjl dot tools at gmail dot com>
- To: Ilya Tocar <tocarip dot intel at gmail dot com>
- Cc: Cary Coutant <ccoutant at google dot com>, Binutils <binutils at sourceware dot org>
- Date: Thu, 12 Mar 2015 07:44:28 -0700
- Subject: Re: [PATCH] PR gold/17640
- Authentication-results: sourceware.org; auth=none
- References: <CAHACq4poMBVYcg=nS01tPsLuNi=BdtL4gSTz5Q1-auGBX=zA-Q at mail dot gmail dot com> <20150226104626 dot GA16554 at msticlxl7 dot ims dot intel dot com> <CAHACq4ojyujhxYSsMaF_jSVWUg0=YgNawR6=6XYdZie1PMhXYQ at mail dot gmail dot com> <20150227142003 dot GA122934 at msticlxl7 dot ims dot intel dot com> <CAMe9rOrzXOu+CkT_A7XZLJ1MK_nqnMk69LjgXUSQ-FnS1fKsEQ at mail dot gmail dot com> <CAMe9rOq-uSd64h6eeogR3SywtQipMupN9Ng9-EvPLF+3bp7Exw at mail dot gmail dot com> <20150305104052 dot GA16361 at msticlxl7 dot ims dot intel dot com> <CAMe9rOqRQ+HMS12+hn9Nz0pnb95tUDmbAU2QjK9G1Rc-q=woCA at mail dot gmail dot com> <20150310112745 dot GA104717 at msticlxl7 dot ims dot intel dot com> <CAMe9rOoG6NOVLYxZBJ5KRuS9_47=ptsd=Ft9iA9HfN2Asw0UeQ at mail dot gmail dot com> <20150312143236 dot GA95320 at msticlxl7 dot ims dot intel dot com>
On Thu, Mar 12, 2015 at 7:33 AM, Ilya Tocar <tocarip.intel@gmail.com> wrote:
> I've rebased patch against current trunk, and removed blank lines.
> Ok for trunk?
>
> ---
> gold/ChangeLog | 16 +++++
> gold/i386.cc | 122 ++++++++++++++++++++++++++++----------
> gold/testsuite/Makefile.am | 59 ++++++++++++++++++
> gold/testsuite/i386_mov_to_lea.sh | 37 ++++++++++++
> gold/testsuite/i386_mov_to_lea1.s | 11 ++++
> gold/testsuite/i386_mov_to_lea2.s | 10 ++++
> gold/testsuite/i386_mov_to_lea3.s | 4 ++
> gold/testsuite/i386_mov_to_lea4.s | 12 ++++
> gold/testsuite/i386_mov_to_lea5.s | 12 ++++
> 9 files changed, 251 insertions(+), 32 deletions(-)
> create mode 100755 gold/testsuite/i386_mov_to_lea.sh
> create mode 100644 gold/testsuite/i386_mov_to_lea1.s
> create mode 100644 gold/testsuite/i386_mov_to_lea2.s
> create mode 100644 gold/testsuite/i386_mov_to_lea3.s
> create mode 100644 gold/testsuite/i386_mov_to_lea4.s
> create mode 100644 gold/testsuite/i386_mov_to_lea5.s
>
> diff --git a/gold/ChangeLog b/gold/ChangeLog
> index f94e170..8b96819 100644
> --- a/gold/ChangeLog
> +++ b/gold/ChangeLog
> @@ -1,3 +1,19 @@
> +2015-03-12 Ilya Tocar <ilya.tocar@intel.com>
> +
> + PR gold/17640
> + * i386.cc (Target_i386::Scan::local): Don't create GOT entry, when we
> + can convert GOT to GOTOFF.
> + (Target_i386::Scan::global): Ditto.
> + (Target_i386::Relocate::relocate): Convert mov foo@GOT(%reg), %reg to
> + lea foo@GOTOFF(%reg), %reg if possible.
> + * testsuite/Makefile.am (i386_mov_to_lea): New test.
> + * testsuite/i386_mov_to_lea1.s: New.
> + * testsuite/i386_mov_to_lea2.s: Ditto.
> + * testsuite/i386_mov_to_lea3.s: Ditto.
> + * testsuite/i386_mov_to_lea4.s: Ditto.
> + * testsuite/i386_mov_to_lea5.s: Ditto.
> + * testsuite/i386_mov_to_lea.sh: Ditto.
> +
> 2015-03-11 Cary Coutant <ccoutant@google.com>
>
> * options.cc (General_options::finalize): Don't allow -z relro
> diff --git a/gold/i386.cc b/gold/i386.cc
> index 24f4103..108f1fb 100644
> --- a/gold/i386.cc
> +++ b/gold/i386.cc
> @@ -1835,8 +1835,27 @@ Target_i386::Scan::local(Symbol_table* symtab,
>
> case elfcpp::R_386_GOT32:
> {
> - // The symbol requires a GOT entry.
> + // We need GOT section.
> Output_data_got<32, false>* got = target->got_section(symtab, layout);
> +
> + // If the relocation symbol isn't IFUNC,
> + // and is local, then we will convert
> + // mov foo@GOT(%reg), %reg
> + // to
> + // lea foo@GOTOFF(%reg), %reg
> + // in Relocate::relocate
> + if (reloc.get_r_offset() >= 2
> + && lsym.get_st_type() != elfcpp::STT_GNU_IFUNC)
> + {
> + section_size_type stype;
> + const unsigned char* view = object->section_contents(data_shndx,
> + &stype, true);
> + if (view[reloc.get_r_offset() - 2] == 0x8b)
> + break;
> +
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Please remove the blank line.
--
H.J.