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: gas preprocessor


Hi Nik, thank you for your reply.

I tried what you suggested but seems like it doesn't
work. Here is small assembly program:

.intel_syntax noprefix
	
.text
.global  _start

_start:
	call answer
	mov	ebx, eax
	
	mov	eax, 1
	int	0x80

answer:
.set result, [ebp-4]
        enter   4, 0

	mov	result, dword ptr 42
	mov	eax, result
        leave
        ret

I'm using following commands to compile it:
as -o foo.o foo.s
ld -o foo foo.o

However, linker reports errors:
foo.o: In function `answer':
foo.o(.text+0x14): undefined reference to `ebp'
foo.o(.text+0x1d): undefined reference to `ebp'

Thanks.

--- Nick Clifton <nickc@cambridge.redhat.com> wrote:
> Hi Crni,
> 
> > Is preprocessing support in gas working? Am trying
> to utilize it
> > with gas 2.11.90.0.8 in order to create alias
> names for functions
> > arguments instead of use [ebp+8] etc. (am using
> Intel syntax). What
> > I'm actually looking for is gas equivalent of EQU
> directive commonly
> > found in other (well, at least IA-32) assemblers.
> I know that I
> > could accomplish same using gcc preprocessor but I
> don't like this
> > solution (when debugging code using gdb I have to
> struggle again
> > with [ebp+8] and alike). 
> 
> I believe that the short answer to your question is
> "no".
> 
> You can use the .set directive to set up assemble
> time aliases for
> expressions, so you could do:
> 
>         .set foo, [ebp+8]
> 
> This will not generate a debugging entry however, so
> you will not be
> able to see 'foo' in your GDB sessions.
> 
> You might be able to use the register aliasing
> ability of gcc to solve
> your problem however.  For example a declaration
> like this:
> 
>   register int ebp_reg asm ("ebp");
> 
> would create a variable called 'ebp_reg' which was
> mapped onto the ebp
> register and which could be viewed inside gdb.
> 
> Cheers
>         Nick
> 


__________________________________________________
Do You Yahoo!?
Send FREE video emails in Yahoo! Mail!
http://promo.yahoo.com/videomail/


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