linux-um archives
 help / color / mirror / Atom feed
* [uml-devel] [PATCH] um: handle GCC 5.x like GCC 4.x
@ 2015-05-24 13:23 Hans-Werner Hilse
  2015-05-24 16:12 ` Richard Weinberger
  0 siblings, 1 reply; 4+ messages in thread
From: Hans-Werner Hilse @ 2015-05-24 13:23 UTC (permalink / raw)
  To: user-mode-linux-devel

Compiler compatibility macros were conditionally defined based on
the compiler version. The it tested __GNUC__, but compared it to
a maximum value of 4, breaking compilation on now current GCC 5.x.
Thus, the check is extended to check for version 4.x and beyond.

Signed-off-by: Hans-Werner Hilse <hwhilse@gmail.com>
---
 arch/um/include/shared/init.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/um/include/shared/init.h b/arch/um/include/shared/init.h
index b3906f8..ecdec48 100644
--- a/arch/um/include/shared/init.h
+++ b/arch/um/include/shared/init.h
@@ -54,7 +54,7 @@ typedef void (*exitcall_t)(void);
 #endif
 
 #else
-#if __GNUC__ == 4
+#if __GNUC__ >= 4
 # define __used			__attribute__((__used__))
 #endif
 #endif
-- 
2.4.1


------------------------------------------------------------------------------
One dashboard for servers and applications across Physical-Virtual-Cloud 
Widest out-of-the-box monitoring support with 50+ applications
Performance metrics, stats and reports that give you Actionable Insights
Deep dive visibility with transaction tracing using APM Insight.
http://ad.doubleclick.net/ddm/clk/290420510;117567292;y
_______________________________________________
User-mode-linux-devel mailing list
User-mode-linux-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel


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

* Re: [uml-devel] [PATCH] um: handle GCC 5.x like GCC 4.x
  2015-05-24 13:23 [uml-devel] [PATCH] um: handle GCC 5.x like GCC 4.x Hans-Werner Hilse
@ 2015-05-24 16:12 ` Richard Weinberger
  2015-05-24 22:12   ` Richard Weinberger
  0 siblings, 1 reply; 4+ messages in thread
From: Richard Weinberger @ 2015-05-24 16:12 UTC (permalink / raw)
  To: Hans-Werner Hilse; +Cc: user-mode-linux-devel@lists.sourceforge.net

On Sun, May 24, 2015 at 3:23 PM, Hans-Werner Hilse <hwhilse@gmail.com> wrote:
> Compiler compatibility macros were conditionally defined based on
> the compiler version. The it tested __GNUC__, but compared it to
> a maximum value of 4, breaking compilation on now current GCC 5.x.
> Thus, the check is extended to check for version 4.x and beyond.
>
> Signed-off-by: Hans-Werner Hilse <hwhilse@gmail.com>
> ---
>  arch/um/include/shared/init.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/arch/um/include/shared/init.h b/arch/um/include/shared/init.h
> index b3906f8..ecdec48 100644
> --- a/arch/um/include/shared/init.h
> +++ b/arch/um/include/shared/init.h
> @@ -54,7 +54,7 @@ typedef void (*exitcall_t)(void);
>  #endif
>
>  #else
> -#if __GNUC__ == 4
> +#if __GNUC__ >= 4
>  # define __used                        __attribute__((__used__))
>  #endif
>  #endif

Hmm, instead of continue with that hack it would be much nicer to get rid
of the copy&pasted __user define.

-- 
Thanks,
//richard

------------------------------------------------------------------------------
One dashboard for servers and applications across Physical-Virtual-Cloud 
Widest out-of-the-box monitoring support with 50+ applications
Performance metrics, stats and reports that give you Actionable Insights
Deep dive visibility with transaction tracing using APM Insight.
http://ad.doubleclick.net/ddm/clk/290420510;117567292;y
_______________________________________________
User-mode-linux-devel mailing list
User-mode-linux-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel


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

* Re: [uml-devel] [PATCH] um: handle GCC 5.x like GCC 4.x
  2015-05-24 16:12 ` Richard Weinberger
@ 2015-05-24 22:12   ` Richard Weinberger
  2015-05-24 22:33     ` Hans-Werner Hilse
  0 siblings, 1 reply; 4+ messages in thread
From: Richard Weinberger @ 2015-05-24 22:12 UTC (permalink / raw)
  To: Hans-Werner Hilse; +Cc: user-mode-linux-devel@lists.sourceforge.net

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

On Sun, May 24, 2015 at 6:12 PM, Richard Weinberger
<richard.weinberger@gmail.com> wrote:
> Hmm, instead of continue with that hack it would be much nicer to get rid
> of the copy&pasted __user define.

Hans-Werner, can you please give the attached patch a try?
It should fix your issue too.

-- 
Thanks,
//richard

[-- Attachment #2: uml_cleanup_init.h.diff --]
[-- Type: text/plain, Size: 3396 bytes --]

diff --git a/arch/um/Makefile b/arch/um/Makefile
index 17d4460..098ab33 100644
--- a/arch/um/Makefile
+++ b/arch/um/Makefile
@@ -68,9 +68,10 @@ KBUILD_CFLAGS += $(CFLAGS) $(CFLAGS-y) -D__arch_um__ \
 
 KBUILD_AFLAGS += $(ARCH_INCLUDE)
 
-USER_CFLAGS = $(patsubst $(KERNEL_DEFINES),,$(patsubst -D__KERNEL__,,\
-	$(patsubst -I%,,$(KBUILD_CFLAGS)))) $(ARCH_INCLUDE) $(MODE_INCLUDE) \
-	$(filter -I%,$(CFLAGS)) -D_FILE_OFFSET_BITS=64 -idirafter include
+USER_CFLAGS = $(patsubst $(KERNEL_DEFINES),,$(patsubst -I%,,$(KBUILD_CFLAGS))) \
+		$(ARCH_INCLUDE) $(MODE_INCLUDE) $(filter -I%,$(CFLAGS)) \
+		-D_FILE_OFFSET_BITS=64 -idirafter include \
+		-D__KERNEL__ -D__UM_HOST__
 
 #This will adjust *FLAGS accordingly to the platform.
 include $(ARCH_DIR)/Makefile-os-$(OS)
diff --git a/arch/um/drivers/mconsole.h b/arch/um/drivers/mconsole.h
index 8b22535..44af737 100644
--- a/arch/um/drivers/mconsole.h
+++ b/arch/um/drivers/mconsole.h
@@ -7,7 +7,7 @@
 #ifndef __MCONSOLE_H__
 #define __MCONSOLE_H__
 
-#ifndef __KERNEL__
+#ifdef __UM_HOST__
 #include <stdint.h>
 #define u32 uint32_t
 #endif
diff --git a/arch/um/include/shared/init.h b/arch/um/include/shared/init.h
index b3906f8..233e259 100644
--- a/arch/um/include/shared/init.h
+++ b/arch/um/include/shared/init.h
@@ -40,28 +40,8 @@
 typedef int (*initcall_t)(void);
 typedef void (*exitcall_t)(void);
 
-#ifndef __KERNEL__
-#ifndef __section
-# define __section(S) __attribute__ ((__section__(#S)))
-#endif
-
-#if __GNUC__ == 3
-
-#if __GNUC_MINOR__ >= 3
-# define __used			__attribute__((__used__))
-#else
-# define __used			__attribute__((__unused__))
-#endif
-
-#else
-#if __GNUC__ == 4
-# define __used			__attribute__((__used__))
-#endif
-#endif
-
-#else
 #include <linux/compiler.h>
-#endif
+
 /* These are for everybody (although not all archs will actually
    discard it in modules) */
 #define __init		__section(.init.text)
@@ -131,7 +111,7 @@ extern struct uml_param __uml_setup_start, __uml_setup_end;
 #define __uml_postsetup_call	__used __section(.uml.postsetup.init)
 #define __uml_exit_call		__used __section(.uml.exitcall.exit)
 
-#ifndef __KERNEL__
+#ifdef __UM_HOST__
 
 #define __define_initcall(level,fn) \
 	static initcall_t __initcall_##fn __used \
diff --git a/arch/um/include/shared/user.h b/arch/um/include/shared/user.h
index cef0685..4cff19f 100644
--- a/arch/um/include/shared/user.h
+++ b/arch/um/include/shared/user.h
@@ -17,7 +17,7 @@
 #define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
 
 /* This is to get size_t */
-#ifdef __KERNEL__
+#ifndef __UM_HOST__
 #include <linux/types.h>
 #else
 #include <stddef.h>
diff --git a/arch/x86/um/shared/sysdep/tls.h b/arch/x86/um/shared/sysdep/tls.h
index 27cce00..a682db1 100644
--- a/arch/x86/um/shared/sysdep/tls.h
+++ b/arch/x86/um/shared/sysdep/tls.h
@@ -1,7 +1,7 @@
 #ifndef _SYSDEP_TLS_H
 #define _SYSDEP_TLS_H
 
-# ifndef __KERNEL__
+#ifdef __UM_HOST__
 
 /* Change name to avoid conflicts with the original one from <asm/ldt.h>, which
  * may be named user_desc (but in 2.4 and in header matching its API was named
@@ -22,11 +22,11 @@ typedef struct um_dup_user_desc {
 #endif
 } user_desc_t;
 
-# else /* __KERNEL__ */
+#else /* __UM_HOST__ */
 
 typedef struct user_desc user_desc_t;
 
-# endif /* __KERNEL__ */
+#endif /* __UM_HOST__ */
 
 extern int os_set_thread_area(user_desc_t *info, int pid);
 extern int os_get_thread_area(user_desc_t *info, int pid);

[-- Attachment #3: Type: text/plain, Size: 409 bytes --]

------------------------------------------------------------------------------
One dashboard for servers and applications across Physical-Virtual-Cloud 
Widest out-of-the-box monitoring support with 50+ applications
Performance metrics, stats and reports that give you Actionable Insights
Deep dive visibility with transaction tracing using APM Insight.
http://ad.doubleclick.net/ddm/clk/290420510;117567292;y

[-- Attachment #4: Type: text/plain, Size: 194 bytes --]

_______________________________________________
User-mode-linux-devel mailing list
User-mode-linux-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel

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

* Re: [uml-devel] [PATCH] um: handle GCC 5.x like GCC 4.x
  2015-05-24 22:12   ` Richard Weinberger
@ 2015-05-24 22:33     ` Hans-Werner Hilse
  0 siblings, 0 replies; 4+ messages in thread
From: Hans-Werner Hilse @ 2015-05-24 22:33 UTC (permalink / raw)
  To: user-mode-linux-devel

Hi Richard,

Am 2015-05-25 00:12, schrieb Richard Weinberger:
> On Sun, May 24, 2015 at 6:12 PM, Richard Weinberger
> <richard.weinberger@gmail.com> wrote:
>> Hmm, instead of continue with that hack it would be much nicer to get 
>> rid
>> of the copy&pasted __user define.
> 
> Hans-Werner, can you please give the attached patch a try?
> It should fix your issue too.

Thanks for spending the time!

Indeed, it works (tried it against Linus' master) and fixes the issue
I encountered with GCC 5.1.0.

It looks much cleaner afterwards, too :-)

-hwh

------------------------------------------------------------------------------
One dashboard for servers and applications across Physical-Virtual-Cloud 
Widest out-of-the-box monitoring support with 50+ applications
Performance metrics, stats and reports that give you Actionable Insights
Deep dive visibility with transaction tracing using APM Insight.
http://ad.doubleclick.net/ddm/clk/290420510;117567292;y
_______________________________________________
User-mode-linux-devel mailing list
User-mode-linux-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel


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

end of thread, other threads:[~2015-05-24 23:13 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-05-24 13:23 [uml-devel] [PATCH] um: handle GCC 5.x like GCC 4.x Hans-Werner Hilse
2015-05-24 16:12 ` Richard Weinberger
2015-05-24 22:12   ` Richard Weinberger
2015-05-24 22:33     ` Hans-Werner Hilse

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox