Bug 28771 - %ebx optimization macros are incompatible with .altmacro in Systemtap probes
Summary: %ebx optimization macros are incompatible with .altmacro in Systemtap probes
Status: RESOLVED FIXED
Alias: None
Product: glibc
Classification: Unclassified
Component: libc (show other bugs)
Version: 2.35
: P2 normal
Target Milestone: 2.35
Assignee: Florian Weimer
URL:
Keywords:
: 27997 (view as bug list)
Depends on:
Blocks:
 
Reported: 2022-01-12 20:11 UTC by Florian Weimer
Modified: 2022-01-13 14:23 UTC (History)
4 users (show)

See Also:
Host:
Target:
Build: i686-linux-gnu
Last reconfirmed:
fweimer: security-


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Florian Weimer 2022-01-12 20:11:50 UTC
We need to build Fedora 36 with !CAN_USE_REGISTER_ASM_EBP because of auto-vectorization at -O2. This results in a different build failure in nptl/pthread_create.c because the probes there use .altmacro, which breaks inline system calls later in this file.

To reproduce, build glibc with systemtap-sdt-devel-4.6-4.fc35 (or the Fedora rawhide version) and:

../git/configure  --prefix=/usr CC="gcc -m32" CXX="g++ -m32" --build=i686-linux-gnu libc_cv_can_use_register_asm_ebp=no --enable-systemtap

pthread_create.c: Assembler messages:
pthread_create.c:594: Error: % operator needs absolute expression
pthread_create.c:597: Error: % operator needs absolute expression
../sysdeps/unix/sysv/linux/default-sched.h:31: Error: % operator needs absolute expression
../sysdeps/unix/sysv/linux/default-sched.h:34: Error: % operator needs absolute expression
../sysdeps/unix/sysv/linux/default-sched.h:37: Error: % operator needs absolute expression
../sysdeps/unix/sysv/linux/default-sched.h:40: Error: % operator needs absolute expression
make[2]: *** [../o-iterator.mk:9: /home/fweimer/src/gnu/glibc/build/nptl/pthread_create.o] Error 1
Comment 1 Florian Weimer 2022-01-13 14:22:19 UTC
Fixed for 2.35 via:

commit a78e6a10d0b50d0ca80309775980fc99944b1727
Author: Florian Weimer <fweimer@redhat.com>
Date:   Thu Jan 13 14:59:29 2022 +0100

    i386: Remove broken CAN_USE_REGISTER_ASM_EBP (bug 28771)
    
    The configure check for CAN_USE_REGISTER_ASM_EBP tried to compile a
    simple function that uses %ebp as an inline assembly operand.  If
    compilation failed, CAN_USE_REGISTER_ASM_EBP was set 0, which
    eventually had these consequences:
    
    (1) %ebx was avoided as an inline assembly operand, with an
        assembler macro hack to avoid unnecessary register moves.
    (2) %ebp was avoided as an inline assembly operand, using an
        out-of-line syscall function for 6-argument system calls.
    
    (1) is no longer needed for any GCC version that is supported for
    building glibc.  %ebx can be used directly as a register operand.
    Therefore, this commit removes the %ebx avoidance completely.  This
    avoids the assembler macro hack, which turns out to be incompatible
    with the current Systemtap probe macros (which switch to .altmacro
    unconditionally).
    
    (2) is still needed in many build configurations.  The existing
    configure check cannot really capture that because the simple function
    succeeds to compile, while the full glibc build still fails.
    Therefore, this commit removes the check, the CAN_USE_REGISTER_ASM_EBP
    macro, and uses the out-of-line syscall function for 6-argument system
    calls unconditionally.
    
    Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
Comment 2 Florian Weimer 2022-01-13 14:23:37 UTC
*** Bug 27997 has been marked as a duplicate of this bug. ***