[syslinux] malloc in libcom32 broken?

Jeff Kalikstein jeff at kalikstein.com
Wed Dec 8 08:45:44 PST 2004


I get a link error when trying to call malloc from
libcom32.  I tried to simplify the case by adding the
malloc to the sample hello.c in the modules directory,
but I still get the following error:


ld -m elf_i386 -T ../lib/com32.ld -o hello.elf hello.o
../libutil/libutil_com.a ../lib/libcom32.a
/usr/lib64/gcc-lib/x86_64-suse-linux/3.3.3/32/libgcc.a
../lib/libcom32.a(malloc.o)(.text+0x13): In function
`init_memory_arena':
/home/hpa/oss/syslinux/release/syslinux-2.12-pre/syslinux-2.12-pre7/com32/lib/malloc.c:42:
undefined reference to `__stack_size'
../lib/libcom32.a(malloc.o)(.text+0x2a):/home/hpa/oss/syslinux/release/syslinux-2.12-pre/syslinux-2.12-pre7/com32/lib/malloc.c:43:
undefined reference to `__stack_size'
../lib/libcom32.a(malloc.o)(.text+0x2f):/home/hpa/oss/syslinux/release/syslinux-2.12-pre/syslinux-2.12-pre7/com32/lib/malloc.c:45:
undefined reference to `__stack_size'
../lib/libcom32.a(malloc.o)(.text+0x3e):/home/hpa/oss/syslinux/release/syslinux-2.12-pre/syslinux-2.12-pre7/com32/lib/malloc.c:46:
undefined reference to `__stack_size'
../lib/libcom32.a(malloc.o)(.text+0x44):/home/hpa/oss/syslinux/release/syslinux-2.12-pre/syslinux-2.12-pre7/com32/lib/malloc.c:50:
undefined reference to `__stack_size'
make: *** [hello.elf] Error 1


Modified hello.c follows below:

#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include <console.h>

int main(void)
{
  char buffer[1024];
  void *foo = malloc(1);
  openconsole(&dev_stdcon_r, &dev_stdcon_w);

  printf("Hello, World!\n");


  for (;;) {
    printf("> ");
    fgets(buffer, sizeof buffer, stdin);
    if ( !strncmp(buffer, "exit", 4) )
      break;
    printf(": %s", buffer);
  }

  return 0;
}






More information about the Syslinux mailing list