[PATCH 0/2] Remove some i386 system call optimizations
Florian Weimer
fweimer@redhat.com
Wed Jan 12 20:12:04 GMT 2022
* H. J. Lu:
> On Wed, Jan 12, 2022 at 11:37 AM Florian Weimer <fweimer@redhat.com> wrote:
>>
>> * H. J. Lu:
>>
>> > On Tue, Jan 11, 2022 at 2:52 PM Florian Weimer <fweimer@redhat.com> wrote:
>> >>
>> >> * H. J. Lu:
>> >>
>> >> >> > 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?
>> >> >
>> >> > You need to test glibc build with -fno-omit-frame-pointer.
>> >>
>> >> I tried it, it works (with both patches applied).
>> >> -fno-omit-frame-pointer is about %ebp, not %ebx.
>> >>
>> >> Thanks,
>> >> Florian
>> >>
>> >
>> > Do they have to be in glibc 2.35? If not, I prefer to do it after
>> > 2.35 is branched.
>>
>> We can't build glibc 2.35 with GCC 12 in Fedora without these changes.
>>
>> The %ebp avoidance I can activate with a configure argument, but the
>> macros for optimized %ebx usage are incompatible with .altmacro, as used
>> by the current Systemtap probes.
>
> Please open a glibc bug with a reproducer and CC me.
Done: <https://sourceware.org/bugzilla/show_bug.cgi?id=28771>
Thanks,
Florian
More information about the Libc-alpha
mailing list