[PATCH 0/2] Remove some i386 system call optimizations
Florian Weimer
fweimer@redhat.com
Tue Jan 11 20:37:24 GMT 2022
* H. J. Lu:
> On Tue, Jan 11, 2022 at 6:00 AM H.J. Lu <hjl.tools@gmail.com> wrote:
>>
>> On Tue, Jan 11, 2022 at 2:05 AM Florian Weimer <fweimer@redhat.com> wrote:
>> >
>> > The configure check for CAN_USE_REGISTER_ASM_EBP is unreliable. And we
>> > used it to switch away from using %ebx in assembler constraints, but
>> > this appears to be no longer necessary.
>>
>> This GCC bug has been fixed in GCC 5 as seen in
>>
>> commit 021478683cc091de9902d297a7b161f8343ffb6a
>> Author: Uros Bizjak <uros@gcc.gnu.org>
>> Date: Fri Oct 17 08:00:58 2014 +0200
>>
>> cpuid.h (__cpuid): Remove definitions that handle %ebx register in
>> a special way.
>>
>> * config/i386/cpuid.h (__cpuid): Remove definitions that handle %ebx
>> register in a special way.
>> (__cpuid_count): Ditto.
>> * config/i386/driver-i386.h: Protect with
>> "#if defined(__GNUC__) && (__GNUC__ >= 5 || !defined(__PIC__))".
>> (host_detect_local_cpu): Mention that GCC with non-fixed %ebx
>> is required to compile the function.
>>
>> From-SVN: r216362
>>
>> Since GCC 6.2 or above is required to build glibc, please
>> remove the !OPTIMIZE_FOR_GCC_5 path and this issue
>> will be resolved automatically.
>
> There are
>
> /* Since GCC 5 and above can properly spill %ebx with PIC when needed,
> we can inline syscalls with 6 arguments if GCC 5 or above is used
> to compile glibc. Disable GCC 5 optimization when compiling for
> profiling or when -fno-omit-frame-pointer is used since asm ("ebp")
> can't be used to put the 6th argument in %ebp for syscall. */
> #if !defined PROF && CAN_USE_REGISTER_ASM_EBP
> # define OPTIMIZE_FOR_GCC_5
> #endif
>
> If we want to support profiling or -fno-omit-frame-pointer,
> we need to keep these codes.
This is strictly for %ebp, I think, as indicated by the comment. %ebx
does not need to be special-cased for profiling.
I assume that building glibc (with profiling) is proof enough that this
works?
Thanks,
Florian
More information about the Libc-alpha
mailing list