uml: sparse inlines gcc-4.{2,3} compilation hack

From: Sergei Trofimovich
Date: Fri Jul 11 2008 - 09:47:45 EST


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

Signed-off-by: Sergei Trofimovich <slyfox@xxxxxxxx>

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(-)

diff --git a/fs/block_dev.c b/fs/block_dev.c
index 10d8a0a..9248ae0 100644
--- a/fs/block_dev.c
+++ b/fs/block_dev.c
@@ -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;
}
diff --git a/fs/buffer.c b/fs/buffer.c
index 0f51c0f..2a9a554 100644
--- a/fs/buffer.c
+++ b/fs/buffer.c
@@ -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;
diff --git a/mm/filemap.c b/mm/filemap.c
index 1e6a7d3..110b1bc 100644
--- a/mm/filemap.c
+++ b/mm/filemap.c
@@ -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;
diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index f32fae3..66b636e 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -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;

diff --git a/net/ipv4/ip_output.c b/net/ipv4/ip_output.c
index e527628..9a74088 100644
--- a/net/ipv4/ip_output.c
+++ b/net/ipv4/ip_output.c
@@ -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);

Attachment: .config
Description: Binary data