Hi,
how do I place a variable/function at some specified addresses, e.g. I have this program test.c:
I tried to compile it using:Code:char variable = 0x01; // Want this "variable" placed in address 0x600000 // Want this "function" placed at address 0x400000 void function(void) __attribute__ ((section (".test"))); void function(void) { printf("hello\n"); } main() { function(); }
gcc -g -Wl,--section-start=.test=0x400000 test.c
But when I run it, I get Segmentation fault.
Can someone give me a sample linker script to cause the linker to place the objects (function and variable) at the specified addresses?
Thanks in advance.



LinkBack URL
About LinkBacks



