Re: Figuring out start and end of sections

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

 



>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

Here's what we do for structures:

In the linker script:
        PROVIDE (__HWDEVICE_DESC_BEGIN = .);
        .struct_hw_dev_desc : {*(.struct_hw_dev_desc)} > ram
        PROVIDE (__HWDEVICE_DESC_END = .);

In the code:
#define STRUCT_HW_DEV_DESC __attribute__ ((section (".struct_hw_dev_desc")))

STRUCT_HW_DEV_DESC SINOSHwDeviceDesc { definition }

extern char* __HWDEVICE_DESC_BEGIN[];
extern char* __HWDEVICE_DESC_END[];

        SINOSHwDeviceDesc* desc = (SINOSHwDeviceDesc*) __HWDEVICE_DESC_BEGIN;
        desc++;

And then you can use these values for whatever you want
until you reach __HWDEVICE_DESC_END.

bye  Fabi


[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