glibc build failure due to Systemtap probe change
Florian Weimer
fweimer@redhat.com
Tue Nov 16 09:29:08 GMT 2021
On Fedora rawhide, glibc no longer builds:
In file included from ../include/stap-probe.h:25,
from ../sysdeps/s390/s390-64/__longjmp.c:24:
../sysdeps/s390/s390-64/__longjmp.c: In function '__longjmp':
../sysdeps/s390/s390-64/__longjmp.c:52:50: error: expected ':' or ')' before numeric constant
52 | LIBC_PROBE_ASM (longjmp, 8@%1 -4@%0 8@%%r4)
| ^
../sysdeps/s390/s390-64/__longjmp.c:52:25: note: in expansion of macro 'LIBC_PROBE_ASM'
52 | LIBC_PROBE_ASM (longjmp, 8@%1 -4@%0 8@%%r4)
| ^~~~~~~~~~~~~~
This is because of a Systemtap probe:
| /* Jump to the position specified by ENV, causing the
| setjmp call there to return VAL, or 1 if VAL is 0. */
| void
| __longjmp (__jmp_buf env, int val)
| {
| #ifdef PTR_DEMANGLE
| uintptr_t guard = THREAD_GET_POINTER_GUARD ();
| # ifdef CHECK_SP
| CHECK_SP (env, guard);
| # endif
| #elif defined CHECK_SP
| CHECK_SP (env, 0);
| #endif
| register long int r2 __asm__ ("%r2") = val == 0 ? 1 : val;
| #ifdef PTR_DEMANGLE
| register uintptr_t r3 __asm__ ("%r3") = guard;
| register void *r1 __asm__ ("%r1") = (void *) env;
| #endif
| /* Restore registers and jump back. */
| __asm__ __volatile__ (
| /* longjmp probe expects longjmp first argument, second
| argument and target address. */
| #ifdef PTR_DEMANGLE
| "lmg %%r4,%%r5,64(%1)\n\t"
| "xgr %%r4,%2\n\t"
| "xgr %%r5,%2\n\t"
| LIBC_PROBE_ASM (longjmp, 8@%1 -4@%0 8@%%r4)
| #else
| LIBC_PROBE_ASM (longjmp, 8@%1 -4@%0 8@%%r14)
| #endif
My guess this is related to the macro changes to support floating point
values in probes added in this commit:
commit eaa15b047688175a94e3ae796529785a3a0af208
Author: Stan Cox <scox@redhat.com>
Date: Thu Sep 30 16:11:29 2021 -0400
PR27829: Support floating point values passed through sdt.h markers
Add the type to the individual arg entries in the .notes.stapsdt section;
currently SP@A, where S is optional '-' sign, P is precision of type and A is
address. Revised format is SPT@A where T is optional 'f' for float variables.
Add x8664 float registers xmm8 - xmm15 and aarch64 float registers v8 - v31.
Parse the type field; result is currently ignored. asm statements are
restricted to 30 arguments; sdt probes can have up to 12 arguments. To fit
this into a single asm statement, precision and type are encoded into a single
field: 0xSSTT where SS is the precision and TT is the type as encoded by
__builtin_classify_type. The sign S, precision P, and type T are decoded by
_SDT_SIGN, _SDT_SIZE, and _SDT_TYPE. Test that the revised
.notes.stapsdt section interacts correctly with eu-elfutils and gdb.
The macro changes in this commit seem to trigger additional macro
expansion in the preprocessor, and therefore require syntax closer to C.
LIBC_PROBE_ASM was added to longjmp to support GDB, but if GDB really
needs this, I'm not sure if Systemtap probes (via <sys/sdt.h>) are the
right mechanism because building with Systemtap support is optional.
Maybe we should copy <sys/sdt.h> into the glibc sources, and then we
could drop the floating point support again. 8-/
Or we could rewrite s390/s390x __longjmp in assembler. It's mostly
assembler anyway. Stefan, what do you think?
Thanks,
Florian
More information about the Libc-alpha
mailing list