Hi,
How can I find a base section of a program running? I tried the
following code, and tried to link using
a linker script.
$ cat section.c
#include <stdio.h>
int __attribute__ ((section (".sample"))) in_section = 10;
int temp = 1;
extern int sample_start;
int main()
{
printf("address of variable %.08x\n", &in_section);
printf("starting address of section %.08x\n", sample_start);
printf("a variable in data section %.08x\n", &temp);
return 0;
}
Here is the linker script,
$ cat sec.lds
SECTIONS
{
. = .;
.data :
{
__sample_start = LOADADDR(.data);
*(.sample)
*(.data)
PROVIDE(sample_start = __sample_start);
}
}
$ gcc -c section.c
$ gcc -o section section.o sec.lds
$ ./section
address of variable 08049604
starting address of section 00000000
a variable in data section 08049600
$
I would like to see the starting address of the section is same as the
address of variable in the section.
Any guesses what I'm missing here?
--
Selva
_______________________________________________
ilugd mailinglist -- [email protected]
http://frodo.hserus.net/mailman/listinfo/ilugd
Archives at: http://news.gmane.org/gmane.user-groups.linux.delhi
http://www.mail-archive.com/[email protected]/