object file linking
Posted: Mon May 18, 2009 7:47 am
I link my source files with the option -i so that I can link "modules" in my loader to a kernel executable.
My problem is now that I have variables which I define as a global variable (outside from any function) and this variables use the section "COMMON" and I don´t know how to handle such variables. I would like to have that all symbols (functions and objects) are defined in relative to a section. The same problem applies to variables I define global and want to use in another source file, but in scope of the same module.
I hope you get the point.
sample code:
If you compile this code and link it with "-i" and then do an "objdump -x file" the section to which "foo" applies is *COM* and this is my problem, better would be if it would be apply to .data or .bss!
My problem is now that I have variables which I define as a global variable (outside from any function) and this variables use the section "COMMON" and I don´t know how to handle such variables. I would like to have that all symbols (functions and objects) are defined in relative to a section. The same problem applies to variables I define global and want to use in another source file, but in scope of the same module.
I hope you get the point.
sample code:
Code: Select all
uint32t foo;
void bar() {
...
}