2010年4月20日 星期二

how to change default stack size...

方法一:
gcc -Wl,--defsym,__stacksize=0x80000 -o foo foo.c

方法二:

peter@team-server:sbin$ arm-elf-readelf -l foo

Elf file type is EXEC (Executable file)
Entry point 0x37fc
There are 6 program headers, starting at offset 52

Program Headers:
  Type           Offset   VirtAddr   PhysAddr   FileSiz MemSiz  Flg Align
  PHDR           0x000034 0x00000034 0x00000034 0x000c0 0x000c0 R E 0x4
  INTERP         0x0000f4 0x000000f4 0x000000f4 0x00014 0x00014 R   0x1
      [Requesting program interpreter: /lib/ld-uClibc.so.0]
  LOAD           0x000000 0x00000000 0x00000000 0x1f668 0x1f668 R E 0x1000
  LOAD           0x01f668 0x00020668 0x00020668 0x0b718 0x0ba98 RW  0x1000
  DYNAMIC        0x01f67c 0x0002067c 0x0002067c 0x000c8 0x000c8 RW  0x4
  GNU_STACK      0x000000 0x00000000 0x00000000 0x00000 0x20000 RWE 0x8 //原來的stack256KB


 Section to Segment mapping:
  Segment Sections...
   00
   01     .interp
   02     .interp .hash .dynsym .dynstr .rel.dyn .rel.plt .init .plt .text .fini .rofixup
   03     .ctors .dtors .jcr .dynamic .data .got .bss
   04     .dynamic
   05
peter@team-server:sbin$
peter@team-server:sbin$ ../../../fdpichdr/fdpichdr -s 0x100000  foo
peter@team-server:sbin$ arm-elf-readelf -l foo

Elf file type is EXEC (Executable file)
Entry point 0x37fc
There are 6 program headers, starting at offset 52

Program Headers:
  Type           Offset   VirtAddr   PhysAddr   FileSiz MemSiz  Flg Align
  PHDR           0x000034 0x00000034 0x00000034 0x000c0 0x000c0 R E 0x4
  INTERP         0x0000f4 0x000000f4 0x000000f4 0x00014 0x00014 R   0x1
      [Requesting program interpreter: /lib/ld-uClibc.so.0]
  LOAD           0x000000 0x00000000 0x00000000 0x1f668 0x1f668 R E 0x1000
  LOAD           0x01f668 0x00020668 0x00020668 0x0b718 0x0ba98 RW  0x1000
  DYNAMIC        0x01f67c 0x0002067c 0x0002067c 0x000c8 0x000c8 RW  0x4
  GNU_STACK      0x000000 0x00000000 0x00000000 0x00000 0x100000 RWE 0x8    //現在有1MB

 Section to Segment mapping:
  Segment Sections...
   00
   01     .interp
   02     .interp .hash .dynsym .dynstr .rel.dyn .rel.plt .init .plt .text .fini .rofixup
   03     .ctors .dtors .jcr .dynamic .data .got .bss
   04     .dynamic
   05     .bss

沒有留言: