[arm-gnu] holy sections, batman!
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[arm-gnu] holy sections, batman!



Good afternoon,

I was speaking with a colleague about linker scripts and he was surprised at 
the number of sections I have to include.  My linker script looks a little 
like this:

SECTIONS {
        . = 0;

        startup : { KEEP(*(.startup)) } >flash

        prog : {
                *(.init)
                *(.fini)
                *(.eh_frame)
                *(.init_array)
                *(.fini_array)
                *(.jcr)
                *(.text)
	        *(.text.*)
                *(.rodata)
                *(.rodata*)
                *(.glue_7)
                *(.glue_7t)
        } >flash

        __end_of_text__ = .;

        .data : {
                __data_beg__ = .;
                __data_beg_src__ = __end_of_text__;
                *(.data)
	        *(.data.*)
                __data_end__ = .;
        } >ram AT>flash

        .bss : {
                __bss_beg__ = .;
                *(.bss)
        *(.bss.*)
        } >ram

	. = ALIGN(32/8);
}

My code is pretty straightforward, it does not use any built-in functions (I 
compile with "-std=gnu99 -fno-builtin -nostdlib -mcpu=arm7tdmi -mthumb -
mthumb-interwork").

What are all of these sections for?  The .text, .data and .bss sections I can 
certainly understand.  How can I figure out what is using functions that 
require the .init/fini stuff? What are .jcr, .eh_frame and .glue_7/7t for?

As I mentioned, my linker script is working fine, but I'm trying to understand 
where some of these sections are coming from and if I can perhaps do something 
to help reduce the code footprint (-Os works *wonders*, but looking for other 
hints/tips.)

-A.