lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Fri, 8 Jan 2010 16:29:30 -0800
From:	Andrew Morton <akpm@...ux-foundation.org>
To:	Andi Kleen <andi@...stfloor.org>
Cc:	linux-kernel@...r.kernel.org
Subject: Re: [PATCH] Allow linker to eliminate unused functions in lib/*

On Tue, 5 Jan 2010 15:59:18 +0100
Andi Kleen <andi@...stfloor.org> wrote:

> Allow linker to eliminate unused functions in lib/*
> 
> Right now a lot of code in lib/* is obj-y and always linked
> in. The reason is that there is no other way to ensure the EXPORT_SYMBOLs
> get included.
> 
> This patch moves the EXPORT_SYMBOLs into separate files instead. This
> way the files actually implementing the code can be made lib-y again,
> and the separate export symbols pull them in for modular kernels.
> 
> For non modular kernels the linker can decide whether to use them
> or not. 
> 
> This shrinks a allnoconfig+CONFIG_EMBEDDED=y+all options disabled
> kernel by about 1k on x86. Not much, but also not too shabby.
> 
> In some ways that's similar to the old ksyms.c files, but
> not as centralized.
> 
> I didn't do this for the functions in lib/* which already have 
> Kconfig symbol. Presumably that is usually only set on demand
> when they are actually needed (although I'm not sure it's true
> for all cases).
> 

Sneaky.

It's a bit sad to reduce the code cleanliness and maintainability in
this way, but 1k is 1k.

Removing the module.h include from the .c files will hopefully help
people realise that new exports shouldn't be added to the .c files.

> --- linux-2.6.33-rc2-ak.orig/lib/lib-syms.c
> +++ linux-2.6.33-rc2-ak/lib/lib-syms.c
> @@ -5,9 +5,13 @@
>   * On modular kernels it keeps a reference to all the lib files with
>   * exports so that they can be used by modules.  On non modular
>   * kernels it does nothing and the linker can decide whether a lib
> - * object file is needed or not.
> + * object file is needed or not. This way unneeded library functions
> + * can be eliminated.
>   */

The patch assumes a pre-existing lib-syms.c.  Confused.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ