This is the mail archive of the binutils@sourceware.cygnus.com mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: How to stop --gc-sections nukeing all sections?


Ian Lance Taylor writes:
> They also the KEEP command to retain special sections, such as those
> holding initialization code for global constructors.

Aha! It's the old undocumented ld script command trick! Thanks Chief!

The only problem now is that the linker is _reversing the order_ of all the
functions (each in its own .text.* section, thanks to -ffunction-sections)
from the order in my .c file when it writes them to the output!

For example, arch/ppc/kernel/process.c has functions in the order:

    kernel_stack_top
    task_top
    dump_fpu
    enable_kernel_fp
    etc

But in the output map, they're in the order:

    etc
    c00077a8 T enable_kernel_fp
    c00077d0 T dump_fpu
    c0007820 T task_top
    c0007828 T kernel_stack_top

Would any binutils gurus care to speculate on what could cause the linker to
swap the order of functions like this?  I'm so close... and yet so far...

Thanks,
Graham

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]