This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Removing code dupe in libc (Was: A final solution...)
- To: Paul Derbyshire <pderbysh at usa dot net>
- Subject: Re: Removing code dupe in libc (Was: A final solution...)
- From: Zack Weinberg <zack at rabi dot columbia dot edu>
- Date: Sat, 13 Feb 1999 00:14:11 -0500
- cc: egcs at egcs dot cygnus dot com
On Sat, 13 Feb 1999 00:01:28 -0500, Paul Derbyshire wrote:
>At 09:02 PM 2/12/99 -0500, you wrote:
>>Or you can isolate the inline functions in their own header file, and
>>have a separate C file that just does
>>
>>#define inline /* nothing */
>>#include <linux/inlinefuns.h>
>>
>>No code duplication, and if all the inlines went through, the linker
>>will throw away the unnecessary object module.
>
>That same technique might be usable to remove the code duplication wart
>with libc. The object module generated goes in libc.a; the linker will
>ignore it if all the functions used inlined.
>For dynamic linked implementations, the object module goes in libc.so and
>the dynamic linker will ignore it.
Actually, there isn't code duplication in libc. The inline functions
in the headers are limited in what they'll do themselves, they fall
back to out-of-line calls for the general case. This is done with an
ungodly mess of macros, special-case-only functions, and compiler
extensions. We rely on cse to crush out the mess.
I do wish there was a cleaner way to do it. Replacing cpp with M4
wouldn't be a bad start...
zw