mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: David Mosberger <davidm@napali.hpl.hp.com>
To: torvalds@transmeta.com
Cc: Jan Hubicka <jh@suse.cz>, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] Use -fno-unit-at-a-time if gcc supports it
Date: Mon, 8 Sep 2003 13:32:40 -0700	[thread overview]
Message-ID: <16220.59240.88906.573561@napali.hpl.hp.com> (raw)
In-Reply-To: <ugbrty49ri.fsf@panda.mostang.com>

Here is a minimal platform-independent patch which lets me build the
ia64 kernel with the current gcc-pre3.4 snapshot (which optimizes away
static variables which have no compiler-visible references).  All it
does is mark the init-call macros with "__attribute_unused__" (plus a
minor whitespace fix).

I did have to add an include of <linux/compiler.h> to <linux/init.h>.
That ought to be safe, because the only other include file used by
these files is <linux/config.h>.

Please apply, if there are no objections.

Thanks,

	--david

# This is a BitKeeper generated patch for the following project:
# Project Name: Linux kernel tree
# This patch format is intended for GNU patch command version 2.5 or higher.
# This patch includes the following deltas:
#	           ChangeSet	1.1305  -> 1.1306 
#	include/linux/init.h	1.26    -> 1.27   
#
# The following is the BitKeeper ChangeSet Log
# --------------------------------------------
# 03/09/08	davidm@tiger.hpl.hp.com	1.1306
# Mark initcall macros with __attribute_used__ so the definitions do not
# get optimized away by the compiler (such as the latest GCC pre-3.4).
# --------------------------------------------
#
diff -Nru a/include/linux/init.h b/include/linux/init.h
--- a/include/linux/init.h	Mon Sep  8 13:28:21 2003
+++ b/include/linux/init.h	Mon Sep  8 13:28:21 2003
@@ -2,6 +2,7 @@
 #define _LINUX_INIT_H
 
 #include <linux/config.h>
+#include <linux/compiler.h>
 
 /* These macros are used to mark some functions or 
  * initialized data (doesn't apply to uninitialized data)
@@ -71,15 +72,16 @@
 
 #ifndef __ASSEMBLY__
 
-/* initcalls are now grouped by functionality into separate 
+/* initcalls are now grouped by functionality into separate
  * subsections. Ordering inside the subsections is determined
- * by link order. 
- * For backwards compatibility, initcall() puts the call in 
+ * by link order.
+ * For backwards compatibility, initcall() puts the call in
  * the device init subsection.
  */
 
-#define __define_initcall(level,fn) \
-	static initcall_t __initcall_##fn __attribute__ ((unused,__section__ (".initcall" level ".init"))) = fn
+#define __define_initcall(level,fn)								\
+	static initcall_t __initcall_##fn							\
+	  __attribute_used__ __attribute__ ((__section__ (".initcall" level ".init"))) = fn
 
 #define core_initcall(fn)		__define_initcall("1",fn)
 #define postcore_initcall(fn)		__define_initcall("2",fn)
@@ -95,10 +97,12 @@
 	static exitcall_t __exitcall_##fn __exit_call = fn
 
 #define console_initcall(fn) \
-	static initcall_t __initcall_##fn __attribute__ ((unused,__section__ (".con_initcall.init")))=fn
+	static initcall_t __initcall_##fn \
+	  __attribute_used__ __attribute__ ((__section__ (".con_initcall.init"))) = fn
 
 #define security_initcall(fn) \
-	static initcall_t __initcall_##fn __attribute__ ((unused,__section__ (".security_initcall.init"))) = fn
+	static initcall_t __initcall_##fn \
+	  __attribute_used__ __attribute__ ((__section__ (".security_initcall.init"))) = fn
 
 struct obs_kernel_param {
 	const char *str;
@@ -106,10 +110,10 @@
 };
 
 /* OBSOLETE: see moduleparam.h for the right way. */
-#define __setup(str, fn)						\
-	static char __setup_str_##fn[] __initdata = str;		\
-	static struct obs_kernel_param __setup_##fn			\
-		 __attribute__((unused,__section__ (".init.setup")))	\
+#define __setup(str, fn)							\
+	static char __setup_str_##fn[] __initdata = str;			\
+	static struct obs_kernel_param __setup_##fn				\
+		__attribute_used__ __attribute__((__section__ (".init.setup")))	\
 		= { __setup_str_##fn, fn }
 
 #endif /* __ASSEMBLY__ */

  reply	other threads:[~2003-09-08 20:33 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <sqnW.3zE.13@gated-at.bofh.it>
     [not found] ` <sqHd.3Yj.1@gated-at.bofh.it>
     [not found]   ` <srtA.53H.1@gated-at.bofh.it>
     [not found]     ` <sFmW.78P.13@gated-at.bofh.it>
2003-09-06  8:10       ` David Mosberger-Tang
2003-09-08 20:32         ` David Mosberger [this message]
2003-09-05  0:47 Andi Kleen
2003-09-05  1:05 ` Aaron Lehmann
2003-09-05  1:24   ` Andi Kleen
2003-09-05  5:37 ` Jan Hubicka
2003-09-05 17:27   ` Andi Kleen
2003-09-05 17:59     ` Jeff Garzik
2003-09-06  7:08     ` Jan Hubicka
2003-09-05 14:54 ` Linus Torvalds
2003-09-05 15:17   ` Andreas Jaeger
2003-09-05 16:16     ` Robert Love
2003-09-05 16:10       ` Andreas Jaeger
2003-09-06  7:06       ` Jan Hubicka
2003-09-05 17:19     ` Jakub Jelinek
2003-09-05 17:30     ` Andi Kleen
2003-09-08  9:48     ` Helge Hafting

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=16220.59240.88906.573561@napali.hpl.hp.com \
    --to=davidm@napali.hpl.hp.com \
    --cc=davidm@hpl.hp.com \
    --cc=jh@suse.cz \
    --cc=linux-kernel@vger.kernel.org \
    --cc=torvalds@transmeta.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®