[yocto] [PATCH][meta-selinux] audit/auvirt: get inline functions work with C99

wenzong fan wenzong.fan at windriver.com
Sun Sep 13 23:10:54 PDT 2015


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 at windriver.com wrote:
> From: Wenzong Fan <wenzong.fan at 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 at 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 at 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 at 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"
>



More information about the yocto mailing list