[PATCH] make it possible to keep Config/Kbuild snippets in *.c files

Timo Teräs timo.teras at iki.fi
Fri May 14 20:54:45 UTC 2010


On 05/14/2010 09:34 PM, Denys Vlasenko wrote:
> 2010/5/14 Timo Teräs <timo.teras at iki.fi>:
>> On 05/14/2010 09:22 AM, Rob Landley wrote:
>>> On Sunday 09 May 2010 09:19:58 Denys Vlasenko wrote:
>>>> On Sunday 09 May 2010 07:31, Rob Landley wrote:
>>
>> While at it, we could get rid of include/applets.h too. One very nice
>> way would be to use linker section. You can use gcc __attribute__
>> section("sectionname") [1] to put the applet definitions to separate
>> memory area. It is after that possible to iterate over the structures
>> in that special section using __start_sectionname and __stop_sectionname
>> symbols which are autocreated [2]. This is also roughly how Linux kernel
>> initcalls work [3].
> 
> This will break ld --gc-sections.

I think ld handles --gc-sections properly if __start_sectionname symbol
is referenced. If not, using __attribute__((used)) should work.

 - Timo


More information about the busybox mailing list