This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: Issue with combining section alignment and target memory region in ld linker script
- From: Nick Clifton <nickc at redhat dot com>
- To: Ronald De Keulenaer <ronald dot dekeulenaer at elis dot ugent dot be>, binutils at sourceware dot org
- Date: Mon, 4 Jul 2016 13:54:01 +0100
- Subject: Re: Issue with combining section alignment and target memory region in ld linker script
- Authentication-results: sourceware.org; auth=none
- References: <20160704144052.Horde.lfaQXkisJlFXellUg6CVnFA@mail.elis.ugent.be>
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.