Skip to contentSkip to conversation

MACHINE_START fix

PATCH In review Al Viro 3 participants 3 messages Oct 29, 2005

lore
Share & tools
lore

Al Viro

author
#0 lore raw

PATCH 1/1 MACHINE_START fix

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.

----

include/asm-arm/mach/arch.h +1 -1
diff -urN RC14-base/include/asm-arm/mach/arch.h current/include/asm-arm/mach/arch.h
@@ -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,
#1 lore raw
Quoted 3 lines · Al Viro

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.

Signature · 4 lines
Andreas Schwab, SuSE Labs, [email protected]
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."
#2 lore raw
In reply to Al Viro
Quoted 3 lines · Al Viro

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.

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