This is the mail archive of the binutils@sourceware.org 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: Issue with combining section alignment and target memory region in ld linker script


This works! :-)


Thanks for the speedy reply and for the great idea!


Best regards,

Ronald De Keulenaer



Citeren Nick Clifton <nickc@redhat.com>:
Hi Ronald,

I've already tried the following alternative solutions:
1. changing ALIGN to BLOCK (causes the same errors)
2. .some_text : {
     . = ALIGN(0x4000);
     *a_first_object_file.o(.text)
     *a_first_object_file.o(.text.*)
     *a_second_object_file.o(.text)
     *a_second_object_file.o(.text.*)
   } > some_memory_region
This is a step in the right direction, because the first instruction in the some_text section will be aligned as I want. However, from objdump output, I still see the section itself starting at a non-aligned
   address.
3. insert an empty dummy section as such:
   .dummy : {} > some_memory_region
right before the .some_text section (in the ld linker script), in hopes that I can define .some_text as
   follows:
   .some_text ALIGN(0x4000) : {
     *a_first_object_file.o(.text)
     *a_first_object_file.o(.text.*)
     *a_second_object_file.o(.text)
     *a_second_object_file.o(.text.*)
   }
   , without having to define a target memory region, in other words.
This doesn't work either, as the section is aligned but not in the desired target memory region.

Have you tried combining options 2 and 3 ?  Ie something like this:

  .dummy     : { . = ALIGN(0x4000); } > some_memory_region
  .some_text : { [....]             } > some_memory_region

So you put the alignment into the dummy section before .some_text, forcing
it to start on an aligned boundary.

Cheers
  Nick

PS. I have not actually tried this idea out, but I think it might work.
If it does not, then if you can give me a small test case (because I am
too lazy to write my own), I will fiddle around and see if I can come up
with something that works.


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