This is the mail archive of the
mailing list for the binutils project.
Re: Create section on linker script
- From: Erik Christiansen <dvalin at internode dot on dot net>
- To: binutils at sourceware dot org
- Date: Mon, 13 Jan 2014 22:43:21 +1100
- Subject: Re: Create section on linker script
- Authentication-results: sourceware.org; auth=none
- References: <CAAGhXnqr+whzV214QRR_3i1MFMEO4vDyYau9wqhogOHmnWqZmw at mail dot gmail dot com> <CAAGhXnrwN=YHuqbGQ0utS4wZo97uP92PmOAQJRoas=hoFkw4eA at mail dot gmail dot com>
- Reply-to: dvalin at internode dot on dot net
On 13.01.14 11:09, JoÃo Pires wrote:
> Hi, I'm interested in create sections during the link phase.
> These sections will have no data and will have two symbols.
> At the moment I have the follow code.
> .foo :
> foo_begin = ORIGIN(.foo);
> foo_end = ORIGIN(.foo) + SIZEOF(.foo);
> This code creates the two symbols, but don't create the section .foo
> My question is there are any way to do this?
The easiest way is to put something in it, so there is something to
create, I figure.
Incidentally, the above example generates:
warning: memory region `.foo' not declared
because ORIGIN refers to a memory region, not a section.
So s/ORIGIN/ADDR on both script lines to fix that.
However, since .foo is defined to always be empty, both symbols must be
the same, raising the question; what is it that you'd like "created",
If the "creation" were to involve populating the section with one or
more of those variables, e.g.:
foo_begin = ADDR(.foo);
foo_end = ADDR(.foo) + SIZEOF(.foo);
} > text
then the section pops into existence as expected:
2 .foo 00000004 00007ce4 00007ce4 00007d98 2**0
CONTENTS, ALLOC, LOAD, DATA
0x00007ce4 0x4 LONG 0x7ce4 foo_begin
If what you'd like "created" is something else, then a bit more
information would help.
It's always sad when the fleas leave, because that means your dog is dead.
- Wesley T. Williams