public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] libgcc: mark __hardcfr_check_fail as always_inline
@ 2023-11-22 14:39 Jose E. Marchesi
  2023-11-23 14:13 ` Richard Biener
  0 siblings, 1 reply; 3+ messages in thread
From: Jose E. Marchesi @ 2023-11-22 14:39 UTC (permalink / raw)
  To: gcc-patches; +Cc: Alexandre Oliva

The function __hardcfr_check_fail in hardcfr.c is internal and static
inline.  It receives many arguments, which require more than five
registers to be passed in bpf-none-unknown targets.  BPF is limited to
that number of registers to pass arguments, and therefore libgcc fails
to build in that target.  This patch marks the function with the
always_inline attribute, fixing the bpf build.

Tested in bpf-unknown-none target and x86_64-linux-gnu host.

libgcc/ChangeLog:

	* hardcfr.c (__hardcfr_check_fail): Mark as always_inline.
---
 libgcc/hardcfr.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/libgcc/hardcfr.c b/libgcc/hardcfr.c
index 25ff06742cb..48a87a5a87a 100644
--- a/libgcc/hardcfr.c
+++ b/libgcc/hardcfr.c
@@ -206,7 +206,8 @@ __hardcfr_debug_cfg (size_t const blocks,
    enabled, it also forces __hardcfr_debug_cfg (above) to be compiled into an
    out-of-line function, that could be called from a debugger.
    */
-static inline void
+
+static inline  __attribute__((__always_inline__)) void
 __hardcfr_check_fail (size_t const blocks ATTRIBUTE_UNUSED,
 		      vword const *const visited ATTRIBUTE_UNUSED,
 		      vword const *const cfg ATTRIBUTE_UNUSED,
-- 
2.30.2


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] libgcc: mark __hardcfr_check_fail as always_inline
  2023-11-22 14:39 [PATCH] libgcc: mark __hardcfr_check_fail as always_inline Jose E. Marchesi
@ 2023-11-23 14:13 ` Richard Biener
  2023-11-23 15:17   ` Jose E. Marchesi
  0 siblings, 1 reply; 3+ messages in thread
From: Richard Biener @ 2023-11-23 14:13 UTC (permalink / raw)
  To: Jose E. Marchesi; +Cc: gcc-patches, Alexandre Oliva

On Wed, Nov 22, 2023 at 3:39 PM Jose E. Marchesi
<jose.marchesi@oracle.com> wrote:
>
> The function __hardcfr_check_fail in hardcfr.c is internal and static
> inline.  It receives many arguments, which require more than five
> registers to be passed in bpf-none-unknown targets.  BPF is limited to
> that number of registers to pass arguments, and therefore libgcc fails
> to build in that target.  This patch marks the function with the
> always_inline attribute, fixing the bpf build.
>
> Tested in bpf-unknown-none target and x86_64-linux-gnu host.
>
> libgcc/ChangeLog:
>
>         * hardcfr.c (__hardcfr_check_fail): Mark as always_inline.
> ---
>  libgcc/hardcfr.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/libgcc/hardcfr.c b/libgcc/hardcfr.c
> index 25ff06742cb..48a87a5a87a 100644
> --- a/libgcc/hardcfr.c
> +++ b/libgcc/hardcfr.c
> @@ -206,7 +206,8 @@ __hardcfr_debug_cfg (size_t const blocks,
>     enabled, it also forces __hardcfr_debug_cfg (above) to be compiled into an
>     out-of-line function, that could be called from a debugger.
>     */
> -static inline void
> +
> +static inline  __attribute__((__always_inline__)) void

can we gate this with

#ifdef __BPF

or so?

>  __hardcfr_check_fail (size_t const blocks ATTRIBUTE_UNUSED,
>                       vword const *const visited ATTRIBUTE_UNUSED,
>                       vword const *const cfg ATTRIBUTE_UNUSED,
> --
> 2.30.2
>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] libgcc: mark __hardcfr_check_fail as always_inline
  2023-11-23 14:13 ` Richard Biener
@ 2023-11-23 15:17   ` Jose E. Marchesi
  0 siblings, 0 replies; 3+ messages in thread
From: Jose E. Marchesi @ 2023-11-23 15:17 UTC (permalink / raw)
  To: Richard Biener; +Cc: gcc-patches, Alexandre Oliva


> On Wed, Nov 22, 2023 at 3:39 PM Jose E. Marchesi
> <jose.marchesi@oracle.com> wrote:
>>
>> The function __hardcfr_check_fail in hardcfr.c is internal and static
>> inline.  It receives many arguments, which require more than five
>> registers to be passed in bpf-none-unknown targets.  BPF is limited to
>> that number of registers to pass arguments, and therefore libgcc fails
>> to build in that target.  This patch marks the function with the
>> always_inline attribute, fixing the bpf build.
>>
>> Tested in bpf-unknown-none target and x86_64-linux-gnu host.
>>
>> libgcc/ChangeLog:
>>
>>         * hardcfr.c (__hardcfr_check_fail): Mark as always_inline.
>> ---
>>  libgcc/hardcfr.c | 3 ++-
>>  1 file changed, 2 insertions(+), 1 deletion(-)
>>
>> diff --git a/libgcc/hardcfr.c b/libgcc/hardcfr.c
>> index 25ff06742cb..48a87a5a87a 100644
>> --- a/libgcc/hardcfr.c
>> +++ b/libgcc/hardcfr.c
>> @@ -206,7 +206,8 @@ __hardcfr_debug_cfg (size_t const blocks,
>>     enabled, it also forces __hardcfr_debug_cfg (above) to be compiled into an
>>     out-of-line function, that could be called from a debugger.
>>     */
>> -static inline void
>> +
>> +static inline  __attribute__((__always_inline__)) void
>
> can we gate this with
>
> #ifdef __BPF
>
> or so?

Yep.  Just sent V2.

>>  __hardcfr_check_fail (size_t const blocks ATTRIBUTE_UNUSED,
>>                       vword const *const visited ATTRIBUTE_UNUSED,
>>                       vword const *const cfg ATTRIBUTE_UNUSED,
>> --
>> 2.30.2
>>

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2023-11-23 15:17 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-11-22 14:39 [PATCH] libgcc: mark __hardcfr_check_fail as always_inline Jose E. Marchesi
2023-11-23 14:13 ` Richard Biener
2023-11-23 15:17   ` Jose E. Marchesi

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).