uml: sparse inlines gcc-4.{2,3} compilation hack
Subsystems (7)
Hi!
Small ARCH=um SUBARCH=i386 .config is in attach. How to fix properly such kind of miscompilation? (gcc-4.3.1) Now I have to use hacks like this:
uml: sparse inlines gcc-4.{2,3} compilation fix.
Patch fixes stuff like this:
CC mm/filemap.o
/mnt/ext/backup3/dev/git/linux-2.6/mm/filemap.c: In function '__generic_file_aio_write_nolock':
/mnt/ext/backup3/dev/git/linux-2.6/mm/filemap.c:1838: sorry, unimplemented: inlining failed in call to 'generic_write_checks': function body not available /mnt/ext/backup3/dev/git/linux-2.6/mm/filemap.c:2390: sorry, unimplemented: called from here
make[2]: *** [mm/filemap.o] Error 1
make[1]: *** [mm] Error 2
fs/block_dev.c | 2 +- fs/buffer.c | 2 +- mm/filemap.c | 2 +- mm/page_alloc.c | 2 +- net/ipv4/ip_output.c | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-)
fs/block_dev.c +1 -1
@@ -39,7 +39,7 @@ static inline struct bdev_inode *BDEV_I(struct inode *inode) return container_of(inode, struct bdev_inode, vfs_inode); } -inline struct block_device *I_BDEV (struct inode *inode) +struct block_device *I_BDEV (struct inode *inode) {return &BDEV_I (inode)->bdev; }
fs/buffer.c +1 -1
@@ -46,7 +46,7 @@ static int fsync_buffers_list(spinlock_t *lock, struct list_head *list);#define BH_ENTRY (list) list_entry((list), struct buffer_head, b_assoc_buffers) -inline void +void init_buffer (struct buffer_head *bh,bh_end_io_t *handler,void *private) { bh->b_end_io = handler;
mm/filemap.c +1 -1
@@ -1834,7 +1834,7 @@ EXPORT_SYMBOL(iov_iter_single_seg_count);* Returns appropriate error code that caller should return or * zero in case that write should be allowed. */ -inline int generic_write_checks (struct file *file,loff_t *pos,size_t *count,int isblk) +int generic_write_checks (struct file *file,loff_t *pos,size_t *count,int isblk) {struct inode *inode = file->f_mapping->host;unsigned long limit = current->signal->rlim[RLIMIT_FSIZE ].rlim_cur;
mm/page_alloc.c +1 -1
@@ -2611,7 +2611,7 @@ static int zone_batchsize(struct zone *zone)return batch; } -inline void setup_pageset (struct per_cpu_pageset *p,unsigned long batch) +void setup_pageset (struct per_cpu_pageset *p,unsigned long batch) {struct per_cpu_pages *pcp;
net/ipv4/ip_output.c +1 -1
@@ -85,7 +85,7 @@int sysctl_ip_default_ttl__read_mostly =IPDEFTTL ;/* Generate a checksum for an outgoing IP datagram. */ -__inline__void ip_send_check (struct iphdr *iph) +void ip_send_check (struct iphdr *iph) { iph->check =0 ; iph->check =ip_fast_csum ((unsigned char *)iph, iph->ihl);
Quoted 3 lines · Sergei Trofimovich
Small ARCH=um SUBARCH=i386 .config is in attach. How to fix properly such kind of miscompilation? (gcc-4.3.1) Now I have to use hacks like this:
Use the patch below instead.
Jeff
Signature · 35 lines
Work email - jdike at linux dot intel dot com commit 4f81c5350b44bcc501ab6f8a089b16d064b4d2f6 Author: Jeff Dike <[email protected]> Date: Mon Jul 7 13:36:56 2008 -0400 [UML] fix gcc ICEs and unresolved externs There are various constraints on the use of unit-at-a-time: - i386 uses no-unit-at-a-time for pre-4.0 (not 4.3) - x86_64 uses unit-at-a-time always Uli reported a crash on x86_64 with gcc 4.1.2 with unit-at-a-time, resulting in commit c0a18111e571138747a98af18b3a2124df56a0d1 Ingo reported a gcc internal error with gcc 4.3 with no-unit-at-a-timem, resulting in 22eecde2f9034764a3fd095eecfa3adfb8ec9a98 Benny Halevy is seeing extern inlines not resolved with gcc 4.3 with no-unit-at-a-time This patch reintroduces unit-at-a-time for gcc >= 4.0, bringing back the possibility of Uli's crash. If that happens, we'll debug it. I started seeing both the internal compiler errors and unresolved inlines on Fedora 9. This patch fixes both problems, without so far reintroducing the crash reported by Uli. Signed-off-by: Jeff Dike <[email protected]> Cc: Benny Halevy <[email protected]> Cc: Adrian Bunk <[email protected]> Cc: Ingo Molnar <[email protected]> Cc: Ulrich Drepper <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
arch/um/Makefile +0 -1
@@ -77,7 +77,6 @@ include $(srctree)/$(ARCH_DIR)/Makefile-os-$(OS) KERNEL_DEFINES = $(strip -Derrno=kernel_errno -Dsigprocmask=kernel_sigprocmask \ -Dmktime=kernel_mktime $(ARCH_KERNEL_DEFINES)) KBUILD_CFLAGS += $(KERNEL_DEFINES) -KBUILD_CFLAGS += $(call cc-option,-fno-unit-at-a-time,) PHONY += linux
arch/um/Makefile-i386 +7 -0
@@ -32,4 +32,11 @@ cflags-y += $(call cc-option,-mpreferred-stack-boundary=2) # an unresolved reference. cflags-y += -ffreestanding +# Disable unit-at-a-time mode on pre-gcc-4.0 compilers, it makes gcc use +# a lot more stack due to the lack of sharing of stacklots. Also, gcc +# 4.3.0 needs -funit-at-a-time for extern inline functions. +KBUILD_CFLAGS += $(shell if [ $(call cc-version) -lt 0400 ] ; then \ + echo $(call cc-option,-fno-unit-at-a-time); \ + else echo $(call cc-option,-funit-at-a-time); fi ;) + KBUILD_CFLAGS += $(cflags-y)
arch/um/Makefile-x86_64 +3 -0
@@ -21,3 +21,6 @@ HEADER_ARCH := x86 LINK-$(CONFIG_LD_SCRIPT_DYN) += -Wl,-rpath,/lib64 LINK-y += -m64 + +# Do unit-at-a-time unconditionally on x86_64, following the host +KBUILD_CFLAGS += $(call cc-option,-funit-at-a-time)