All of lore.kernel.org
 help / color / mirror / Atom feed
* [meta-oe][PATCH] librelp: fix function inline errors in debug build
@ 2023-03-29 12:32 Yash Shinde
  0 siblings, 0 replies; 8+ messages in thread
From: Yash Shinde @ 2023-03-29 12:32 UTC (permalink / raw)
  To: openembedded-devel; +Cc: Yash.Shinde

With DEBUG_BUILD = "1", the following errors occur:

   src/relpsess.c:95:1: error:
      inlining failed in call to 'relpSessFreePermittedPeers': function not considered for inlining [-Werror=inline]

   src/tcp.c:146:1: error:
      inlining failed in call to 'relpTcpFreePermittedPeers': function not considered for inlining [-Werror=inline]

   src/tcp.c:158:1: error:
      inlining failed in call to 'callOnAuthErr': function not considered for inlining [-Werror=inline]

Compiler does not inline any functions when not optimizing unless you specify the ‘always_inline’ attribute for the function. Add ">

Upstream-Status: Tracked by upstream bug: https://github.com/rsyslog/librelp/issues/256

Signed-off-by: Yash Shinde <Yash.Shinde@windriver.com>
---
 ...02-librelp-fix-function-inline-error.patch | 59 +++++++++++++++++++
 1 file changed, 59 insertions(+)
 create mode 100644 meta-oe/recipes-extended/rsyslog/rsyslog/0002-librelp-fix-function-inline-error.patch

diff --git a/meta-oe/recipes-extended/rsyslog/rsyslog/0002-librelp-fix-function-inline-error.patch b/meta-oe/recipes-extended/rsyslog/rsyslog/0002-librelp-fix-function-inline-error.patch
new file mode 100644
index 000000000..60cf1b632
--- /dev/null
+++ b/meta-oe/recipes-extended/rsyslog/rsyslog/0002-librelp-fix-function-inline-error.patch
@@ -0,0 +1,59 @@
+From dc841f01fb6167ec9a80e373c5f4d2f5e3222ed6 Mon Sep 17 00:00:00 2001
+From: Yash Shinde <Yash.Shinde@windriver.com>
+Date: Tue, 28 Mar 2023 04:06:58 +0000
+Subject: librelp: fix function inline errors in debug build
+
+With DEBUG_BUILD = "1", the following errors occur:
+
+   src/relpsess.c:95:1: error:
+      inlining failed in call to 'relpSessFreePermittedPeers': function not considered for inlining [-Werror=inline]
+
+   src/tcp.c:146:1: error:
+      inlining failed in call to 'relpTcpFreePermittedPeers': function not considered for inlining [-Werror=inline]
+
+   src/tcp.c:158:1: error:
+      inlining failed in call to 'callOnAuthErr': function not considered for inlining [-Werror=inline]
+
+Compiler does not inline any functions when not optimizing unless you specify the ‘always_inline’ attribute for the function. Add "__attribute__((always_inline))" to avoid these function inline errors.
+
+Upstream-Status: Tracked by upstream bug: https://github.com/rsyslog/librelp/issues/256
+
+Signed-off-by: Yash Shinde <Yash.Shinde@windriver.com>
+---
+
+diff --git a/src/relpsess.c b/src/relpsess.c
+index ee7b595..aa52b71 100644
+--- a/src/relpsess.c
++++ b/src/relpsess.c
+@@ -91,7 +91,7 @@ callOnErr(const relpSess_t *__restrict__ const pThis,
+
+
+ /* helper to free permittedPeer structure */
+-static inline void
++__attribute__((always_inline)) static inline void
+ relpSessFreePermittedPeers(relpSess_t *const pThis)
+ {
+        int i;
+diff --git a/src/tcp.c b/src/tcp.c
+index 7a75cc4..f4088c0 100644
+--- a/src/tcp.c
++++ b/src/tcp.c
+@@ -142,7 +142,7 @@ static int relpTcpChkPeerName(relpTcp_t *const pThis, void* cert);
+
+
+ /* helper to free permittedPeer structure */
+-static inline void
++__attribute__((always_inline)) static inline void
+ relpTcpFreePermittedPeers(relpTcp_t *const pThis)
+ {
+        int i;
+@@ -154,7 +154,7 @@ relpTcpFreePermittedPeers(relpTcp_t *const pThis)
+ }
+
+ /* helper to call onAuthErr if set */
+-static inline void
++__attribute__((always_inline)) static inline void
+ callOnAuthErr(relpTcp_t *const pThis, const char *authdata, const char *emsg, relpRetVal ecode)
+ {
+        pThis->pEngine->dbgprint((char*)"librelp: auth error: authdata:'%s', ecode %d, "
+
-- 
2.34.1



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

* [meta-oe][PATCH] librelp: fix function inline errors in debug build
@ 2023-03-29 12:36 Yash Shinde
  0 siblings, 0 replies; 8+ messages in thread
From: Yash Shinde @ 2023-03-29 12:36 UTC (permalink / raw)
  To: openembedded-devel; +Cc: Yash.Shinde

With DEBUG_BUILD = "1", the following errors occur:

   src/relpsess.c:95:1: error:
      inlining failed in call to 'relpSessFreePermittedPeers': function not considered for inlining [-Werror=inline]

   src/tcp.c:146:1: error:
      inlining failed in call to 'relpTcpFreePermittedPeers': function not considered for inlining [-Werror=inline]

   src/tcp.c:158:1: error:
      inlining failed in call to 'callOnAuthErr': function not considered for inlining [-Werror=inline]

Compiler does not inline any functions when not optimizing unless you specify the ‘always_inline’ attribute for the function. Add ">

Upstream-Status: Tracked by upstream bug: https://github.com/rsyslog/librelp/issues/256

Signed-off-by: Yash Shinde <Yash.Shinde@windriver.com>
---
 ...02-librelp-fix-function-inline-error.patch | 59 +++++++++++++++++++
 1 file changed, 59 insertions(+)
 create mode 100644 meta-oe/recipes-extended/rsyslog/rsyslog/0002-librelp-fix-function-inline-error.patch

diff --git a/meta-oe/recipes-extended/rsyslog/rsyslog/0002-librelp-fix-function-inline-error.patch b/meta-oe/recipes-extended/rsyslog/rsyslog/0002-librelp-fix-function-inline-error.patch
new file mode 100644
index 000000000..60cf1b632
--- /dev/null
+++ b/meta-oe/recipes-extended/rsyslog/rsyslog/0002-librelp-fix-function-inline-error.patch
@@ -0,0 +1,59 @@
+From dc841f01fb6167ec9a80e373c5f4d2f5e3222ed6 Mon Sep 17 00:00:00 2001
+From: Yash Shinde <Yash.Shinde@windriver.com>
+Date: Tue, 28 Mar 2023 04:06:58 +0000
+Subject: librelp: fix function inline errors in debug build
+
+With DEBUG_BUILD = "1", the following errors occur:
+
+   src/relpsess.c:95:1: error:
+      inlining failed in call to 'relpSessFreePermittedPeers': function not considered for inlining [-Werror=inline]
+
+   src/tcp.c:146:1: error:
+      inlining failed in call to 'relpTcpFreePermittedPeers': function not considered for inlining [-Werror=inline]
+
+   src/tcp.c:158:1: error:
+      inlining failed in call to 'callOnAuthErr': function not considered for inlining [-Werror=inline]
+
+Compiler does not inline any functions when not optimizing unless you specify the ‘always_inline’ attribute for the function. Add "__attribute__((always_inline))" to avoid these function inline errors.
+
+Upstream-Status: Tracked by upstream bug: https://github.com/rsyslog/librelp/issues/256
+
+Signed-off-by: Yash Shinde <Yash.Shinde@windriver.com>
+---
+
+diff --git a/src/relpsess.c b/src/relpsess.c
+index ee7b595..aa52b71 100644
+--- a/src/relpsess.c
++++ b/src/relpsess.c
+@@ -91,7 +91,7 @@ callOnErr(const relpSess_t *__restrict__ const pThis,
+
+
+ /* helper to free permittedPeer structure */
+-static inline void
++__attribute__((always_inline)) static inline void
+ relpSessFreePermittedPeers(relpSess_t *const pThis)
+ {
+        int i;
+diff --git a/src/tcp.c b/src/tcp.c
+index 7a75cc4..f4088c0 100644
+--- a/src/tcp.c
++++ b/src/tcp.c
+@@ -142,7 +142,7 @@ static int relpTcpChkPeerName(relpTcp_t *const pThis, void* cert);
+
+
+ /* helper to free permittedPeer structure */
+-static inline void
++__attribute__((always_inline)) static inline void
+ relpTcpFreePermittedPeers(relpTcp_t *const pThis)
+ {
+        int i;
+@@ -154,7 +154,7 @@ relpTcpFreePermittedPeers(relpTcp_t *const pThis)
+ }
+
+ /* helper to call onAuthErr if set */
+-static inline void
++__attribute__((always_inline)) static inline void
+ callOnAuthErr(relpTcp_t *const pThis, const char *authdata, const char *emsg, relpRetVal ecode)
+ {
+        pThis->pEngine->dbgprint((char*)"librelp: auth error: authdata:'%s', ecode %d, "
+
-- 
2.34.1



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

* Re: [meta-oe][PATCH] librelp: fix function inline errors in debug build
       [not found] <20230329075827.437650-1-yashinde145@gmail.com>
@ 2023-03-29 13:36 ` Randy MacLeod
  2023-03-29 15:12     ` Yash Shinde
                     ` (3 more replies)
  0 siblings, 4 replies; 8+ messages in thread
From: Randy MacLeod @ 2023-03-29 13:36 UTC (permalink / raw)
  To: Yash Shinde, openembedded-devel
  Cc: Umesh.Kallapa, Naveen.Gowda, Sundeep.Kokkonda,
	Shivaprasad.Moodalappa, Yash.Shinde

[-- Attachment #1: Type: text/plain, Size: 5022 bytes --]

On 2023-03-29 03:58, Yash Shinde wrote:
> With DEBUG_BUILD = "1", the following errors occur:
>
>     src/relpsess.c:95:1: error:
>        inlining failed in call to 'relpSessFreePermittedPeers': function not considered for inlining [-Werror=inline]
>
>     src/tcp.c:146:1: error:
>        inlining failed in call to 'relpTcpFreePermittedPeers': function not considered for inlining [-Werror=inline]
>
>     src/tcp.c:158:1: error:
>        inlining failed in call to 'callOnAuthErr': function not considered for inlining [-Werror=inline]
>
> Compiler does not inline any functions when not optimizing unless you specify the ‘always_inline’ attribute for the function. Add "__attribute__((always_inline))" to avoid these function inline errors.

Hi Yash,


First, if we're going to take this approach, you should revert my 
work-around as part of this commit:

commit ca10312c4c7e88d67f4b487ae9afcbfdf92898d6
Author:     Randy MacLeod <Randy.MacLeod@windriver.com>
Date: Wed Mar 1 19:24:27 2023

     librelp: make inline errors be warnings in debug build
         ...


BUT...

The problem isn't so much that the code doesn't get in-lined when doing 
a debug build but
that it fails to compile.  I think this is a compiler regressions since
I was /not/ able to reproduce the error when compiling natively using 
Ubuntu-22.04 (gcc-11.3) but
/was/ able to reproduce it using Fedora-37, gcc --version : gcc (GCC) 
12.2.1 20221121 (Red Hat 12.2.1-4)


Does the change you made actually build with the two compiler versions 
above?
Is there documentation that states that

static inline void

is not as portable as:

__attribute__((always_inline)) static inline void

I suspect there is not but I'm not a compiler geek!

../Randy




>
> Upstream-Status: Tracked by upstream bug:https://github.com/rsyslog/librelp/issues/256
>
> Signed-off-by: Yash Shinde<Yash.Shinde@windriver.com>
> ---
>   ...02-librelp-fix-function-inline-error.patch | 59 +++++++++++++++++++
>   1 file changed, 59 insertions(+)
>   create mode 100644 meta-oe/recipes-extended/rsyslog/rsyslog/0002-librelp-fix-function-inline-error.patch
>
> diff --git a/meta-oe/recipes-extended/rsyslog/rsyslog/0002-librelp-fix-function-inline-error.patch b/meta-oe/recipes-extended/rsyslog/rsyslog/0002-librelp-fix-function-inline-error.patch
> new file mode 100644
> index 000000000..60cf1b632
> --- /dev/null
> +++ b/meta-oe/recipes-extended/rsyslog/rsyslog/0002-librelp-fix-function-inline-error.patch
> @@ -0,0 +1,59 @@
> +From dc841f01fb6167ec9a80e373c5f4d2f5e3222ed6 Mon Sep 17 00:00:00 2001
> +From: Yash Shinde<Yash.Shinde@windriver.com>
> +Date: Tue, 28 Mar 2023 04:06:58 +0000
> +Subject: librelp: fix function inline errors in debug build
> +
> +With DEBUG_BUILD = "1", the following errors occur:
> +
> +   src/relpsess.c:95:1: error:
> +      inlining failed in call to 'relpSessFreePermittedPeers': function not considered for inlining [-Werror=inline]
> +
> +   src/tcp.c:146:1: error:
> +      inlining failed in call to 'relpTcpFreePermittedPeers': function not considered for inlining [-Werror=inline]
> +
> +   src/tcp.c:158:1: error:
> +      inlining failed in call to 'callOnAuthErr': function not considered for inlining [-Werror=inline]
> +
> +Compiler does not inline any functions when not optimizing unless you specify the ‘always_inline’ attribute for the function. Add "__attribute__((always_inline))" to avoid these function inline errors.
> +
> +Upstream-Status: Tracked by upstream bug:https://github.com/rsyslog/librelp/issues/256
> +
> +Signed-off-by: Yash Shinde<Yash.Shinde@windriver.com>
> +---
> +
> +diff --git a/src/relpsess.c b/src/relpsess.c
> +index ee7b595..aa52b71 100644
> +--- a/src/relpsess.c
> ++++ b/src/relpsess.c
> +@@ -91,7 +91,7 @@ callOnErr(const relpSess_t *__restrict__ const pThis,
> +
> +
> + /* helper to free permittedPeer structure */
> +-static inline void
> ++__attribute__((always_inline)) static inline void
> + relpSessFreePermittedPeers(relpSess_t *const pThis)
> + {
> +        int i;
> +diff --git a/src/tcp.c b/src/tcp.c
> +index 7a75cc4..f4088c0 100644
> +--- a/src/tcp.c
> ++++ b/src/tcp.c
> +@@ -142,7 +142,7 @@ static int relpTcpChkPeerName(relpTcp_t *const pThis, void* cert);
> +
> +
> + /* helper to free permittedPeer structure */
> +-static inline void
> ++__attribute__((always_inline)) static inline void
> + relpTcpFreePermittedPeers(relpTcp_t *const pThis)
> + {
> +        int i;
> +@@ -154,7 +154,7 @@ relpTcpFreePermittedPeers(relpTcp_t *const pThis)
> + }
> +
> + /* helper to call onAuthErr if set */
> +-static inline void
> ++__attribute__((always_inline)) static inline void
> + callOnAuthErr(relpTcp_t *const pThis, const char *authdata, const char *emsg, relpRetVal ecode)
> + {
> +        pThis->pEngine->dbgprint((char*)"librelp: auth error: authdata:'%s', ecode %d, "
> +


-- 
# Randy MacLeod
# Wind River Linux

[-- Attachment #2: Type: text/html, Size: 6546 bytes --]

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

* Re: [meta-oe][PATCH] librelp: fix function inline errors in debug build
@ 2023-03-29 15:12     ` Yash Shinde
  0 siblings, 0 replies; 8+ messages in thread
From: Yash Shinde @ 2023-03-29 15:10 UTC (permalink / raw)
  To: openembedded-devel

[-- Attachment #1: Type: text/plain, Size: 2181 bytes --]

> 
> 
> 
> Hi Yash,
> 
> 
> 
> 
> 
> 
> 
> First, if we're going to take this approach, you should revert my
> work-around as part of this commit:
> 
> 
> 
> commit ca10312c4c7e88d67f4b487ae9afcbfdf92898d6
> Author:     Randy MacLeod <Randy.MacLeod@...> ( Randy.MacLeod@... )
> Date: Wed Mar 1 19:24:27 2023
> 
> librelp: make inline errors be warnings in debug build
> ...
> 
> 

Will send a v2 if needed.

> 
> 
> 
> BUT...
> 
> 
> 
> The problem isn't so much that the code doesn't get in-lined when doing a
> debug build but
> that it fails to compile.  I think this is a compiler regressions since
> I was not able to reproduce the error when compiling natively using
> Ubuntu-22.04 (gcc-11.3) but
> was able to reproduce it using Fedora-37, gcc --version : gcc (GCC) 12.2.1
> 20221121 (Red Hat 12.2.1-4)
> 
> 
> 
> 
> 
> 
> 
> Does the change you made actually build with the two compiler versions
> above?
> 
> 

I tested the changes in LINCD sources which have GCC 12.2. I didn’t check the above mentioned version.

> 
> 
> 
> 
> Is there documentation that states that
> 
> static inline void
> 
> is not as portable as:
> 
> __attribute__((always_inline))
> static inline void
> 
> 
> 
> 
> 
> I suspect there is not but I'm not a compiler geek!
> 
> 

As you mentioned in https://github.com/rsyslog/librelp/issues/256#issue-1605905115 ( https://github.com/rsyslog/librelp/issues/256#:~:text=Oh%20and%20it%20only%20happens%20when%20using%20%2DOg%20not%20%2DO%5B0%2D3%5D ) , it happens only when complied without any optimization and as per https://gcc.gnu.org/onlinedocs/gcc/Inline.html ( https://gcc.gnu.org/onlinedocs/gcc/Inline.html#:~:text=GCC%20does%20not%20inline,const%20char)%20__attribute__((always_inline))%3B ) it’s mentioned that:

> 
> GCC does not inline any functions when not optimizing unless you specify
> the ‘always_inline’ attribute for the function, like this:
> /* Prototype.  */ inline void foo (const char)
> __attribute__((always_inline));
> 

Please let me know if we are on the same page.

> 
> 
> 
> ../Randy
> 
> 

Regards,

Yash

[-- Attachment #2: Type: text/html, Size: 2682 bytes --]

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

* Re: [meta-oe][PATCH] librelp: fix function inline errors in debug build
@ 2023-03-29 15:12     ` Yash Shinde
  0 siblings, 0 replies; 8+ messages in thread
From: Yash Shinde @ 2023-03-29 15:12 UTC (permalink / raw)
  To: openembedded-devel

[-- Attachment #1: Type: text/plain, Size: 2181 bytes --]

> 
> 
> 
> Hi Yash,
> 
> 
> 
> 
> 
> 
> 
> First, if we're going to take this approach, you should revert my
> work-around as part of this commit:
> 
> 
> 
> commit ca10312c4c7e88d67f4b487ae9afcbfdf92898d6
> Author:     Randy MacLeod <Randy.MacLeod@...> ( Randy.MacLeod@... )
> Date: Wed Mar 1 19:24:27 2023
> 
> librelp: make inline errors be warnings in debug build
> ...
> 
> 

Will send a v2 if needed.

> 
> 
> 
> BUT...
> 
> 
> 
> The problem isn't so much that the code doesn't get in-lined when doing a
> debug build but
> that it fails to compile.  I think this is a compiler regressions since
> I was not able to reproduce the error when compiling natively using
> Ubuntu-22.04 (gcc-11.3) but
> was able to reproduce it using Fedora-37, gcc --version : gcc (GCC) 12.2.1
> 20221121 (Red Hat 12.2.1-4)
> 
> 
> 
> 
> 
> 
> 
> Does the change you made actually build with the two compiler versions
> above?
> 
> 

I tested the changes in LINCD sources which have GCC 12.2. I didn’t check the above mentioned version.

> 
> 
> 
> 
> Is there documentation that states that
> 
> static inline void
> 
> is not as portable as:
> 
> __attribute__((always_inline))
> static inline void
> 
> 
> 
> 
> 
> I suspect there is not but I'm not a compiler geek!
> 
> 

As you mentioned in https://github.com/rsyslog/librelp/issues/256#issue-1605905115 ( https://github.com/rsyslog/librelp/issues/256#:~:text=Oh%20and%20it%20only%20happens%20when%20using%20%2DOg%20not%20%2DO%5B0%2D3%5D ) , it happens only when complied without any optimization and as per https://gcc.gnu.org/onlinedocs/gcc/Inline.html ( https://gcc.gnu.org/onlinedocs/gcc/Inline.html#:~:text=GCC%20does%20not%20inline,const%20char)%20__attribute__((always_inline))%3B ) it’s mentioned that:

> 
> GCC does not inline any functions when not optimizing unless you specify
> the ‘always_inline’ attribute for the function, like this:
> /* Prototype.  */ inline void foo (const char)
> __attribute__((always_inline));
> 

Please let me know if we are on the same page.

> 
> 
> 
> ../Randy
> 
> 

Regards,

Yash

[-- Attachment #2: Type: text/html, Size: 2636 bytes --]

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

* Re: [oe] [meta-oe][PATCH] librelp: fix function inline errors in debug build
  2023-03-29 13:36 ` [meta-oe][PATCH] librelp: fix function inline errors in debug build Randy MacLeod
  2023-03-29 15:12     ` Yash Shinde
@ 2023-03-29 15:49   ` Khem Raj
  2023-03-30  4:10   ` Shinde, Yash
  2023-03-30  4:10   ` Shinde, Yash
  3 siblings, 0 replies; 8+ messages in thread
From: Khem Raj @ 2023-03-29 15:49 UTC (permalink / raw)
  To: Randy MacLeod
  Cc: Yash Shinde, openembedded-devel, Umesh.Kallapa, Naveen.Gowda,
	Sundeep.Kokkonda, Shivaprasad.Moodalappa, Yash.Shinde

On Wed, Mar 29, 2023 at 6:36 AM Randy MacLeod
<randy.macleod@windriver.com> wrote:
>
> On 2023-03-29 03:58, Yash Shinde wrote:
>
> With DEBUG_BUILD = "1", the following errors occur:
>
>    src/relpsess.c:95:1: error:
>       inlining failed in call to 'relpSessFreePermittedPeers': function not considered for inlining [-Werror=inline]
>
>    src/tcp.c:146:1: error:
>       inlining failed in call to 'relpTcpFreePermittedPeers': function not considered for inlining [-Werror=inline]
>
>    src/tcp.c:158:1: error:
>       inlining failed in call to 'callOnAuthErr': function not considered for inlining [-Werror=inline]
>
> Compiler does not inline any functions when not optimizing unless you specify the ‘always_inline’ attribute for the function. Add "__attribute__((always_inline))" to avoid these function inline errors.
>
> Hi Yash,
>
>
> First, if we're going to take this approach, you should revert my work-around as part of this commit:
>
> commit ca10312c4c7e88d67f4b487ae9afcbfdf92898d6
> Author:     Randy MacLeod <Randy.MacLeod@windriver.com>
> Date: Wed Mar 1 19:24:27 2023
>
>     librelp: make inline errors be warnings in debug build
>         ...
>
>
> BUT...
>
> The problem isn't so much that the code doesn't get in-lined when doing a debug build but
> that it fails to compile.  I think this is a compiler regressions since
> I was not able to reproduce the error when compiling natively using Ubuntu-22.04 (gcc-11.3) but
> was able to reproduce it using Fedora-37, gcc --version : gcc (GCC) 12.2.1 20221121 (Red Hat 12.2.1-4)
>
>
> Does the change you made actually build with the two compiler versions above?
> Is there documentation that states that
>
> static inline void
>
> is not as portable as:
>
> __attribute__((always_inline)) static inline void
>

they both are portable and in fact 'inline' is in ISO C99 and
always_inline is a an compiler-specific hint which communicates more
to compiler of user's intention and compiler may choose to inline it
in more situations if compiler optimizer chooses it to inline, the
behavior
also depends on which compiler is in use.  'inline' is a hint
which compiler could use if the optimizer chose inlining and weightage
assigned to this function makes the cutoff.

> I suspect there is not but I'm not a compiler geek!
>
> ../Randy
>
>
>
>
>
> Upstream-Status: Tracked by upstream bug: https://github.com/rsyslog/librelp/issues/256
>
> Signed-off-by: Yash Shinde <Yash.Shinde@windriver.com>
> ---
>  ...02-librelp-fix-function-inline-error.patch | 59 +++++++++++++++++++
>  1 file changed, 59 insertions(+)
>  create mode 100644 meta-oe/recipes-extended/rsyslog/rsyslog/0002-librelp-fix-function-inline-error.patch
>
> diff --git a/meta-oe/recipes-extended/rsyslog/rsyslog/0002-librelp-fix-function-inline-error.patch b/meta-oe/recipes-extended/rsyslog/rsyslog/0002-librelp-fix-function-inline-error.patch
> new file mode 100644
> index 000000000..60cf1b632
> --- /dev/null
> +++ b/meta-oe/recipes-extended/rsyslog/rsyslog/0002-librelp-fix-function-inline-error.patch
> @@ -0,0 +1,59 @@
> +From dc841f01fb6167ec9a80e373c5f4d2f5e3222ed6 Mon Sep 17 00:00:00 2001
> +From: Yash Shinde <Yash.Shinde@windriver.com>
> +Date: Tue, 28 Mar 2023 04:06:58 +0000
> +Subject: librelp: fix function inline errors in debug build
> +
> +With DEBUG_BUILD = "1", the following errors occur:
> +
> +   src/relpsess.c:95:1: error:
> +      inlining failed in call to 'relpSessFreePermittedPeers': function not considered for inlining [-Werror=inline]
> +
> +   src/tcp.c:146:1: error:
> +      inlining failed in call to 'relpTcpFreePermittedPeers': function not considered for inlining [-Werror=inline]
> +
> +   src/tcp.c:158:1: error:
> +      inlining failed in call to 'callOnAuthErr': function not considered for inlining [-Werror=inline]
> +
> +Compiler does not inline any functions when not optimizing unless you specify the ‘always_inline’ attribute for the function. Add "__attribute__((always_inline))" to avoid these function inline errors.
> +
> +Upstream-Status: Tracked by upstream bug: https://github.com/rsyslog/librelp/issues/256
> +
> +Signed-off-by: Yash Shinde <Yash.Shinde@windriver.com>
> +---
> +
> +diff --git a/src/relpsess.c b/src/relpsess.c
> +index ee7b595..aa52b71 100644
> +--- a/src/relpsess.c
> ++++ b/src/relpsess.c
> +@@ -91,7 +91,7 @@ callOnErr(const relpSess_t *__restrict__ const pThis,
> +
> +
> + /* helper to free permittedPeer structure */
> +-static inline void
> ++__attribute__((always_inline)) static inline void
> + relpSessFreePermittedPeers(relpSess_t *const pThis)
> + {
> +        int i;
> +diff --git a/src/tcp.c b/src/tcp.c
> +index 7a75cc4..f4088c0 100644
> +--- a/src/tcp.c
> ++++ b/src/tcp.c
> +@@ -142,7 +142,7 @@ static int relpTcpChkPeerName(relpTcp_t *const pThis, void* cert);
> +
> +
> + /* helper to free permittedPeer structure */
> +-static inline void
> ++__attribute__((always_inline)) static inline void
> + relpTcpFreePermittedPeers(relpTcp_t *const pThis)
> + {
> +        int i;
> +@@ -154,7 +154,7 @@ relpTcpFreePermittedPeers(relpTcp_t *const pThis)
> + }
> +
> + /* helper to call onAuthErr if set */
> +-static inline void
> ++__attribute__((always_inline)) static inline void
> + callOnAuthErr(relpTcp_t *const pThis, const char *authdata, const char *emsg, relpRetVal ecode)
> + {
> +        pThis->pEngine->dbgprint((char*)"librelp: auth error: authdata:'%s', ecode %d, "
> +
>
>
> --
> # Randy MacLeod
> # Wind River Linux
>
>
> -=-=-=-=-=-=-=-=-=-=-=-
> Links: You receive all messages sent to this group.
> View/Reply Online (#101820): https://lists.openembedded.org/g/openembedded-devel/message/101820
> Mute This Topic: https://lists.openembedded.org/mt/97927015/1997914
> Group Owner: openembedded-devel+owner@lists.openembedded.org
> Unsubscribe: https://lists.openembedded.org/g/openembedded-devel/unsub [raj.khem@gmail.com]
> -=-=-=-=-=-=-=-=-=-=-=-
>


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

* RE: [meta-oe][PATCH] librelp: fix function inline errors in debug build
  2023-03-29 13:36 ` [meta-oe][PATCH] librelp: fix function inline errors in debug build Randy MacLeod
  2023-03-29 15:12     ` Yash Shinde
  2023-03-29 15:49   ` [oe] " Khem Raj
@ 2023-03-30  4:10   ` Shinde, Yash
  2023-03-30  4:10   ` Shinde, Yash
  3 siblings, 0 replies; 8+ messages in thread
From: Shinde, Yash @ 2023-03-30  4:10 UTC (permalink / raw)
  To: MacLeod, Randy, Yash Shinde,
	openembedded-devel@lists.openembedded.org
  Cc: Kallapa, Umesh, Gowda, Naveen, Kokkonda, Sundeep,
	Moodalappa, Shivaprasad

[-- Attachment #1: Type: text/plain, Size: 7693 bytes --]

Hi Yash,



First, if we're going to take this approach, you should revert my work-around as part of this commit:

commit ca10312c4c7e88d67f4b487ae9afcbfdf92898d6
Author:     Randy MacLeod <Randy.MacLeod@...><mailto:Randy.MacLeod@...>
Date: Wed Mar 1 19:24:27 2023

    librelp: make inline errors be warnings in debug build
        ...

>Will send a v2 if needed.



BUT...

The problem isn't so much that the code doesn't get in-lined when doing a debug build but
that it fails to compile.  I think this is a compiler regressions since
I was not able to reproduce the error when compiling natively using Ubuntu-22.04 (gcc-11.3) but
was able to reproduce it using Fedora-37, gcc --version : gcc (GCC) 12.2.1 20221121 (Red Hat 12.2.1-4)


Does the change you made actually build with the two compiler versions above?

>I tested my changes on LINCD sources which have GCC 12.2. I didn’t checked the above mentioned versions.

Is there documentation that states that

static inline void



is not as portable as:



__attribute__((always_inline)) static inline void

I suspect there is not but I'm not a compiler geek!

>As you mentioned in https://github.com/rsyslog/librelp/issues/256#issue-1605905115, it only happens when using -Og not -O[0-3]  i.e without any optimizations and as per https://gcc.gnu.org/onlinedocs/gcc/Inline.html<https://gcc.gnu.org/onlinedocs/gcc/Inline.html#:~:text=GCC%20does%20not%20inline%20any%20functions%20when%20not%20optimizing%20unless%20you%20specify%20the%20%E2%80%98always_inline%E2%80%99%20attribute%20for%20the%20function%2C%20like%20this%3A> it’s mentioned that:

GCC does not inline any functions when not optimizing unless you specify the ‘always_inline’ attribute for the function, like this:
/* Prototype.  */ inline void foo (const char) __attribute__((always_inline));

>Please let me know if we are on the same page.


../Randy


Regards,
Yash

From: MacLeod, Randy<mailto:Randy.MacLeod@windriver.com>
Sent: 29 March 2023 19:06
To: Yash Shinde<mailto:yashinde145@gmail.com>; openembedded-devel@lists.openembedded.org<mailto:openembedded-devel@lists.openembedded.org>
Cc: Kallapa, Umesh<mailto:Umesh.Kallapa@windriver.com>; Gowda, Naveen<mailto:Naveen.Gowda@windriver.com>; Kokkonda, Sundeep<mailto:Sundeep.Kokkonda@windriver.com>; Moodalappa, Shivaprasad<mailto:Shivaprasad.Moodalappa@windriver.com>; Shinde, Yash<mailto:Yash.Shinde@windriver.com>
Subject: Re: [meta-oe][PATCH] librelp: fix function inline errors in debug build

On 2023-03-29 03:58, Yash Shinde wrote:

With DEBUG_BUILD = "1", the following errors occur:



   src/relpsess.c:95:1: error:

      inlining failed in call to 'relpSessFreePermittedPeers': function not considered for inlining [-Werror=inline]



   src/tcp.c:146:1: error:

      inlining failed in call to 'relpTcpFreePermittedPeers': function not considered for inlining [-Werror=inline]



   src/tcp.c:158:1: error:

      inlining failed in call to 'callOnAuthErr': function not considered for inlining [-Werror=inline]



Compiler does not inline any functions when not optimizing unless you specify the ‘always_inline’ attribute for the function. Add "__attribute__((always_inline))" to avoid these function inline errors.

Hi Yash,



First, if we're going to take this approach, you should revert my work-around as part of this commit:

commit ca10312c4c7e88d67f4b487ae9afcbfdf92898d6
Author:     Randy MacLeod <Randy.MacLeod@windriver.com><mailto:Randy.MacLeod@windriver.com>
Date: Wed Mar 1 19:24:27 2023

    librelp: make inline errors be warnings in debug build
        ...



BUT...

The problem isn't so much that the code doesn't get in-lined when doing a debug build but
that it fails to compile.  I think this is a compiler regressions since
I was not able to reproduce the error when compiling natively using Ubuntu-22.04 (gcc-11.3) but
was able to reproduce it using Fedora-37, gcc --version : gcc (GCC) 12.2.1 20221121 (Red Hat 12.2.1-4)



Does the change you made actually build with the two compiler versions above?
Is there documentation that states that

static inline void



is not as portable as:



__attribute__((always_inline)) static inline void

I suspect there is not but I'm not a compiler geek!

../Randy











Upstream-Status: Tracked by upstream bug: https://github.com/rsyslog/librelp/issues/256



Signed-off-by: Yash Shinde <Yash.Shinde@windriver.com><mailto:Yash.Shinde@windriver.com>

---

 ...02-librelp-fix-function-inline-error.patch | 59 +++++++++++++++++++

 1 file changed, 59 insertions(+)

 create mode 100644 meta-oe/recipes-extended/rsyslog/rsyslog/0002-librelp-fix-function-inline-error.patch



diff --git a/meta-oe/recipes-extended/rsyslog/rsyslog/0002-librelp-fix-function-inline-error.patch b/meta-oe/recipes-extended/rsyslog/rsyslog/0002-librelp-fix-function-inline-error.patch

new file mode 100644

index 000000000..60cf1b632

--- /dev/null

+++ b/meta-oe/recipes-extended/rsyslog/rsyslog/0002-librelp-fix-function-inline-error.patch

@@ -0,0 +1,59 @@

+From dc841f01fb6167ec9a80e373c5f4d2f5e3222ed6 Mon Sep 17 00:00:00 2001

+From: Yash Shinde <Yash.Shinde@windriver.com><mailto:Yash.Shinde@windriver.com>

+Date: Tue, 28 Mar 2023 04:06:58 +0000

+Subject: librelp: fix function inline errors in debug build

+

+With DEBUG_BUILD = "1", the following errors occur:

+

+   src/relpsess.c:95:1: error:

+      inlining failed in call to 'relpSessFreePermittedPeers': function not considered for inlining [-Werror=inline]

+

+   src/tcp.c:146:1: error:

+      inlining failed in call to 'relpTcpFreePermittedPeers': function not considered for inlining [-Werror=inline]

+

+   src/tcp.c:158:1: error:

+      inlining failed in call to 'callOnAuthErr': function not considered for inlining [-Werror=inline]

+

+Compiler does not inline any functions when not optimizing unless you specify the ‘always_inline’ attribute for the function. Add "__attribute__((always_inline))" to avoid these function inline errors.

+

+Upstream-Status: Tracked by upstream bug: https://github.com/rsyslog/librelp/issues/256

+

+Signed-off-by: Yash Shinde <Yash.Shinde@windriver.com><mailto:Yash.Shinde@windriver.com>

+---

+

+diff --git a/src/relpsess.c b/src/relpsess.c

+index ee7b595..aa52b71 100644

+--- a/src/relpsess.c

++++ b/src/relpsess.c

+@@ -91,7 +91,7 @@ callOnErr(const relpSess_t *__restrict__ const pThis,

+

+

+ /* helper to free permittedPeer structure */

+-static inline void

++__attribute__((always_inline)) static inline void

+ relpSessFreePermittedPeers(relpSess_t *const pThis)

+ {

+        int i;

+diff --git a/src/tcp.c b/src/tcp.c

+index 7a75cc4..f4088c0 100644

+--- a/src/tcp.c

++++ b/src/tcp.c

+@@ -142,7 +142,7 @@ static int relpTcpChkPeerName(relpTcp_t *const pThis, void* cert);

+

+

+ /* helper to free permittedPeer structure */

+-static inline void

++__attribute__((always_inline)) static inline void

+ relpTcpFreePermittedPeers(relpTcp_t *const pThis)

+ {

+        int i;

+@@ -154,7 +154,7 @@ relpTcpFreePermittedPeers(relpTcp_t *const pThis)

+ }

+

+ /* helper to call onAuthErr if set */

+-static inline void

++__attribute__((always_inline)) static inline void

+ callOnAuthErr(relpTcp_t *const pThis, const char *authdata, const char *emsg, relpRetVal ecode)

+ {

+        pThis->pEngine->dbgprint((char*)"librelp: auth error: authdata:'%s', ecode %d, "

+



--

# Randy MacLeod

# Wind River Linux


[-- Attachment #2: Type: text/html, Size: 16182 bytes --]

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

* RE: [meta-oe][PATCH] librelp: fix function inline errors in debug build
  2023-03-29 13:36 ` [meta-oe][PATCH] librelp: fix function inline errors in debug build Randy MacLeod
                     ` (2 preceding siblings ...)
  2023-03-30  4:10   ` Shinde, Yash
@ 2023-03-30  4:10   ` Shinde, Yash
  3 siblings, 0 replies; 8+ messages in thread
From: Shinde, Yash @ 2023-03-30  4:10 UTC (permalink / raw)
  To: MacLeod, Randy, Yash Shinde,
	openembedded-devel@lists.openembedded.org
  Cc: Kallapa, Umesh, Gowda, Naveen, Kokkonda, Sundeep,
	Moodalappa, Shivaprasad

[-- Attachment #1: Type: text/plain, Size: 7836 bytes --]

On 2023-03-29 19:06, Randy MacLeod wrote:

First, if we're going to take this approach, you should revert my work-around as part of this commit:

commit ca10312c4c7e88d67f4b487ae9afcbfdf92898d6
Author:     Randy MacLeod <Randy.MacLeod@...><mailto:Randy.MacLeod@...>
Date: Wed Mar 1 19:24:27 2023

    librelp: make inline errors be warnings in debug build
        ...

         >Will send a v2 if needed.

BUT...

The problem isn't so much that the code doesn't get in-lined when doing a debug build but
that it fails to compile.  I think this is a compiler regressions since
I was not able to reproduce the error when compiling natively using Ubuntu-22.04 (gcc-11.3) but
was able to reproduce it using Fedora-37, gcc --version : gcc (GCC) 12.2.1 20221121 (Red Hat 12.2.1-4)



Does the change you made actually build with the two compiler versions above?
>I tested the changes in LINCD sources which have GCC 12.2. I didn’t check the above mentioned version.

Is there documentation that states that

static inline void



is not as portable as:



__attribute__((always_inline)) static inline void

I suspect there is not but I'm not a compiler geek!

>As you mentioned in https://github.com/rsyslog/librelp/issues/256#issue-1605905115<https://github.com/rsyslog/librelp/issues/256#:~:text=Oh%20and%20it%20only%20happens%20when%20using%20%2DOg%20not%20%2DO%5B0%2D3%5D>, it happens only when complied without any optimization and as per https://gcc.gnu.org/onlinedocs/gcc/Inline.html<https://gcc.gnu.org/onlinedocs/gcc/Inline.html#:~:text=GCC%20does%20not%20inline%20any%20functions%20when%20not%20optimizing%20unless%20you%20specify%20the%20%E2%80%98always_inline%E2%80%99%20attribute%20for%20the%20function%2C%20like%20this%3A> it’s mentioned that:

GCC does not inline any functions when not optimizing unless you specify the ‘always_inline’ attribute for the function, like this:
/* Prototype.  */ inline void foo (const char) __attribute__((always_inline));

Please let me know if we are on the same page.

../Randy


Regards,
Yash

From: MacLeod, Randy<mailto:Randy.MacLeod@windriver.com>
Sent: 29 March 2023 19:06
To: Yash Shinde<mailto:yashinde145@gmail.com>; openembedded-devel@lists.openembedded.org<mailto:openembedded-devel@lists.openembedded.org>
Cc: Kallapa, Umesh<mailto:Umesh.Kallapa@windriver.com>; Gowda, Naveen<mailto:Naveen.Gowda@windriver.com>; Kokkonda, Sundeep<mailto:Sundeep.Kokkonda@windriver.com>; Moodalappa, Shivaprasad<mailto:Shivaprasad.Moodalappa@windriver.com>; Shinde, Yash<mailto:Yash.Shinde@windriver.com>
Subject: Re: [meta-oe][PATCH] librelp: fix function inline errors in debug build

On 2023-03-29 03:58, Yash Shinde wrote:

With DEBUG_BUILD = "1", the following errors occur:



   src/relpsess.c:95:1: error:

      inlining failed in call to 'relpSessFreePermittedPeers': function not considered for inlining [-Werror=inline]



   src/tcp.c:146:1: error:

      inlining failed in call to 'relpTcpFreePermittedPeers': function not considered for inlining [-Werror=inline]



   src/tcp.c:158:1: error:

      inlining failed in call to 'callOnAuthErr': function not considered for inlining [-Werror=inline]



Compiler does not inline any functions when not optimizing unless you specify the ‘always_inline’ attribute for the function. Add "__attribute__((always_inline))" to avoid these function inline errors.

Hi Yash,



First, if we're going to take this approach, you should revert my work-around as part of this commit:

commit ca10312c4c7e88d67f4b487ae9afcbfdf92898d6
Author:     Randy MacLeod <Randy.MacLeod@windriver.com><mailto:Randy.MacLeod@windriver.com>
Date: Wed Mar 1 19:24:27 2023

    librelp: make inline errors be warnings in debug build
        ...



BUT...

The problem isn't so much that the code doesn't get in-lined when doing a debug build but
that it fails to compile.  I think this is a compiler regressions since
I was not able to reproduce the error when compiling natively using Ubuntu-22.04 (gcc-11.3) but
was able to reproduce it using Fedora-37, gcc --version : gcc (GCC) 12.2.1 20221121 (Red Hat 12.2.1-4)



Does the change you made actually build with the two compiler versions above?
Is there documentation that states that

static inline void



is not as portable as:



__attribute__((always_inline)) static inline void

I suspect there is not but I'm not a compiler geek!

../Randy











Upstream-Status: Tracked by upstream bug: https://github.com/rsyslog/librelp/issues/256



Signed-off-by: Yash Shinde <Yash.Shinde@windriver.com><mailto:Yash.Shinde@windriver.com>

---

 ...02-librelp-fix-function-inline-error.patch | 59 +++++++++++++++++++

 1 file changed, 59 insertions(+)

 create mode 100644 meta-oe/recipes-extended/rsyslog/rsyslog/0002-librelp-fix-function-inline-error.patch



diff --git a/meta-oe/recipes-extended/rsyslog/rsyslog/0002-librelp-fix-function-inline-error.patch b/meta-oe/recipes-extended/rsyslog/rsyslog/0002-librelp-fix-function-inline-error.patch

new file mode 100644

index 000000000..60cf1b632

--- /dev/null

+++ b/meta-oe/recipes-extended/rsyslog/rsyslog/0002-librelp-fix-function-inline-error.patch

@@ -0,0 +1,59 @@

+From dc841f01fb6167ec9a80e373c5f4d2f5e3222ed6 Mon Sep 17 00:00:00 2001

+From: Yash Shinde <Yash.Shinde@windriver.com><mailto:Yash.Shinde@windriver.com>

+Date: Tue, 28 Mar 2023 04:06:58 +0000

+Subject: librelp: fix function inline errors in debug build

+

+With DEBUG_BUILD = "1", the following errors occur:

+

+   src/relpsess.c:95:1: error:

+      inlining failed in call to 'relpSessFreePermittedPeers': function not considered for inlining [-Werror=inline]

+

+   src/tcp.c:146:1: error:

+      inlining failed in call to 'relpTcpFreePermittedPeers': function not considered for inlining [-Werror=inline]

+

+   src/tcp.c:158:1: error:

+      inlining failed in call to 'callOnAuthErr': function not considered for inlining [-Werror=inline]

+

+Compiler does not inline any functions when not optimizing unless you specify the ‘always_inline’ attribute for the function. Add "__attribute__((always_inline))" to avoid these function inline errors.

+

+Upstream-Status: Tracked by upstream bug: https://github.com/rsyslog/librelp/issues/256

+

+Signed-off-by: Yash Shinde <Yash.Shinde@windriver.com><mailto:Yash.Shinde@windriver.com>

+---

+

+diff --git a/src/relpsess.c b/src/relpsess.c

+index ee7b595..aa52b71 100644

+--- a/src/relpsess.c

++++ b/src/relpsess.c

+@@ -91,7 +91,7 @@ callOnErr(const relpSess_t *__restrict__ const pThis,

+

+

+ /* helper to free permittedPeer structure */

+-static inline void

++__attribute__((always_inline)) static inline void

+ relpSessFreePermittedPeers(relpSess_t *const pThis)

+ {

+        int i;

+diff --git a/src/tcp.c b/src/tcp.c

+index 7a75cc4..f4088c0 100644

+--- a/src/tcp.c

++++ b/src/tcp.c

+@@ -142,7 +142,7 @@ static int relpTcpChkPeerName(relpTcp_t *const pThis, void* cert);

+

+

+ /* helper to free permittedPeer structure */

+-static inline void

++__attribute__((always_inline)) static inline void

+ relpTcpFreePermittedPeers(relpTcp_t *const pThis)

+ {

+        int i;

+@@ -154,7 +154,7 @@ relpTcpFreePermittedPeers(relpTcp_t *const pThis)

+ }

+

+ /* helper to call onAuthErr if set */

+-static inline void

++__attribute__((always_inline)) static inline void

+ callOnAuthErr(relpTcp_t *const pThis, const char *authdata, const char *emsg, relpRetVal ecode)

+ {

+        pThis->pEngine->dbgprint((char*)"librelp: auth error: authdata:'%s', ecode %d, "

+



--

# Randy MacLeod

# Wind River Linux


[-- Attachment #2: Type: text/html, Size: 18410 bytes --]

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

end of thread, other threads:[~2023-03-30  4:10 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <20230329075827.437650-1-yashinde145@gmail.com>
2023-03-29 13:36 ` [meta-oe][PATCH] librelp: fix function inline errors in debug build Randy MacLeod
2023-03-29 15:10   ` Yash Shinde
2023-03-29 15:12     ` Yash Shinde
2023-03-29 15:49   ` [oe] " Khem Raj
2023-03-30  4:10   ` Shinde, Yash
2023-03-30  4:10   ` Shinde, Yash
2023-03-29 12:36 Yash Shinde
  -- strict thread matches above, loose matches on Subject: below --
2023-03-29 12:32 Yash Shinde

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.