Relocatable elf problem

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
digo_rp
Member
Member
Posts: 233
Joined: Sun Jun 05, 2005 11:00 pm

Relocatable elf problem

Post by digo_rp »

Hi all, I,m having some problem... let-me try to explain.

I have 2 case!

case 1: using .bss non initialized var.

unsigned char cmdargs[10][32];

memset((unsigned char *)&cmdargs, 0, sizeof(cmdargs));

this at my os, I can use a lot! no problem!

bute when I try to put my CommandLineInterpreter inside in a elf relocatable file and try to do a memset like above... all my operating system goes crazy...

and case 2:

unsigned char cmdargs[10][32] = { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};

memset((unsigned char *)&cmdargs, 0, sizeof(cmdargs));

at this case my Command Line Interpreter works fine inside in a .elf relocatable file...

with this second case my var cmdargs goes into .data section, right ? and other on not initialized in case one goes into .bss section...

now I don´t understand why that happens...

could anyone help me trying to solve that mistake! please!

tnx a lot and forgive-me all common mistakes...
digo_rp
Member
Member
Posts: 233
Joined: Sun Jun 05, 2005 11:00 pm

Re: Relocatable elf problem

Post by digo_rp »

OK! the problem was solved!

I found this on OSD tutorials.

ld option -d is equivalent to the FORCE_COMMON_ALLOCATION command in a linker script

this happens on global vars that are not initialized.

thnx so much all.
kzinti
Member
Member
Posts: 898
Joined: Mon Feb 02, 2015 7:11 pm

Re: Relocatable elf problem

Post by kzinti »

digo_rp wrote:thnx so much all.
You are welcome!
Post Reply