unset INITRAMFS_SOURCE if appropriate
[buildroot.git] / toolchain / kernel-headers / linux-2.6.20.4-dwmw2-combined.01.diff
blobd07dd33d2b6a3f06ce1ea5eb667233de19b6d54c
1 \\\\ dwmw2's --combine -fwhole-program patch for the kernel
2 \\ original of this incarnation was here:
3 \\ http://david.woodhou.se/linux-combine-build.patch
4 diff -rduNp linux-2.6.20.4.orig/drivers/md/md.c linux-2.6.20.4/drivers/md/md.c
5 --- linux-2.6.20.4.orig/drivers/md/md.c 2007-03-13 19:27:08.000000000 +0100
6 +++ linux-2.6.20.4/drivers/md/md.c 2007-03-24 20:14:10.000000000 +0100
7 @@ -2944,6 +2944,7 @@ static struct kobj_type md_ktype = {
8 };
10 int mdp_major = 0;
11 +__internal_export(mdp_major);
13 static struct kobject *md_probe(dev_t dev, int *part, void *data)
15 @@ -5602,7 +5603,7 @@ void md_autodetect_dev(dev_t dev)
16 if (dev_cnt >= 0 && dev_cnt < 127)
17 detected_devices[dev_cnt++] = dev;
20 +__internal_export(md_autodetect_dev);
22 static void autostart_arrays(int part)
24 diff -rduNp linux-2.6.20.4.orig/drivers/video/fbcvt.c linux-2.6.20.4/drivers/video/fbcvt.c
25 --- linux-2.6.20.4.orig/drivers/video/fbcvt.c 2007-03-13 19:27:08.000000000 +0100
26 +++ linux-2.6.20.4/drivers/video/fbcvt.c 2007-03-24 20:14:10.000000000 +0100
27 @@ -376,3 +376,4 @@ int fb_find_mode_cvt(struct fb_videomode
29 return 0;
31 +__internal_export(fb_find_mode_cvt);
32 diff -rduNp linux-2.6.20.4.orig/fs/debugfs/inode.c linux-2.6.20.4/fs/debugfs/inode.c
33 --- linux-2.6.20.4.orig/fs/debugfs/inode.c 2007-03-13 19:27:08.000000000 +0100
34 +++ linux-2.6.20.4/fs/debugfs/inode.c 2007-03-24 20:14:10.000000000 +0100
35 @@ -29,7 +29,7 @@
36 #define DEBUGFS_MAGIC 0x64626720
38 /* declared over in file.c */
39 -extern struct file_operations debugfs_file_operations;
40 +extern const struct file_operations debugfs_file_operations;
42 static struct vfsmount *debugfs_mount;
43 static int debugfs_mount_count;
44 diff -rduNp linux-2.6.20.4.orig/fs/devpts/inode.c linux-2.6.20.4/fs/devpts/inode.c
45 --- linux-2.6.20.4.orig/fs/devpts/inode.c 2007-03-13 19:27:08.000000000 +0100
46 +++ linux-2.6.20.4/fs/devpts/inode.c 2007-03-24 20:14:10.000000000 +0100
47 @@ -185,6 +185,7 @@ int devpts_pty_new(struct tty_struct *tt
49 return 0;
51 +__internal_export(devpts_pty_new);
53 struct tty_struct *devpts_get_tty(int number)
55 @@ -202,6 +203,7 @@ struct tty_struct *devpts_get_tty(int nu
57 return tty;
59 +__internal_export(devpts_get_tty);
61 void devpts_pty_kill(int number)
63 @@ -218,6 +220,7 @@ void devpts_pty_kill(int number)
65 mutex_unlock(&devpts_root->d_inode->i_mutex);
67 +__internal_export(devpts_pty_kill);
69 static int __init init_devpts_fs(void)
71 diff -rduNp linux-2.6.20.4.orig/fs/hfsplus/inode.c linux-2.6.20.4/fs/hfsplus/inode.c
72 --- linux-2.6.20.4.orig/fs/hfsplus/inode.c 2007-03-13 19:27:08.000000000 +0100
73 +++ linux-2.6.20.4/fs/hfsplus/inode.c 2007-03-24 20:14:10.000000000 +0100
74 @@ -269,7 +269,7 @@ static int hfsplus_file_release(struct i
77 extern struct inode_operations hfsplus_dir_inode_operations;
78 -extern struct file_operations hfsplus_dir_operations;
79 +extern const struct file_operations hfsplus_dir_operations;
81 static struct inode_operations hfsplus_file_inode_operations = {
82 .lookup = hfsplus_file_lookup,
83 diff -rduNp linux-2.6.20.4.orig/fs/hugetlbfs/inode.c linux-2.6.20.4/fs/hugetlbfs/inode.c
84 --- linux-2.6.20.4.orig/fs/hugetlbfs/inode.c 2007-03-13 19:27:08.000000000 +0100
85 +++ linux-2.6.20.4/fs/hugetlbfs/inode.c 2007-03-24 20:14:10.000000000 +0100
86 @@ -45,6 +45,7 @@ static struct backing_dev_info hugetlbfs
89 int sysctl_hugetlb_shm_group;
90 +__internal_export(sysctl_hugetlb_shm_group);
92 static void huge_pagevec_release(struct pagevec *pvec)
94 @@ -562,6 +563,7 @@ const struct file_operations hugetlbfs_f
95 .fsync = simple_sync_file,
96 .get_unmapped_area = hugetlb_get_unmapped_area,
98 +__internal_export(hugetlbfs_file_operations);
100 static struct inode_operations hugetlbfs_dir_inode_operations = {
101 .create = hugetlbfs_create,
102 @@ -701,6 +703,7 @@ int hugetlb_get_quota(struct address_spa
104 return ret;
106 +__internal_export(hugetlb_get_quota);
108 void hugetlb_put_quota(struct address_space *mapping)
110 @@ -712,6 +715,7 @@ void hugetlb_put_quota(struct address_sp
111 spin_unlock(&sbinfo->stat_lock);
114 +__internal_export(hugetlb_put_quota);
116 static int hugetlbfs_get_sb(struct file_system_type *fs_type,
117 int flags, const char *dev_name, void *data, struct vfsmount *mnt)
118 @@ -794,6 +798,7 @@ out_shm_unlock:
119 user_shm_unlock(size, current->user);
120 return ERR_PTR(error);
122 +__internal_export(hugetlb_zero_setup);
124 static int __init init_hugetlbfs_fs(void)
126 diff -rduNp linux-2.6.20.4.orig/fs/proc/base.c linux-2.6.20.4/fs/proc/base.c
127 --- linux-2.6.20.4.orig/fs/proc/base.c 2007-03-13 19:27:08.000000000 +0100
128 +++ linux-2.6.20.4/fs/proc/base.c 2007-03-24 20:18:09.000000000 +0100
129 @@ -71,6 +71,7 @@
130 #include <linux/cpuset.h>
131 #include <linux/audit.h>
132 #include <linux/poll.h>
133 +#include <linux/module.h>
134 #include <linux/nsproxy.h>
135 #include <linux/oom.h>
136 #include "internal.h"
137 @@ -2030,6 +2031,7 @@ struct dentry *proc_pid_lookup(struct in
138 out:
139 return result;
141 +__internal_export(proc_flush_task);
144 * Find the first task with tgid >= tgid
145 diff -rduNp linux-2.6.20.4.orig/fs/proc/generic.c linux-2.6.20.4/fs/proc/generic.c
146 --- linux-2.6.20.4.orig/fs/proc/generic.c 2007-03-13 19:27:08.000000000 +0100
147 +++ linux-2.6.20.4/fs/proc/generic.c 2007-03-24 20:14:10.000000000 +0100
148 @@ -20,8 +20,8 @@
149 #include <linux/namei.h>
150 #include <linux/bitops.h>
151 #include <linux/spinlock.h>
152 +#include <linux/module.h>
153 #include <asm/uaccess.h>
155 #include "internal.h"
157 static ssize_t proc_file_read(struct file *file, char __user *buf,
158 @@ -38,6 +38,7 @@ int proc_match(int len, const char *name
159 return 0;
160 return !memcmp(name, de->name, len);
162 +__internal_export(proc_match);
164 static struct file_operations proc_file_operations = {
165 .llseek = proc_file_lseek,
166 diff -rduNp linux-2.6.20.4.orig/fs/proc/kcore.c linux-2.6.20.4/fs/proc/kcore.c
167 --- linux-2.6.20.4.orig/fs/proc/kcore.c 2007-03-13 19:27:08.000000000 +0100
168 +++ linux-2.6.20.4/fs/proc/kcore.c 2007-03-24 20:14:10.000000000 +0100
169 @@ -19,6 +19,7 @@
170 #include <linux/vmalloc.h>
171 #include <linux/highmem.h>
172 #include <linux/init.h>
173 +#include <linux/module.h>
174 #include <asm/uaccess.h>
175 #include <asm/io.h>
177 @@ -66,6 +67,7 @@ kclist_add(struct kcore_list *new, void
178 kclist = new;
179 write_unlock(&kclist_lock);
181 +__internal_export(kclist_add);
183 static size_t get_kcore_size(int *nphdr, size_t *elf_buflen)
185 diff -rduNp linux-2.6.20.4.orig/fs/proc/proc_tty.c linux-2.6.20.4/fs/proc/proc_tty.c
186 --- linux-2.6.20.4.orig/fs/proc/proc_tty.c 2007-03-13 19:27:08.000000000 +0100
187 +++ linux-2.6.20.4/fs/proc/proc_tty.c 2007-03-24 20:14:10.000000000 +0100
188 @@ -201,6 +201,7 @@ void proc_tty_register_driver(struct tty
190 driver->proc_entry = ent;
192 +__internal_export(proc_tty_register_driver);
195 * This function is called by tty_unregister_driver()
196 @@ -217,6 +218,7 @@ void proc_tty_unregister_driver(struct t
198 driver->proc_entry = NULL;
200 +__internal_export(proc_tty_unregister_driver);
203 * Called by proc_root_init() to initialize the /proc/tty subtree
204 diff -rduNp linux-2.6.20.4.orig/fs/proc/root.c linux-2.6.20.4/fs/proc/root.c
205 --- linux-2.6.20.4.orig/fs/proc/root.c 2007-03-13 19:27:08.000000000 +0100
206 +++ linux-2.6.20.4/fs/proc/root.c 2007-03-24 20:14:10.000000000 +0100
207 @@ -21,7 +21,9 @@
209 #include "internal.h"
211 -struct proc_dir_entry *proc_net, *proc_net_stat, *proc_bus, *proc_root_fs, *proc_root_driver;
212 +struct proc_dir_entry *proc_net;
214 +struct proc_dir_entry *proc_net_stat, *proc_bus, *proc_root_fs, *proc_root_driver;
216 #ifdef CONFIG_SYSCTL
217 struct proc_dir_entry *proc_sys_root;
218 @@ -91,6 +93,7 @@ void __init proc_root_init(void)
219 #endif
220 proc_bus = proc_mkdir("bus", NULL);
222 +__internal_export(proc_root_init);
224 static int proc_root_getattr(struct vfsmount *mnt, struct dentry *dentry, struct kstat *stat
226 @@ -163,6 +166,7 @@ struct proc_dir_entry proc_root = {
227 .parent = &proc_root,
230 +__internal_export(proc_sys_root);
231 EXPORT_SYMBOL(proc_symlink);
232 EXPORT_SYMBOL(proc_mkdir);
233 EXPORT_SYMBOL(create_proc_entry);
234 diff -rduNp linux-2.6.20.4.orig/fs/ramfs/inode.c linux-2.6.20.4/fs/ramfs/inode.c
235 --- linux-2.6.20.4.orig/fs/ramfs/inode.c 2007-03-13 19:27:08.000000000 +0100
236 +++ linux-2.6.20.4/fs/ramfs/inode.c 2007-03-24 20:14:10.000000000 +0100
237 @@ -225,5 +225,6 @@ int __init init_rootfs(void)
239 return register_filesystem(&rootfs_fs_type);
241 +__internal_export(init_rootfs);
243 MODULE_LICENSE("GPL");
244 diff -rduNp linux-2.6.20.4.orig/fs/reiserfs/dir.c linux-2.6.20.4/fs/reiserfs/dir.c
245 --- linux-2.6.20.4.orig/fs/reiserfs/dir.c 2007-03-13 19:27:08.000000000 +0100
246 +++ linux-2.6.20.4/fs/reiserfs/dir.c 2007-03-24 20:14:10.000000000 +0100
247 @@ -11,7 +11,7 @@
248 #include <linux/buffer_head.h>
249 #include <asm/uaccess.h>
251 -extern struct reiserfs_key MIN_KEY;
252 +extern const struct reiserfs_key MIN_KEY;
254 static int reiserfs_readdir(struct file *, void *, filldir_t);
255 static int reiserfs_dir_fsync(struct file *filp, struct dentry *dentry,
256 diff -rduNp linux-2.6.20.4.orig/include/linux/module.h linux-2.6.20.4/include/linux/module.h
257 --- linux-2.6.20.4.orig/include/linux/module.h 2007-03-13 19:27:08.000000000 +0100
258 +++ linux-2.6.20.4/include/linux/module.h 2007-03-24 20:14:10.000000000 +0100
259 @@ -20,6 +20,15 @@
261 #include <asm/module.h>
264 +#ifdef CONFIG_COMBINED_COMPILE
265 +#define __externally_visible__ __attribute__((externally_visible,used))
266 +#define __internal_export(sym) extern typeof(sym) sym __externally_visible__
267 +#else
268 +#define __externally_visible__
269 +#define __internal_export(sym)
270 +#endif
272 /* Not Yet Implemented */
273 #define MODULE_SUPPORTED_DEVICE(name)
275 @@ -188,7 +197,7 @@ void *__symbol_get_gpl(const char *symbo
277 /* For every exported symbol, place a struct in the __ksymtab section */
278 #define __EXPORT_SYMBOL(sym, sec) \
279 - extern typeof(sym) sym; \
280 + extern typeof(sym) sym __externally_visible__; \
281 __CRC_SYMBOL(sym, sec) \
282 static const char __kstrtab_##sym[] \
283 __attribute__((section("__ksymtab_strings"))) \
284 @@ -212,8 +221,8 @@ void *__symbol_get_gpl(const char *symbo
285 #define EXPORT_UNUSED_SYMBOL(sym) __EXPORT_SYMBOL(sym, "_unused")
286 #define EXPORT_UNUSED_SYMBOL_GPL(sym) __EXPORT_SYMBOL(sym, "_unused_gpl")
287 #else
288 -#define EXPORT_UNUSED_SYMBOL(sym)
289 -#define EXPORT_UNUSED_SYMBOL_GPL(sym)
290 +#define EXPORT_UNUSED_SYMBOL(sym) __internal_export(sym)
291 +#define EXPORT_UNUSED_SYMBOL_GPL(sym) __internal_export(sym)
292 #endif
294 #endif
295 @@ -471,11 +480,12 @@ void module_add_driver(struct module *,
296 void module_remove_driver(struct device_driver *);
298 #else /* !CONFIG_MODULES... */
299 -#define EXPORT_SYMBOL(sym)
300 -#define EXPORT_SYMBOL_GPL(sym)
301 -#define EXPORT_SYMBOL_GPL_FUTURE(sym)
302 -#define EXPORT_UNUSED_SYMBOL(sym)
303 -#define EXPORT_UNUSED_SYMBOL_GPL(sym)
305 +#define EXPORT_SYMBOL(sym) __internal_export(sym)
306 +#define EXPORT_SYMBOL_GPL(sym) __internal_export(sym)
307 +#define EXPORT_SYMBOL_GPL_FUTURE(sym) __internal_export(sym)
308 +#define EXPORT_UNUSED_SYMBOL(sym) __internal_export(sym)
309 +#define EXPORT_UNUSED_SYMBOL_GPL(sym) __internal_export(sym)
311 /* Given an address, look for it in the exception tables. */
312 static inline const struct exception_table_entry *
313 diff -rduNp linux-2.6.20.4.orig/init/do_mounts.c linux-2.6.20.4/init/do_mounts.c
314 --- linux-2.6.20.4.orig/init/do_mounts.c 2007-03-13 19:27:08.000000000 +0100
315 +++ linux-2.6.20.4/init/do_mounts.c 2007-03-24 20:14:10.000000000 +0100
316 @@ -26,6 +26,10 @@ static char __initdata saved_root_name[6
318 dev_t ROOT_DEV;
320 +__internal_export(root_mountflags);
321 +__internal_export(rd_doload);
322 +__internal_export(ROOT_DEV);
324 static int __init load_ramdisk(char *str)
326 rd_doload = simple_strtol(str,NULL,0) & 3;
327 @@ -205,6 +209,7 @@ fail:
328 res = 0;
329 goto done;
331 +__internal_export(name_to_dev_t);
333 static int __init root_dev_setup(char *line)
335 @@ -446,4 +451,4 @@ out:
336 sys_chroot(".");
337 security_sb_post_mountroot();
340 +__internal_export(prepare_namespace);
341 diff -rduNp linux-2.6.20.4.orig/init/do_mounts_initrd.c linux-2.6.20.4/init/do_mounts_initrd.c
342 --- linux-2.6.20.4.orig/init/do_mounts_initrd.c 2007-03-13 19:27:08.000000000 +0100
343 +++ linux-2.6.20.4/init/do_mounts_initrd.c 2007-03-24 20:18:32.000000000 +0100
344 @@ -6,6 +6,7 @@
345 #include <linux/romfs_fs.h>
346 #include <linux/initrd.h>
347 #include <linux/sched.h>
348 +#include <linux/module.h>
349 #include <linux/freezer.h>
351 #include "do_mounts.h"
352 @@ -16,6 +17,11 @@ unsigned int real_root_dev; /* do_proc_d
353 static int __initdata old_fd, root_fd;
354 static int __initdata mount_initrd = 1;
356 +__internal_export(initrd_start);
357 +__internal_export(initrd_end);
358 +__internal_export(initrd_below_start_ok);
359 +__internal_export(real_root_dev);
361 static int __init no_initrd(char *str)
363 mount_initrd = 0;
364 diff -rduNp linux-2.6.20.4.orig/init/do_mounts_rd.c linux-2.6.20.4/init/do_mounts_rd.c
365 --- linux-2.6.20.4.orig/init/do_mounts_rd.c 2007-03-13 19:27:08.000000000 +0100
366 +++ linux-2.6.20.4/init/do_mounts_rd.c 2007-03-24 20:14:10.000000000 +0100
367 @@ -7,12 +7,14 @@
368 #include <linux/cramfs_fs.h>
369 #include <linux/initrd.h>
370 #include <linux/string.h>
371 +#include <linux/module.h>
373 #include "do_mounts.h"
375 #define BUILD_CRAMDISK
377 int __initdata rd_prompt = 1;/* 1 = prompt for RAM disk, 0 = don't prompt */
378 +__internal_export(rd_prompt);
380 static int __init prompt_ramdisk(char *str)
382 @@ -22,6 +24,7 @@ static int __init prompt_ramdisk(char *s
383 __setup("prompt_ramdisk=", prompt_ramdisk);
385 int __initdata rd_image_start; /* starting block # of image */
386 +__internal_export(rd_image_start);
388 static int __init ramdisk_start_setup(char *str)
390 diff -rduNp linux-2.6.20.4.orig/init/Kconfig linux-2.6.20.4/init/Kconfig
391 --- linux-2.6.20.4.orig/init/Kconfig 2007-03-13 19:27:08.000000000 +0100
392 +++ linux-2.6.20.4/init/Kconfig 2007-03-24 20:14:10.000000000 +0100
393 @@ -526,6 +526,11 @@ config MODULE_FORCE_UNLOAD
394 rmmod). This is mainly for kernel developers and desperate users.
395 If unsure, say N.
397 +config COMBINED_COMPILE
398 + bool "Use combined compilation (gcc --combine)"
399 + help
400 + fish
402 config MODVERSIONS
403 bool "Module versioning support"
404 depends on MODULES
405 diff -rduNp linux-2.6.20.4.orig/net/netfilter/core.c linux-2.6.20.4/net/netfilter/core.c
406 --- linux-2.6.20.4.orig/net/netfilter/core.c 2007-03-13 19:27:08.000000000 +0100
407 +++ linux-2.6.20.4/net/netfilter/core.c 2007-03-24 20:14:10.000000000 +0100
408 @@ -279,3 +279,5 @@ void __init netfilter_init(void)
409 if (netfilter_log_init() < 0)
410 panic("cannot initialize nf_log");
412 +__internal_export(netfilter_init);
414 diff -rduNp linux-2.6.20.4.orig/scripts/Makefile.build linux-2.6.20.4/scripts/Makefile.build
415 --- linux-2.6.20.4.orig/scripts/Makefile.build 2007-03-13 19:27:08.000000000 +0100
416 +++ linux-2.6.20.4/scripts/Makefile.build 2007-03-24 20:14:10.000000000 +0100
417 @@ -128,6 +128,11 @@ $(multi-objs-y:.o=.i) : modname = $(mo
418 $(multi-objs-y:.o=.s) : modname = $(modname-multi)
419 $(multi-objs-y:.o=.lst) : modname = $(modname-multi)
421 +ifdef CONFIG_COMBINED_COMPILE
422 +$(multi-used-m) : CFLAGS += -fwhole-program --combine $(sort $(addprefix $(srctree)/$(obj)/,$($(subst $(obj)/,,$(@:.o=-y)):.o=.c) $($(subst $(obj)/,,$(@:.o=-objs)):.o=.c)))
423 +$(multi-used-y) : CFLAGS += -fwhole-program --combine $(sort $(addprefix $(srctree)/$(obj)/,$($(subst $(obj)/,,$(@:.o=-y)):.o=.c) $($(subst $(obj)/,,$(@:.o=-objs)):.o=.c)))
424 +endif
426 quiet_cmd_cc_s_c = CC $(quiet_modtag) $@
427 cmd_cc_s_c = $(CC) $(c_flags) -fverbose-asm -S -o $@ $<
429 @@ -284,6 +289,22 @@ $(lib-target): $(lib-y) FORCE
430 targets += $(lib-target)
431 endif
433 +ifdef CONFIG_COMBINED_COMPILE
434 +# We would rather have a list of rules like
435 +# foo.o: $(foo-objs)
436 +# but that's not so easy, so we rather make all composite objects depend
437 +# on the set of all their parts
439 +$(multi-used-y) : %.o: $(srctree)/dummy.c $(multi-objs-y:.o=.c) FORCE
440 + $(call cmd,force_checksrc)
441 + $(call if_changed_rule,cc_o_c)
443 +$(multi-used-m) : %.o: $(srctree)/dummy.c $(multi-objs-m:.o=.c) FORCE
444 + $(call cmd,force_checksrc)
445 + $(call if_changed_rule,cc_o_c)
447 +targets += $(multi-used-y) $(multi-used-m)
448 +else
450 # Rule to link composite objects
452 @@ -314,7 +335,7 @@ $(multi-used-m) : %.o: $(multi-objs-m) F
453 @{ echo $(@:.o=.ko); echo $(link_multi_deps); } > $(MODVERDIR)/$(@F:.o=.mod)
455 targets += $(multi-used-y) $(multi-used-m)
457 +endif
459 # Descending
460 # ---------------------------------------------------------------------------