This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH, i386] Remove EBX usage from asm code
- From: Uros Bizjak <ubizjak at gmail dot com>
- To: GCC Patches <gcc-patches at gcc dot gnu dot org>
- Cc: Evgeny Stupachenko <evstupac at gmail dot com>, Jakub Jelinek <jakub at redhat dot com>
- Date: Tue, 30 Dec 2014 11:41:41 +0100
- Subject: Re: [PATCH, i386] Remove EBX usage from asm code
- Authentication-results: sourceware.org; auth=none
- References: <CAOvf_xxRWG-rskfXsgwqTV=DhzPiBrR+2J1QFfH-+eA1BiL_4A at mail dot gmail dot com> <CAOvf_xwN4vmwqWOM+=zwL7zJJ0YWOSUAfEZYp5k838tPzG8FnA at mail dot gmail dot com>
On Mon, Dec 29, 2014 at 4:29 PM, Evgeny Stupachenko <evstupac@gmail.com> wrote:
> Missed path in ChangeLog:
>
> 2014-12-28 Evgeny Stupachenko <evstupac@gmail.com>
>
> * config/i386/gnu-user.h (CRT_GET_RFIB_DATA): Remove EBX register usage.
> * config/i386/sysv4.h (CRT_GET_RFIB_DATA): Ditto.
Looks OK, but I'd like to ask Jakub (CC'd) about glibc impact before
the patch is approved.
Uros.
>
> On Sun, Dec 28, 2014 at 7:46 PM, Evgeny Stupachenko <evstupac@gmail.com> wrote:
>> Hi,
>>
>> The patch removes EBX usage from asm code used in libgcc/crtstuff.c
>> It is safe now, but potentially buggy when glibc is rebuild with GCC
>> 5.0 as EBX is not GOT register any more.
>>
>> x86 bootstrap, make check passed.
>>
>> Is it ok?
>>
>> Evgeny
>>
>> 2014-12-28 Evgeny Stupachenko <evstupac@gmail.com>
>>
>> * gnu-user.h (CRT_GET_RFIB_DATA): Remove EBX register usage.
>> * config/i386/sysv4.h (CRT_GET_RFIB_DATA): Ditto.
>>
>> diff --git a/gcc/config/i386/gnu-user.h b/gcc/config/i386/gnu-user.h
>> index e1163c9..965673b 100644
>> --- a/gcc/config/i386/gnu-user.h
>> +++ b/gcc/config/i386/gnu-user.h
>> @@ -131,13 +131,6 @@ along with GCC; see the file COPYING3. If not see
>>
>> /* Used by crtstuff.c to initialize the base of data-relative relocations.
>> These are GOT relative on x86, so return the pic register. */
>> -#ifdef __PIC__
>> -#define CRT_GET_RFIB_DATA(BASE) \
>> - { \
>> - register void *ebx_ __asm__("ebx"); \
>> - BASE = ebx_; \
>> - }
>> -#else
>> #define CRT_GET_RFIB_DATA(BASE)
>> \
>> __asm__ ("call\t.LPR%=\n" \
>> ".LPR%=:\n\t" \
>> @@ -148,7 +141,6 @@ along with GCC; see the file COPYING3. If not see
>> "add{l}\t{$_GLOBAL_OFFSET_TABLE_+[.-.LPR%=],%0" \
>> "|%0,_GLOBAL_OFFSET_TABLE_+(.-.LPR%=)}" \
>> : "=d"(BASE))
>> -#endif
>>
>> #ifdef TARGET_LIBC_PROVIDES_SSP
>> /* i386 glibc provides __stack_chk_guard in %gs:0x14. */
>> diff --git a/gcc/config/i386/sysv4.h b/gcc/config/i386/sysv4.h
>> index 011b228..5167485 100644
>> --- a/gcc/config/i386/sysv4.h
>> +++ b/gcc/config/i386/sysv4.h
>> @@ -52,13 +52,6 @@ along with GCC; see the file COPYING3. If not see
>>
>> /* Used by crtstuff.c to initialize the base of data-relative relocations.
>> These are GOT relative on x86, so return the pic register. */
>> -#ifdef __PIC__
>> -#define CRT_GET_RFIB_DATA(BASE) \
>> - { \
>> - register void *ebx_ __asm__("ebx"); \
>> - BASE = ebx_; \
>> - }
>> -#else
>> #define CRT_GET_RFIB_DATA(BASE)
>> \
>> __asm__ ("call\t.LPR%=\n" \
>> ".LPR%=:\n\t" \
>> @@ -69,4 +62,3 @@ along with GCC; see the file COPYING3. If not see
>> "add{l}\t{$_GLOBAL_OFFSET_TABLE_+[.-.LPR%=],%0" \
>> "|%0,_GLOBAL_OFFSET_TABLE_+(.-.LPR%=)}" \
>> : "=d"(BASE))
>> -#endif