This is the mail archive of the ecos-discuss@sourceware.org mailing list for the eCos 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: Specific location for kernel_mutex.o : linker file issue. Need help !


Hi Andrew, Guillaume.

Don't know if this helps but linker scripts can be used to direct the linker 
to place text from a particular object file in a particular order within a 
section.

Here's a simplistic script which would place the text [code] components of a 
start.o object at the start of the .text section:


SECTIONS
{
  .text : {
        start.o
        *(.text)
   }

  .data : { *(.data) }
  __bss_start = .;
  .bss : { *(.bss) }
  __bss_end = .;
}

Maybe Guillaume could get away with adding the object files of interest into a 
separate section which could be located in the 16k iram without any code 
changes, only linker script changes ?

Cheers,
Robin

On Wednesday 17 May 2006 15:49, Andrew Lunn wrote:
> On Wed, May 17, 2006 at 11:00:53AM +0200, Guillaume Aymard wrote:
> > This is not really the same issue, as I want to locate eCos's code
> > globally whithout knowing individally
> > which functions to locate in my iram region. And I don't want to edit
> > kernel's code with __attributes__ directives before each
> > functions. I'm not even sure it will work for a function. It will be more
> > convenient for me to only modify the linker script. My aim is to
> > make several tests by filling my 16k fast ram chunk with different
> > kernel's component and measure the benefit.
> > I think it is possible to do this only using linker scripts. The problem
> > is that the linker seems unable to extract an object file from the
> > archive to locate its .text sections in a specific location, although it
> > can do this with an object file which is not in an archive. I don't see
> > why it can't. Are there linking limitations as soon as an object file is
> > archived in a library ?
>
> I don't think the linker works with object files. It works with
> sections.  Each function is in its own section and you need to specify
> the name of the section.
>
> ~/eCos/work/kernel/current/src/sync$ arm-elf-objdump --headers
> kernel_mutex.o
>
> kernel_mutex.o:     file format elf32-littlearm
>
> Sections:
> Idx Name          Size      VMA       LMA       File off  Algn
>   0 .text         00000000  00000000  00000000  00000034  2**0
>                   CONTENTS, ALLOC, LOAD, READONLY, CODE
>   1 .data         00000000  00000000  00000000  00000034  2**0
>                   CONTENTS, ALLOC, LOAD, DATA
>   2 .bss          00000000  00000000  00000000  00000034  2**0
>                   ALLOC
>   3 .debug_abbrev 00000552  00000000  00000000  00000034  2**0
>                   CONTENTS, READONLY, DEBUGGING
>   4 .debug_info   00003af6  00000000  00000000  00000586  2**0
>                   CONTENTS, RELOC, READONLY, DEBUGGING
>   5 .debug_line   00001096  00000000  00000000  0000407c  2**0
>                   CONTENTS, RELOC, READONLY, DEBUGGING
>   6 .text._ZN9Cyg_MutexC2Ev 0000004c  00000000  00000000  00005114  2**2
>                   CONTENTS, ALLOC, LOAD, RELOC, READONLY, CODE
>   7 .text._ZN9Cyg_MutexC1Ev 0000004c  00000000  00000000  00005160  2**2
>                   CONTENTS, ALLOC, LOAD, RELOC, READONLY, CODE
>   8 .text._ZN9Cyg_MutexC2ENS_11cyg_protcolE 0000005c  00000000  00000000 
> 000051 ac  2**2
>                   CONTENTS, ALLOC, LOAD, RELOC, READONLY, CODE
>   9 .text._ZN9Cyg_MutexC1ENS_11cyg_protcolE 0000005c  00000000  00000000 
> 000052 08  2**2
>                   CONTENTS, ALLOC, LOAD, RELOC, READONLY, CODE
>  10 .rodata._ZZN9Cyg_MutexD1EvE19__PRETTY_FUNCTION__ 00000018  00000000 
> 0000000 0  00005264  2**2
>                   CONTENTS, ALLOC, LOAD, READONLY, DATA
>  11 .rodata       000001e8  00000000  00000000  0000527c  2**2
>                   CONTENTS, ALLOC, LOAD, READONLY, DATA
>  12 .text._ZN9Cyg_MutexD2Ev 000000c8  00000000  00000000  00005464  2**2
>                   CONTENTS, ALLOC, LOAD, RELOC, READONLY, CODE
>  13 .text._ZN9Cyg_MutexD1Ev 000000c8  00000000  00000000  0000552c  2**2
>                   CONTENTS, ALLOC, LOAD, RELOC, READONLY, CODE
>  14 .text._ZNK9Cyg_Mutex10check_thisE21cyg_assert_class_zeal 000000cc 
> 00000000 00000000  000055f4  2**2
>
> So try specifiying .text._ZN9Cyg_MutexD1Ev, .text._ZN9Cyg_MutexD2Ev
> etc in your linker script.
>
>    Andrew

-- 
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss


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