All of lore.kernel.org
 help / color / mirror / Atom feed
From: wenzong fan <wenzong.fan@windriver.com>
To: <yocto@yoctoproject.org>
Subject: Re: [PATCH][meta-selinux] audit/auvirt: get inline functions work with C99
Date: Mon, 14 Sep 2015 14:10:54 +0800	[thread overview]
Message-ID: <55F664EE.1020107@windriver.com> (raw)
In-Reply-To: <1441965035-166887-1-git-send-email-wenzong.fan@windriver.com>

The "extern inline" will fail to build with gcc 4.x, but "static inline" 
work with both gcc 4 & 5.

I'll send V2 patch for make the change. Please ignore this one.

Thanks
Wenzong

On 09/11/2015 05:50 PM, wenzong.fan@windriver.com wrote:
> From: Wenzong Fan <wenzong.fan@windriver.com>
>
> This fixes link errors:
>
>    auvirt.c:484: undefined reference to `copy_str'
>    auvirt.c:667: undefined reference to `is_resource'
>
> As gcc5 doc about "Different semantics for inline functions":
>
>    > C99 extern inline: An externally visible function is generated; \
>    > same as GNU89 inline.
>
>    > To fix this, either mark the function foo as extern, or add the \
>    > following declaration: extern inline int foo (void);
>
> (from https://gcc.gnu.org/gcc-5/porting_to.html)
>
> Signed-off-by: Wenzong Fan <wenzong.fan@windriver.com>
> ---
>   ...auvirt-get-inline-functions-work-with-C99.patch | 52 ++++++++++++++++++++++
>   recipes-security/audit/audit_2.4.3.bb              |  1 +
>   2 files changed, 53 insertions(+)
>   create mode 100644 recipes-security/audit/audit/audit-auvirt-get-inline-functions-work-with-C99.patch
>
> diff --git a/recipes-security/audit/audit/audit-auvirt-get-inline-functions-work-with-C99.patch b/recipes-security/audit/audit/audit-auvirt-get-inline-functions-work-with-C99.patch
> new file mode 100644
> index 0000000..b5b39e4
> --- /dev/null
> +++ b/recipes-security/audit/audit/audit-auvirt-get-inline-functions-work-with-C99.patch
> @@ -0,0 +1,52 @@
> +From 15036dd4fa9eb209f5e148c6f7ee081f5ca78fa4 Mon Sep 17 00:00:00 2001
> +From: Wenzong Fan <wenzong.fan@windriver.com>
> +Date: Fri, 11 Sep 2015 03:37:13 -0400
> +Subject: [PATCH] audit/auvirt: get inline functions work with C99
> +
> +This fixes link errors:
> +
> +  auvirt.c:484: undefined reference to `copy_str'
> +  auvirt.c:667: undefined reference to `is_resource'
> +
> +As gcc5 doc about "Different semantics for inline functions":
> +
> +  > C99 extern inline: An externally visible function is generated; \
> +  > same as GNU89 inline.
> +
> +  > To fix this, either mark the function foo as extern, or add the \
> +  > following declaration: extern inline int foo (void);
> +
> +(from https://gcc.gnu.org/gcc-5/porting_to.html)
> +
> +Upstream Status: pending
> +
> +Signed-off-by: Wenzong Fan <wenzong.fan@windriver.com>
> +---
> + tools/auvirt/auvirt.c | 4 ++--
> + 1 file changed, 2 insertions(+), 2 deletions(-)
> +
> +diff --git a/tools/auvirt/auvirt.c b/tools/auvirt/auvirt.c
> +index 655c454..b16d718 100644
> +--- a/tools/auvirt/auvirt.c
> ++++ b/tools/auvirt/auvirt.c
> +@@ -138,7 +138,7 @@ void event_free(struct event *event)
> + 	}
> + }
> +
> +-inline char *copy_str(const char *str)
> ++extern inline char *copy_str(const char *str)
> + {
> + 	return (str) ? strdup(str) : NULL;
> + }
> +@@ -650,7 +650,7 @@ int process_control_event(auparse_state_t *au)
> + 	return 0;
> + }
> +
> +-inline int is_resource(const char *res)
> ++extern inline int is_resource(const char *res)
> + {
> + 	if (res == NULL ||
> + 	    res[0] == '\0' ||
> +--
> +1.9.1
> +
> diff --git a/recipes-security/audit/audit_2.4.3.bb b/recipes-security/audit/audit_2.4.3.bb
> index 0fcf145..9a700d4 100644
> --- a/recipes-security/audit/audit_2.4.3.bb
> +++ b/recipes-security/audit/audit_2.4.3.bb
> @@ -15,6 +15,7 @@ SRC_URI = "http://people.redhat.com/sgrubb/audit/audit-${PV}.tar.gz \
>              file://auditd \
>              file://auditd.service \
>              file://audit-volatile.conf \
> +           file://audit-auvirt-get-inline-functions-work-with-C99.patch \
>   "
>   SRC_URI[md5sum] = "544d863af2016b76afd8d1691b251164"
>   SRC_URI[sha256sum] = "9c914704fecc602e143e37152f3efbab2469692684c1a8cc1b801c1b49c7abc6"
>


      reply	other threads:[~2015-09-14  6:11 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-09-11  9:50 [PATCH][meta-selinux] audit/auvirt: get inline functions work with C99 wenzong.fan
2015-09-14  6:10 ` wenzong fan [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=55F664EE.1020107@windriver.com \
    --to=wenzong.fan@windriver.com \
    --cc=yocto@yoctoproject.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.