Well, in this example var2 will not be allocated at all.
So, once allocated var1 will do all the job.
This will work !
(at least it works in libc:)
Obviously you can define your own section and put vars there.
define a section like '.bss' :
.section .mysection, "aw", @nobits
or
type __attribute__ ((section (".mysection, "aw", @nobits;"))) a,b,c;
then pass the section address to the linker.
~d
On Saturday 15 February 2003 21:02, Oleg Skydan wrote:
> Hi, Dmitry,
>
> > use alias for variable:
> >
> > long var1;
> > long var2 asm("var1");
> >
> > Actually it doe not matter if var1 and var2 will have different sizes.
>
> It does matter. The RAM space will be allocated for var1.
> So it will not work if sizeof(var2)>sizeof(var1), right ?
>
> > P.S. if you're using variables within some 'area' declare them as local
> > :)
>
> Usually I do so, but in this case it is a large project and different tasks
> should have access for particular variable, so it should be global :(.
>
> Any other ideas ?
> May be the custom linker script would be helpful ?
>
> Thanks,
> Oleg.
>
>
>
>
> -------------------------------------------------------
> This sf.net email is sponsored by:ThinkGeek
> Welcome to geek heaven.
> http://thinkgeek.com/sf
> _______________________________________________
> Mspgcc-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/mspgcc-users
--
*********************************************************************
("`-''-/").___..--''"`-._ (\ Dimmy the Wild UA1ACZ
`6_ 6 ) `-. ( ).`-.__.`) Enterprise Information Sys
(_Y_.)' ._ ) `._ `. ``-..-' Nevsky prospekt, 20 / 44
_..`--'_..-_/ /--'_.' ,' Saint Petersburg, Russia
(il),-'' (li),' ((!.-' +7 (812) 314-8860, 5585314
*********************************************************************