From: Stefan Liebler <stli@linux.ibm.com>
To: Florian Weimer <fweimer@redhat.com>, Stan Cox <scox@redhat.com>
Cc: Arjun Shankar <ashankar@redhat.com>,
libc-alpha@sourceware.org, systemtap@sourceware.org
Subject: Re: glibc build failure due to Systemtap probe change
Date: Thu, 18 Nov 2021 14:33:47 +0100 [thread overview]
Message-ID: <c59f640b-4fe2-0e0d-a905-4f96c26000eb@linux.ibm.com> (raw)
In-Reply-To: <87a6i4e9ej.fsf@oldenburg.str.redhat.com>
On 16/11/2021 10:29, Florian Weimer wrote:
> 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?
I would prefer to keep the c-code with inline-assembly as is. Then we
don't need to reimplement the macros in assembler.
But let's wait for Stan's experiments with the preprocessed files.
>
> Thanks,
> Florian
>
prev parent reply other threads:[~2021-11-18 13:33 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-11-16 9:29 Florian Weimer
2021-11-16 21:52 ` Stan Cox
2021-11-17 10:44 ` Florian Weimer
2021-11-17 13:42 ` Stan Cox
2021-11-17 15:39 ` Florian Weimer
2021-11-25 1:55 ` Michael Hudson-Doyle
2021-11-30 11:13 ` Stefan Liebler
2021-12-08 10:21 ` Florian Weimer
2021-12-09 11:39 ` Stefan Liebler
2021-12-10 17:44 ` Frank Ch. Eigler
2021-12-14 13:27 ` Stefan Liebler
2021-11-18 13:33 ` Stefan Liebler [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=c59f640b-4fe2-0e0d-a905-4f96c26000eb@linux.ibm.com \
--to=stli@linux.ibm.com \
--cc=ashankar@redhat.com \
--cc=fweimer@redhat.com \
--cc=libc-alpha@sourceware.org \
--cc=scox@redhat.com \
--cc=systemtap@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).