[TAG] a question about linker script
Ben Okopnik
ben at callahans.org
Thu Jun 17 17:24:56 MSD 2004
----- Forwarded message from lion ? <helo54ljm at yahoo.com.tw> -----
Date: Thu, 17 Jun 2004 16:40:11 +0800 (CST)
From: lion ? <helo54ljm at yahoo.com.tw>
To: TAG <tag at lists.linuxgazette.net>
Subject: a question about linker script
To: ben at callahans.org
Dear Mr.Okopnik:
My name is Liang Jun-Ming,a student from Taiwan.
I'm suffering from a programming problem,I would very much
appreciate receving an answer from you !
I wrote a testing program named hello.s , and a linker script named
ldscript as follows:
/******hello.s*******/
.global _start
.text
_start:
movl $len,%edx
movl $msg,%ecx
movl $1,%ebx
movl $4,%eax
int $0x80 #print string
movl $0,%ebx
movl $1,%eax
int $0x80 #exit
.data
msg:
.string "Hello !\n"
len = . - msg
/*******ldscript********/
SECTIONS
{
.text 0x1000 : AT(0x3000000) { *(.text) }
.data . : AT(LOADADDR(.text) + SIZEOF(.text) )
{ *(.data) }
}
after " as hello.s -o hello.o" and "ld -Tldscript hello.o -o hello"
I get an executable named hello.
My question is:
-----What does "AT(0x3000000)" mean ?
Does it mean that the loader will load this executable at
"physical address " 0x3000000 ?
I know the "virtual address" of the first byte of this executable
would be 0x1000, but in Linux , can we put data at any physical
address as we wish ? If it does, why the program still works even if the RAM
is 32M in my PC ?(0x3000000 > 32M). What tool in Linux can we have to
let us "watch" the contents of memory by specifying "physical addresses"?
If it doesn't, what is the function when we write "AT(xxxx)" ?
Hope I can receive an answer when you are not busy. Thank you very much!
???????????????????????????????????????????????????????????????????????????????
H c f t Y ?q, q ? L a!
Yahoo! _ Messenger6.0
----- End forwarded message -----
* Ben Okopnik * okopnik.freeshell.org * Editor-in-Chief, Linux Gazette *
-*- See the Linux Gazette in its new home: <http://linuxgazette.net> -*-
More information about the TAG
mailing list