This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] i386: Access external function via GOT slot for -fno-plt
- From: "H.J. Lu" <hjl dot tools at gmail dot com>
- To: Uros Bizjak <ubizjak at gmail dot com>
- Cc: "gcc-patches at gcc dot gnu dot org" <gcc-patches at gcc dot gnu dot org>
- Date: Thu, 23 Jun 2016 09:32:00 -0700
- Subject: Re: [PATCH] i386: Access external function via GOT slot for -fno-plt
- Authentication-results: sourceware.org; auth=none
- References: <20160623114505 dot GA17653 at intel dot com> <CAFULd4YywoogKE-OMacd3r6Px_B8YPfDy--eyhmfTPHf1q79Nw at mail dot gmail dot com> <CAMe9rOqqggZP49fnO6hHkBD_rLx4J5jWTD1gbmgHXC-w3pF1JA at mail dot gmail dot com> <CAFULd4a8PrU6MU1BxAe0trdTnicsAZGMJ-fYDj1iGuL1Gij0_Q at mail dot gmail dot com>
On Thu, Jun 23, 2016 at 9:23 AM, Uros Bizjak <ubizjak@gmail.com> wrote:
> On Thu, Jun 23, 2016 at 6:08 PM, H.J. Lu <hjl.tools@gmail.com> wrote:
>
>> Here is the updated patch. OK for trunk?
>>
>> PR target/66232
>> PR target/67400
>> * configure.ac (as_ix86_tls_ldm_opt): Renamed to ...
>> (as_ix86_gas_opt): This.
>> (ld_ix86_tls_ldm_opt): Renamed to ...
>> (ld_ix86_gld_opt): This.
>> (R_386_TLS_LDM reloc): Updated.
>> (R_386_GOT32X reloc): New assembler/linker check.
>> (HAVE_AS_IX86_GOT32X): New. Defined to 1 if 32-bit assembler and
>> linker support "jmp *_start@GOT" and "cmpl $0, bar@GOT". Otherise,
>> defined to 0.
>> * config.in: Regenerated.
>> * configure: Likewise.
>> * config/i386/i386.c (ix86_force_load_from_GOT_p): Return
>> true if HAVE_AS_IX86_GOT32X is 1 in 32-bit mode.
>> (ix86_legitimate_address_p): Allow UNSPEC_GOT for -fno-plt
>> if ix86_force_load_from_GOT_p returns true.
>> (ix86_print_operand_address_as): Also support UNSPEC_GOT if
>> ix86_force_load_from_GOT_p returns true.
>> (ix86_expand_move): Generate UNSPEC_GOT in 32-bit mode to load
>> the external function address via the GOT slot.
>> (ix86_nopic_noplt_attribute_p): Check both TARGET_64BIT and
>> HAVE_AS_IX86_GOT32X before returning false.
>> (ix86_output_call_insn): Generate "%!jmp/call\t*%p0@GOT" in
>> 32-bit mode if ix86_nopic_noplt_attribute_p returns true.
>>
>> gcc/testsuite/
>>
>> PR target/66232
>> PR target/67400
>> * gcc.target/i386/pr66232-14.c: New file.
>> * gcc.target/i386/pr66232-15.c: Likewise.
>> * gcc.target/i386/pr66232-16.c: Likewise.
>> * gcc.target/i386/pr66232-17.c: Likewise.
>> * gcc.target/i386/pr67400-1.c: Don't disable for ia32. Scan for
>> ia32 if R_386_GOT32X relocation is supported.
>> * gcc.target/i386/pr67400-2.c: Likewise.
>> * gcc.target/i386/pr67400-3.c: Likewise.
>> * gcc.target/i386/pr67400-4.c: Likewise.
>> * gcc.target/i386/pr67400-6.c: Likewise.
>> * gcc.target/i386/pr67400-7.c: Likewise.
>> * lib/target-supports.exp (check_effective_target_got32x_reloc):
>> New.
>
> OK with a nit below.
>
> Thanks,
> Uros.
>
> --- a/gcc/configure.ac
> +++ b/gcc/configure.ac
> @@ -4164,13 +4164,13 @@ tls_ld:
>
> # Enforce 32-bit output with gas and gld.
> if test x$gas = xyes; then
> - as_ix86_tls_ldm_opt="--32"
> + as_ix86_gas_opt="--32"
> fi
> if echo "$ld_ver" | grep GNU > /dev/null; then
> if $gcc_cv_ld -V 2>/dev/null | grep elf_i386_sol2 > /dev/null; then
> - ld_ix86_tls_ldm_opt="-melf_i386_sol2"
> + ld_ix86_gld_opt="-melf_i386_sol2"
> else
> - ld_ix86_tls_ldm_opt="-melf_i386"
> + ld_ix86_gld_opt="-melf_i386"
> fi
> fi
> conftest_s='
>
> I'd like to suggest better names, perhaps as_ix86_gas_32_opt and
> ld_ix86_gld_32_opt to mark that they are intended for 32bit targets.
> But it is up to you, we can also live with above names.
I checked it with the name change suggested above.
Thanks.
--
H.J.