flat assembler
Message board for the users of flat assembler.

Index > Main > my_size = my_end - my_start : INVALID use of symbol

Author
Thread Post new topic Reply to topic
Necromancer13.13



Joined: 20 Apr 2008
Posts: 15
Location: Ukraine
Necromancer13.13 11 Jun 2008, 13:56
When I try to complile this, I get an error: my_size = my_end - my_start: INVALID use of symbol, is this normal?

All source code:

Code:
format ELF

section '.text' executable

public _start

my_start:

get_str_length:
    push    ebp
 mov     ebp,esp
     push    ecx esi
     mov     esi,dword [ebp+8]
   xor     ecx,ecx
  @@:
        lodsb
       or      al,al
       jz      @f
  inc     ecx
 jmp     @b
  @@:
     mov     eax,ecx
     pop     esi ecx
     mov     esp,ebp
     pop     ebp
 ret     4

print_msg:
     push    ebp
 mov     ebp,esp
     mov     esi,[ebp+8]
 push    esi
 call    get_str_length
      pushad
      mov     edx,eax
     mov     ecx,esi
     xor     ebx,ebx
     inc     ebx
 mov     eax,4
       int     80h
 popad
       mov     esp,ebp
     pop     ebp
 ret     4

hex2str:
       push    ebp
 mov     ebp,esp
     pushad
      mov     edi,[ebp+8]
 mov     ebx,_table
  mov     dl,al
       shr     al,4
        xlatb
       stosb
       mov     al,dl
       and     al,0Fh
      xlatb
       stosb
       popad
       mov     esp,ebp
     pop     ebp
 ret     4

  _table   db '0123456789ABCDEF'

print_hex_byte:
      push    buffer
      call    hex2str
     push    buffer
      call    print_msg
   ret

_start:
      mov     al,13h
      call    print_hex_byte
      xor     ebx,ebx
     mov     eax,ebx
     inc     eax
 int     80h

my_size = my_end - my_start

section '.data' writeable

  buffer       db 'XX',0
my_end:

    

_________________
FASM Rules!
Post 11 Jun 2008, 13:56
View user's profile Send private message MSN Messenger ICQ Number Reply with quote
vid
Verbosity in development


Joined: 05 Sep 2003
Posts: 7105
Location: Slovakia
vid 11 Jun 2008, 14:00
I think you cannot cross sections... ELF can be linked and sections moved around.
Post 11 Jun 2008, 14:00
View user's profile Send private message Visit poster's website AIM Address MSN Messenger ICQ Number Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 20422
Location: In your JS exploiting you and your system
revolution 11 Jun 2008, 14:25
What vid means is that my_end is out of scope when fasm encounters the expression.
Post 11 Jun 2008, 14:25
View user's profile Send private message Visit poster's website Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.