All of lore.kernel.org
 help / color / mirror / Atom feed
* [uml-devel] [patch] module symbol fix
@ 2004-02-26 21:26 Gerd Knorr
  2004-02-27  9:26 ` [uml-devel] " Gerd Knorr
  0 siblings, 1 reply; 3+ messages in thread
From: Gerd Knorr @ 2004-02-26 21:26 UTC (permalink / raw)
  To: Jeff Dike; +Cc: uml devel

  Hi,

recent gcc versions need this one ...

  Gerd

--- linux-um-2.6.3/arch/um/kernel/user_syms.c.uml	2004-02-26 21:20:51.202244050 +0100
+++ linux-um-2.6.3/arch/um/kernel/user_syms.c	2004-02-26 21:21:06.599701859 +0100
@@ -57,6 +57,7 @@
 	__attribute__((section("__ksymtab_strings")))		\
 	= MODULE_SYMBOL_PREFIX #sym;                    	\
 	static const struct kernel_symbol __ksymtab_##sym	\
+	__attribute_used__					\
 	__attribute__((section("__ksymtab" sec), unused))	\
 	= { (unsigned long)&sym, __kstrtab_##sym }
 


-------------------------------------------------------
SF.Net is sponsored by: Speed Start Your Linux Apps Now.
Build and deploy apps & Web services for Linux with
a free DVD software kit from IBM. Click Now!
http://ads.osdn.com/?ad_id=1356&alloc_id=3438&op=click
_______________________________________________
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] 3+ messages in thread

* [uml-devel] Re: [patch] module symbol fix
  2004-02-26 21:26 [uml-devel] [patch] module symbol fix Gerd Knorr
@ 2004-02-27  9:26 ` Gerd Knorr
  2004-02-28 16:32   ` BlaisorBlade
  0 siblings, 1 reply; 3+ messages in thread
From: Gerd Knorr @ 2004-02-27  9:26 UTC (permalink / raw)
  To: Jeff Dike; +Cc: uml devel

On Thu, Feb 26, 2004 at 10:26:55PM +0100, Gerd Knorr wrote:
>   Hi,
> 
> recent gcc versions need this one ...

Another one of this kind (without this gcc may optimizes away the static
declared but unreferenced stuff, resulting in initrd= and --help options
not working any more for example ...).

  Gerd

--- linux-um-2.6.3/arch/um/include/init.h.used	2004-02-27 09:34:57.874205081 +0100
+++ linux-um-2.6.3/arch/um/include/init.h	2004-02-27 09:44:32.415275725 +0100
@@ -40,9 +40,9 @@
 typedef int (*initcall_t)(void);
 typedef void (*exitcall_t)(void);
 
-#define __init          __attribute__ ((__section__ (".text.init")))
+#define __init          __attribute__ ((used,__section__ (".text.init")))
 #define __exit          __attribute__ ((unused, __section__(".text.exit")))
-#define __initdata      __attribute__ ((__section__ (".data.init")))
+#define __initdata      __attribute__ ((used,__section__ (".data.init")))
 
 #endif
 
@@ -94,11 +94,11 @@
  * Mark functions and data as being only used at initialization
  * or exit time.
  */
-#define __uml_init_setup	__attribute__ ((unused,__section__ (".uml.setup.init")))
-#define __uml_setup_help	__attribute__ ((unused,__section__ (".uml.help.init")))
-#define __uml_init_call		__attribute__ ((unused,__section__ (".uml.initcall.init")))
-#define __uml_postsetup_call	__attribute__ ((unused,__section__ (".uml.postsetup.init")))
-#define __uml_exit_call		__attribute__ ((unused,__section__ (".uml.exitcall.exit")))
+#define __uml_init_setup	__attribute__ ((used,__section__ (".uml.setup.init")))
+#define __uml_setup_help	__attribute__ ((used,__section__ (".uml.help.init")))
+#define __uml_init_call		__attribute__ ((used,__section__ (".uml.initcall.init")))
+#define __uml_postsetup_call	__attribute__ ((used,__section__ (".uml.postsetup.init")))
+#define __uml_exit_call		__attribute__ ((used,__section__ (".uml.exitcall.exit")))
 
 #endif /* _LINUX_UML_INIT_H */
 


-------------------------------------------------------
SF.Net is sponsored by: Speed Start Your Linux Apps Now.
Build and deploy apps & Web services for Linux with
a free DVD software kit from IBM. Click Now!
http://ads.osdn.com/?ad_id=1356&alloc_id=3438&op=click
_______________________________________________
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] 3+ messages in thread

* Re: [uml-devel] Re: [patch] module symbol fix
  2004-02-27  9:26 ` [uml-devel] " Gerd Knorr
@ 2004-02-28 16:32   ` BlaisorBlade
  0 siblings, 0 replies; 3+ messages in thread
From: BlaisorBlade @ 2004-02-28 16:32 UTC (permalink / raw)
  To: user-mode-linux-devel

Alle 10:26, venerdì 27 febbraio 2004, Gerd Knorr ha scritto:
> On Thu, Feb 26, 2004 at 10:26:55PM +0100, Gerd Knorr wrote:
> >   Hi,
> >
> > recent gcc versions need this one ...
>
> Another one of this kind (without this gcc may optimizes away the static
> declared but unreferenced stuff, resulting in initrd= and --help options
> not working any more for example ...).

Yes, but it needs to be made work with older gcc, even 2.95.3 but also 3.2 - 
and this means using __attribute__(__unused__) if needed - i.e. using 
__attribute__used as in the first patch (using more than one attribute works, 
as in include/linux/init.h).

The problem is that init.h is included even in userspace modules so it cannot 
include kernel headers - also, it seems that user_syms.c does not include 
<linux/compiler.h> and so __attribute_used cannot be expanded simply. If it 
works on you, check if the define comes from /usr/include/linux/compiler.h.

Duplicating the version check from include/linux/compiler* will be needed to 
avoid the problems you pointed out and possibly others, but not being able to 
include linux/* in user-objs is increasingly sucking. Sadly there are reasons 
for this and they are good (I discovered this while trying to remove this 
limitation):

- user space headers include /usr/include/linux/*, so if you add -I<source 
tree root>/include, those headers will include _other_ linux headers and 
things will not work - especially, they will include <source tree 
root>/include/asm-um/* instead of /usr/include/asm/*.

- definitions depending on CONFIG_* would be messed up; in fact, uml-config.h 
is a translation of config.h which defines UML_CONFIG_* instead of CONFIG_*, 
because CONFIG_* macros are defined by /usr/include/linux/autoconf.h. So if 
an "user-objs" file includes linux/mm.h, that header could even think that 
CONFIG_HIGHMEM is defined because the distro said so!
-- 
Paolo Giarrusso, aka Blaisorblade
Linux registered user n. 292729



-------------------------------------------------------
SF.Net is sponsored by: Speed Start Your Linux Apps Now.
Build and deploy apps & Web services for Linux with
a free DVD software kit from IBM. Click Now!
http://ads.osdn.com/?ad_id\x1356&alloc_id438&opÌk
_______________________________________________
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] 3+ messages in thread

end of thread, other threads:[~2004-02-28 19:59 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-02-26 21:26 [uml-devel] [patch] module symbol fix Gerd Knorr
2004-02-27  9:26 ` [uml-devel] " Gerd Knorr
2004-02-28 16:32   ` BlaisorBlade

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.