All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jan Kiszka <jan.kiszka@siemens.com>
To: Philippe Gerum <rpm@xenomai.org>
Cc: Xenomai <xenomai@xenomai.org>, Greg Gallagher <greg@embeddedgreg.com>
Subject: Re: Arm userland not building with gcc-9 and later
Date: Fri, 6 Aug 2021 18:16:52 +0200	[thread overview]
Message-ID: <2ed731b6-7501-989c-6c1a-8a5569bb0cae@siemens.com> (raw)
In-Reply-To: <871r7666js.fsf@xenomai.org>

On 06.08.21 15:34, Philippe Gerum wrote:
> 
> Jan Kiszka <jan.kiszka@siemens.com> writes:
> 
>> On 06.08.21 15:09, Philippe Gerum wrote:
>>>
>>> Jan Kiszka <jan.kiszka@siemens.com> writes:
>>>
>>>> Hi all,
>>>>
>>>> just wanted to debug the RTnet issues we now see in CI on arm and arm64.
>>>> I picked arm as first target, but that apparently starts to break with
>>>> gcc-9 or newer (tried 9.2 and 10.2):
>>>>
>>>> make[5]: Entering directory '/xenomai/lib/cobalt/arch/arm'
>>>>   CC       libarch_la-features.lo
>>>> features.c: In function 'cobalt_arch_check_features':
>>>> features.c:82:1: error: r7 cannot be used in 'asm' here
>>>>    82 | }
>>>>       | ^
>>>>
>>>> That seems to be related to passing the syscall number via r7 on ARM. Is
>>>> our ABI soon no longer compilable, or can we fix this?
>>>>
>>>> Jan
>>>
>>> r7 may be used as a scratch register by gcc in some
>>> cases. -fomit-frame-pointer for debug builds may help (i.e. when the
>>> optimizer is switched off).
>>>
>>
>> Good hint. I had --enable-debug=full set, and it builds without it (and
>> now reports other issues that Debian's gcc-10 sees).
>>
>> But how to resolve this properly?
>>
>> Jan
> 
> XENOMAI_SYSCALL2(sc_cobalt_archcall) in features.c is likely the issue.
> 
> Either move those bits into some new syscall wrapper which would live in
> lib/cobalt/internal.c, where there is no register allocation conflict so
> far. Or discourage gcc from using r7 as a scratch register in
> arm/features.c entirely? e.g.:
> 
> diff --git a/lib/cobalt/arch/arm/Makefile.am b/lib/cobalt/arch/arm/Makefile.am
> index a5095be3d..d5e542ebe 100644
> --- a/lib/cobalt/arch/arm/Makefile.am
> +++ b/lib/cobalt/arch/arm/Makefile.am
> @@ -6,6 +6,7 @@ libarch_la_SOURCES = features.c
>  
>  libarch_la_CPPFLAGS =			\
>  	@XENO_COBALT_CFLAGS@ 		\
> +	-fomit-frame-pointer		\
>  	-I$(srcdir)/../..		\
>  	-I$(top_srcdir)/include/cobalt	\
>  	-I$(top_srcdir)/include
> 

-fomit-frame-pointer does not help with -O0. It even keeps the problem
alive with -O2.

Looks like arm needs a non-unlined helper function for syscalls, to be safe.

Jan

-- 
Siemens AG, T RDA IOT
Corporate Competence Center Embedded Linux


  reply	other threads:[~2021-08-06 16:16 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-06 13:00 Arm userland not building with gcc-9 and later Jan Kiszka
2021-08-06 13:09 ` Philippe Gerum
2021-08-06 13:14   ` Jan Kiszka
2021-08-06 13:34     ` Philippe Gerum
2021-08-06 16:16       ` Jan Kiszka [this message]
2021-08-06 17:12         ` Jan Kiszka
2021-08-07 17:00 ` Philippe Gerum
2021-08-08 16:55   ` Jan Kiszka
2021-08-08 17:21     ` Philippe Gerum
2021-08-08 17:30       ` Jan Kiszka
2021-08-08 17:55         ` Philippe Gerum
2021-08-09 12:00 ` Jan Kiszka

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=2ed731b6-7501-989c-6c1a-8a5569bb0cae@siemens.com \
    --to=jan.kiszka@siemens.com \
    --cc=greg@embeddedgreg.com \
    --cc=rpm@xenomai.org \
    --cc=xenomai@xenomai.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.