RE: Symbol Aliasing

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxxxx]
Sent: Tuesday, November 25, 2003 5:54 AM
To: Raghunath L- CTD, Chennai.
Cc: gcc-help@xxxxxxxxxxx
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

[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux