This is the mail archive of the binutils@sources.redhat.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]
Other format: [Raw text]

Re: HELP with linker script!!!


Hello Nick,

Thanks for this informative reply. There is something I am wondering about using the gcc attributes to put variables or functions : how to control the section flags of these new sections?

I know I can use objcopy with the --set-section-flags to tweak section flags to my liking. I was wondering how gcc was settings these flags : for your '.cached_bss' section, it may have the NOBITS flag set but does gcc know that, for instance, the NOBITS flag will have to be set?

As for Pieter problem, the crt0.c will surely rely on special symbols like __heap_start or __stack_start (set by the linker script) to detect and set the start of heap and stack.
You are also encouraged to use the MEMORY keyword that Nick mentioned : it make things clearer. However, it may not suit you if you have sections that have dynamic addresses/sizes i.e computed from say, the previous section' size (you will then have to rely on the computation capabilities of the ld script).


Regards,

Vincent

Nick Clifton wrote:
[...]
your application then it is easy. Simply use the:

__attribute__((section(".cached_bss")))

feature of GCC to annotate all of those variables which you want to be placed into the cacheable RAM, and then make sure that your linker script assigns the .cached_bss to the cacheable RAM memory region. Easy! :-)

  MEMORY
  {
     cachableRAM : org = 0x100, len = 0x200
     uncacheRAM:   org = 0x3000, len = 0x40000
  }

  SECTIONS
  {
     [...other sections...]

     .cached_bss : { *(.cached_bss) } > cachableRAM;
     .bss : { *(.bss) } > uncacheRAM;

     [...other sections...]
  }

Cheers
  Nick

-- Reclaim Your Inbox! http://internal.vannes.wrsec.fr/twiki/bin/view/Utilities/MailThunderbird


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