Re: Figuring out start and end of sections

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

On Wed, Apr 14, 2010 at 09:22:35AM +0300, Felipe Balbi wrote:
> #include <stdio.h>
> 
> typedef int (*initcall_t)(void);
> 
> static int my_init(void)
> {
> 	printf("hello world from _init\n");
> }
> static initcall_t __my_initcall_my_init
> 	__attribute__((__used__))
> 	__attribute__((section("_initcall"))) = my_init;
> 
> int main(int argc, char *argv[])
> {
> 	initcall_t	*fn;
> 
> 	for (fn = __start__initcall; fn <
> 			__stop__initcall; fn++)
> 		(void) fn();
> 
> 	return 0;
> }

I commented the for loop just to get the thing compiling and nm doesn't
show any __start_ symbols:

$ nm tst | grep init
080494cc d __init_array_end
080494cc d __init_array_start
08048400 T __libc_csu_init
080495d4 d __my_initcall_my_init
08048298 T _init
080483c4 t my_init

-- 
balbi

[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux