Skip to contentSkip to conversation

Address of .globl _start

DISCUSSION Dragoslav Zaric 1 participant 2 messages Apr 20, 2009 – Apr 21, 2009 1 message not in the archive

lore
Share & tools
lore
#0 lore raw

Hello,

I have compiled test.s (bellow) with 'as' compiler:

-------------------------------------------------
.section .data

.globl var
var:
.long 10

.section .text

.globl _start
_start:
movl $_start, %ebx
jmp loop_exit

loop_exit:
movl $1, %eax #1 is the exit() syscall
int $0x80

-------------------------------------------------
and got output with echo $? (reads %ebx register)
116

After that I compiled test.s (bellow) with 'as' compiler:

-------------------------------------------------
.section .data

.globl var
var:
.long 10

.section .text

.globl _start
_start:
movl _start, %ebx
jmp loop_exit

loop_exit:
movl $1, %eax #1 is the exit() syscall
int $0x80

-------------------------------------------------
and got output with echo $? (reads %ebx register)
139

After that I compiled test.s (bellow) with 'as' compiler:

-------------------------------------------------
.section .data

.globl var
var:
.long 10

.section .text

.globl _start
_start:
movl var, %ebx
jmp loop_exit

loop_exit:
movl $1, %eax #1 is the exit() syscall
int $0x80

-------------------------------------------------
and got output with echo $? (reads %ebx register)
10

After that I compiled test.s (bellow) with 'as' compiler:

-------------------------------------------------
.section .data

.globl var
var:
.long 10

.section .text

.globl _start
_start:
movl $var, %ebx
jmp loop_exit

loop_exit:
movl $1, %eax #1 is the exit() syscall
int $0x80

-------------------------------------------------
and got output with echo $? (reads %ebx register)
132

So my question is, what these numbers mean ? From which
point in memory they are counted from ? From this I can conclude that value for "movl _start, %ebx" is always 139 and it can be on various addresses. Is this means that beginning of 'as' assembly program is signed with value 139 ???

thanks,

Dragoslav Zaric,
[Programmer; M Sc Astrophysics]

A message that is not in the archive (sent off-list or not yet received): [email protected]

#2 lore raw

Ok Steve,

So what do you think, where should I post this one ? I don't see what is wrong with this question ? Maybe you can answer if it is off topic for the LKML.

thanks

Dragoslav Zaric
[Programmer; M Sc Astrophysics]