Page 1 of 1

variable, size

Posted: Sat Jul 26, 2003 1:01 pm
by frank
Why does the size of the kernel gets much bigger when you add a variable outside a function?
(which you give a value ofcourse)

example:

Code: Select all


unsigned char c = 5;

int main()
{

  while (1)
  {

  }

}

I' ve always worked around this (I always declared my variables inside the function).

I linked like this:

Code: Select all

gcc -c file.c
ld -o file -Ttext 0x1000 -e start file.o
objcopy -R .note -R .comment -S -O binary file file.bin

Re:variable, size

Posted: Sat Jul 26, 2003 1:13 pm
by The Pro from Dover
Good question, and one which has come up before. See reply #4 in this thread for Tim Robinson's explanation of the issue.