Linker script
Daniel Lidsten
Daniel.Lidsten@combitechsystems.com
Thu Jun 26 08:55:00 GMT 2003
> >
> > I have a special problem that has to do with the linker
> script. In my
> > application i want to add a CRC value to the binary image so that i
> > can check the code segment for errors during runtime. I
> cannot put the
> > CRC over the entire image since some segment are changing during
> > execution so instead i want to calculate it based on the
> text segment
> > only. However, the segment is of different size each time i
> link which
> > means that i have to communicate the size to the CRC calcualtion
> > routine. I think that it should be done in the linker script by
> > something like
> > this:
> >
> > .text 0x5000 : { _stext = .; *(.text*) *(.gnu.warning)
> > *(.gnu.linkonce*) *(.init) } > ram _etext = .; PROVIDE
> >
> > The text segment specifies where the end is in the variable _etext.
> >
> > I need the above value to be place on a fixed location by something
> > like
> > this:
> >
> > .TextEnd 0x004DFFFC : { etext }
> >
> > The above dones work but can any see a way for this to work?
>
> The address of _etext should be a global symbol that you can
> access directly in your 'C' program. You need to add a definition like
>
> extern char _etext
>
> And then you can take the address of it
>
> I.e.
>
> ptEndOfText = &e_test;
>
I think you misunderstod my problem here. It is not a c program that
shall access this variable, i want the value of etext to be place on a
fixed adress of the binary image. This is because a let another program
interpret the binary image and calcualte a checksum on it i.e i need to
know the value of etext data without running the program.
Regards, Daniel Lidsten
------
Want more information? See the CrossGCC FAQ, http://www.objsw.com/CrossGCC/
Want to unsubscribe? Send a note to crossgcc-unsubscribe@sources.redhat.com
More information about the crossgcc
mailing list