Skip to contentSkip to conversation

work around gcc-3.x inlining bugs

PATCH In review Andrew Morton 3 participants 3 messages Mar 6, 2003 Sparse checker

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 work around gcc-3.x inlining bugs

This patch:

include/linux/compiler.h renamed from include/linux/compiler.h~gcc3-inline-fix +5 -0
@@ -1,6 +1,11 @@
 #ifndef __LINUX_COMPILER_H
 #define __LINUX_COMPILER_H
 
+#if __GNUC__ >= 3
+#define inline __inline__ __attribute__((always_inline))
+#define __inline__ __inline__ __attribute__((always_inline))
+#endif
+
 /* Somewhere in the middle of the GCC 2.96 development cycle, we implemented
    a mechanism by which the user can annotate likely branch directions and
    expect the blocks to be reordered appropriately.  Define __builtin_expect

shrinks my 3.2.1-compiled kernel text by about 64 kbytes:

text data bss dec hex filename

3316138  574844  726816 4617798  467646 vmlinux-before
3249255  555436  727204 4531895  4526b7 vmlinux-after

mnm:/tmp> nm vmlinux-before|grep __constant_c_and_count_memset | wc

    233     699    9553
mnm:/tmp> nm vmlinux-after|grep __constant_c_and_count_memset | wc
     13      39     533

Can anyone see a problem with it?

#1 lore raw

include/linux/compiler.h line 7

Quoted 12 lines · Andrew Morton

This patch:

include/linux/compiler.h renamed from include/linux/compiler.h~gcc3-inline-fix +4 -0
@@ -1,6 +1,11 @@
 #ifndef __LINUX_COMPILER_H
 #define __LINUX_COMPILER_H
 
+#if __GNUC__ >= 3
+#define inline __inline__ __attribute__((always_inline))
+#define __inline__ __inline__ __attribute__((always_inline))
+#endif

I think there is also either __inline or inline__?

#2 lore raw
In reply to Andrew Morton

Am Don, 2003-03-06 um 12.22 schrieb Andrew Morton:

Quoted 6 lines

shrinks my 3.2.1-compiled kernel text by about 64 kbytes:

text data bss dec hex filename

3316138  574844  726816 4617798  467646 vmlinux-before
3249255  555436  727204 4531895  4526b7 vmlinux-after
Quoted 6 lines

mnm:/tmp> nm vmlinux-before|grep __constant_c_and_count_memset | wc

    233     699    9553
mnm:/tmp> nm vmlinux-after|grep __constant_c_and_count_memset | wc
     13      39     533

Can anyone see a problem with it?

Looks good to me...

text data bss dec hex filename

1842635  167450  140292 2150377  20cfe9 vmlinux
1867787  167450  140292 2175529  213229 vmlinux.old

I hope this doesn't trigger any latent compiler bugs but in this case we should beat the gcc people to it...

Signature · 2 lines
Servus,
       Daniel