public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] MACHINE_START fix
@ 2005-10-29  5:43 Al Viro
  2005-10-29  8:52 ` Andreas Schwab
  2005-10-29  8:54 ` Russell King
  0 siblings, 2 replies; 3+ messages in thread
From: Al Viro @ 2005-10-29  5:43 UTC (permalink / raw)
  To: Linus Torvalds; +Cc: Russell King, linux-kernel

	unreferenced static variables can be killed by cc(1), so when
we want them to survive (we collect these suckers in array in special
section), we'd better not make them static.

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
----
diff -urN RC14-base/include/asm-arm/mach/arch.h current/include/asm-arm/mach/arch.h
--- RC14-base/include/asm-arm/mach/arch.h	2005-10-28 18:17:09.000000000 -0400
+++ current/include/asm-arm/mach/arch.h	2005-10-28 20:25:09.000000000 -0400
@@ -49,7 +49,7 @@
  * a table by the linker.
  */
 #define MACHINE_START(_type,_name)			\
-static const struct machine_desc __mach_desc_##_type	\
+const struct machine_desc __mach_desc_##_type	\
  __attribute__((__section__(".arch.info.init"))) = {	\
 	.nr		= MACH_TYPE_##_type,		\
 	.name		= _name,

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

* Re: [PATCH] MACHINE_START fix
  2005-10-29  5:43 [PATCH] MACHINE_START fix Al Viro
@ 2005-10-29  8:52 ` Andreas Schwab
  2005-10-29  8:54 ` Russell King
  1 sibling, 0 replies; 3+ messages in thread
From: Andreas Schwab @ 2005-10-29  8:52 UTC (permalink / raw)
  To: Al Viro; +Cc: Linus Torvalds, Russell King, linux-kernel

Al Viro <viro@ftp.linux.org.uk> writes:

> 	unreferenced static variables can be killed by cc(1), so when
> we want them to survive (we collect these suckers in array in special
> section), we'd better not make them static.

What about __attribute__used__?

Andreas.

-- 
Andreas Schwab, SuSE Labs, schwab@suse.de
SuSE Linux Products GmbH, Maxfeldstraße 5, 90409 Nürnberg, Germany
Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."

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

* Re: [PATCH] MACHINE_START fix
  2005-10-29  5:43 [PATCH] MACHINE_START fix Al Viro
  2005-10-29  8:52 ` Andreas Schwab
@ 2005-10-29  8:54 ` Russell King
  1 sibling, 0 replies; 3+ messages in thread
From: Russell King @ 2005-10-29  8:54 UTC (permalink / raw)
  To: Al Viro; +Cc: Linus Torvalds, linux-kernel

On Sat, Oct 29, 2005 at 06:43:01AM +0100, Al Viro wrote:
> 	unreferenced static variables can be killed by cc(1), so when
> we want them to survive (we collect these suckers in array in special
> section), we'd better not make them static.

Except this causes sparse to complain, which is why I made it static
last night.  Patch nacked.

What I did miss was making it __attribute_used__ which would be the
correct answer.

-- 
Russell King
 Linux kernel    2.6 ARM Linux   - http://www.arm.linux.org.uk/
 maintainer of:  2.6 Serial core

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

end of thread, other threads:[~2005-10-29  8:54 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-10-29  5:43 [PATCH] MACHINE_START fix Al Viro
2005-10-29  8:52 ` Andreas Schwab
2005-10-29  8:54 ` Russell King

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