public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* RE: Symbol Aliasing
@ 2003-11-25  6:54 Raghunath L- CTD, Chennai.
  0 siblings, 0 replies; 3+ messages in thread
From: Raghunath L- CTD, Chennai. @ 2003-11-25  6:54 UTC (permalink / raw)
  To: Erik Christiansen; +Cc: gcc-help

Hello Erik,

 Thanks for your reply.

 I would like to eloborate the description of my problem:

 I am working on a tool which reads each line of intel assembly and converts
into gas format.

 In Intel assembly, '.org' directive can move the location counter
backwards. 

 For example:

1 		.org 0x4
2 	symbol1:
3		.long 4
4
5		.org 0x8
6 	hello:
7		.word 2
8
9		.org 0x4
10 	symbol2:
11		.long symbol1

 The tool will read each line at a time and converts the same to the
corresponding gas format and 
  outputs it immediately. 

 Considering the above example,

 By the time it reaches line no. 9, it does not have any info of previous
.org occurances and hence
 it generates the corresponding .org directive in gas format. But this
creates the problem, bcoz we
 will be trying to move the location counter backwards, which is not allowed
in 'gas'.
 
 If I maintain list of symbols and their start memory locations, now when I
reach line no 9 and observe
 that a symbol has already been created at this address, then is it possible
for me now to create an
 alias with name 'symbol2' for the symbol created earlier 'symbol1'.

 Pls help me in this regard.

 TIA,
  Raghu.

-----Original Message-----
From: Erik Christiansen [mailto:erik@dd.nec.com.au]
Sent: Tuesday, November 25, 2003 5:54 AM
To: Raghunath L- CTD, Chennai.
Cc: gcc-help@gcc.gnu.org
Subject: Re: Symbol Aliasing


On Mon, Nov 24, 2003 at 07:27:32PM +0530, Raghunath L- CTD, Chennai. wrote:
>   Symbol1:
>         .long 4     ;Creates a symbol
> 
>   I want to create an alias 'Symbol2' for the original symbol 'Symbol1' .
> With this I want to refer the memory location '0x4' 
>   either with the name 'Symbol1' or with the name 'Symbol2'.

For the restricted case of aliasing a code or data address, you can use:

Symbol2:
Symbol1:
   .long 4

Both symbols can be used, and both appear in the map file (if declared
global), but only the first appears in an objdump of the elf file. (So
don't be alarmed by this.)

Erik

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Symbol Aliasing
  2003-11-24 13:57 Raghunath L- CTD, Chennai.
@ 2003-11-25  0:28 ` Erik Christiansen
  0 siblings, 0 replies; 3+ messages in thread
From: Erik Christiansen @ 2003-11-25  0:28 UTC (permalink / raw)
  To: Raghunath L- CTD, Chennai.; +Cc: gcc-help

On Mon, Nov 24, 2003 at 07:27:32PM +0530, Raghunath L- CTD, Chennai. wrote:
>   Symbol1:
>         .long 4     ;Creates a symbol
> 
>   I want to create an alias 'Symbol2' for the original symbol 'Symbol1' .
> With this I want to refer the memory location '0x4' 
>   either with the name 'Symbol1' or with the name 'Symbol2'.

For the restricted case of aliasing a code or data address, you can use:

Symbol2:
Symbol1:
   .long 4

Both symbols can be used, and both appear in the map file (if declared
global), but only the first appears in an objdump of the elf file. (So
don't be alarmed by this.)

Erik

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Symbol Aliasing
@ 2003-11-24 13:57 Raghunath L- CTD, Chennai.
  2003-11-25  0:28 ` Erik Christiansen
  0 siblings, 1 reply; 3+ messages in thread
From: Raghunath L- CTD, Chennai. @ 2003-11-24 13:57 UTC (permalink / raw)
  To: gcc-help

Hello all,

 I want to create an alias to an already created symbol in gnu assembler.
Pls help me in this regard.

Example:

 .org 0x4	;Advances the location counter to memory location '0x4'

  Symbol1:
        .long 4     ;Creates a symbol

  I want to create an alias 'Symbol2' for the original symbol 'Symbol1' .
With this I want to refer the memory location '0x4' 
  either with the name 'Symbol1' or with the name 'Symbol2'.

 Hope I am clear in explaining my requirement. Pls feel free to ask
questions if I am not clear.

 Thanks in advance,

Best Regards,
Raghunath Lolur,
Member Technical Staff,
Core Technology Division,
HCL Technologies Pvt. Ltd.,
Vadapalani, Chennai - 26.

> *: +91-44-23728366, Extn: 1324/ 5 / 6
> * : +91-44-24806640
> *: www.hcltech.com
> 
Disclaimer:
>This message and any attachment(s) contained here are information that is
>confidential, proprietary to HCL Technologies and its customers. Contents
may be privileged or otherwise protected >by law. The >information is solely
intended for the individual or the entity it is addressed to. If you are
>not the intended >recipient of this message, you are not authorized to
read, forward, >print, retain, >copy or disseminate this message or any part
of it. If you >have received >this e-mail in error, please notify the sender
immediately by >return e-mail >and delete it from your computer.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2003-11-25  6:54 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-11-25  6:54 Symbol Aliasing Raghunath L- CTD, Chennai.
  -- strict thread matches above, loose matches on Subject: below --
2003-11-24 13:57 Raghunath L- CTD, Chennai.
2003-11-25  0:28 ` Erik Christiansen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).