Skip to contentSkip to conversation

um: handle GCC 5.x like GCC 4.x

PATCH In review Hans-Werner Hilse 2 participants 4 messages May 24, 2015

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 um: handle GCC 5.x like GCC 4.x

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.

---
 arch/um/include/shared/init.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/um/include/shared/init.h +1 -1
index b3906f8..ecdec48 100644
@@ -54,7 +54,7 @@ typedef void (*exitcall_t)(void);
 #endif
 
 #else
-#if __GNUC__ == 4
+#if __GNUC__ >= 4
 # define __used			__attribute__((__used__))
 #endif
 #endif
Signature · 13 lines
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
[email protected]
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel
#1 lore raw
Quoted 15 lines · Hans-Werner Hilse

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.

---
 arch/um/include/shared/init.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/um/include/shared/init.h +0 -0
index b3906f8..ecdec48 100644

arch/um/include/shared/init.h typedef void (*exitcall_t)(void); · line 60

Quoted 8 lines
arch/um/include/shared/init.h +1 -1
@@ -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.

Signature · 13 lines
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
[email protected]
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel
#2 lore raw
Quoted 2 lines · Richard Weinberger

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.

Signature · 2 lines
Thanks,
//richard
arch/um/Makefile +4 -3
index 17d4460..098ab33 100644
@@ -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)
arch/um/drivers/mconsole.h +1 -1
index 8b22535..44af737 100644
@@ -7,7 +7,7 @@
 #ifndef __MCONSOLE_H__
 #define __MCONSOLE_H__
 
-#ifndef __KERNEL__
+#ifdef __UM_HOST__
 #include <stdint.h>
 #define u32 uint32_t
 #endif
arch/um/include/shared/init.h +2 -22
index b3906f8..233e259 100644
@@ -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 \
arch/um/include/shared/user.h +1 -1
index cef0685..4cff19f 100644
@@ -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>
arch/x86/um/shared/sysdep/tls.h +3 -3
index 27cce00..a682db1 100644
@@ -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);

------------------------------------------------------------------------------
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
[email protected]
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel

#3 lore raw

Hi Richard,

Am 2015-05-25 00:12, schrieb Richard Weinberger:

Quoted 8 lines
Quoted 3 lines · Richard Weinberger

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 [email protected]
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel