This is the mail archive of the binutils@sources.redhat.com mailing list for the binutils 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: Need Help on Symbol/Variable Name Problem


thanks to everyone who responded and provided suggestions.

Unfortunately, none provided exactly what I wanted.
I would either get an undefined symbol error during
link time or each symbol would be assigned different
memory locations.

However, your suggestions did provide some more ideas
for me to experiment with.  I found one that gave me
what I needed.  See below.

.data
	.type Testcode,@object
	.size Testcode,4
Testcode:
testcode:  .int 0
	.global testcode
	.global Testcode

I wanted Testcode (GNU Pascal global variable
name declared as VAR TESTCode:Cardinal) and
testcode (C global variable name declared as
extern int testcode) to be assigned to the
same memory location. The above code did the
trick. The code is in a separate .s file and
assembled separately.

Regards,

Jing Gloria
Texas Instruments
Sherman, Texas

--- Ian Lance Taylor <ian@airs.com> wrote:
> Jing Gloria <jing106@rocketmail.com> writes:
> 
> > Is there a way to write an assembly code so that two different symbols
> > (actually global variable names) get resolved to the same memory location?
> 
> Sure.  Just do something like
>     .global ALIAS
>     ALIAS = SYMBOL
> 
> In C, wrap this in an asm statement.
> 
> Ian


__________________________________________________
Do You Yahoo!?
Send FREE Valentine eCards with Yahoo! Greetings!
http://greetings.yahoo.com


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