[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[openrisc] or32 compile errors



I am trying to compile a simple c program with the or32-rtems-gcc
compiler and I am getting errors.  Please forgive me if I am doing
something stupid.  I am a newbie concerning C programming and software
development in general.

Here's the program I am wanting to compile... This is the sample program
from the DDD documentation.  It compiles cleanly with plain gcc.

----- CUT BELOW THIS LINE -----
/* sample.c -- Sample C program to be debugged with ddd */ 
#include <stdio.h> 
#include <stdlib.h>

static void shell_sort(int a[], int size) {
   int i, j;
   int h = 1;
   do {
      h = h * 3 + 1;
   } while (h <= size - 1);
   do {
      h /= 3;
      for (i = h; i < size - 1; i++) {
         int v = a[i];
         for (j = i; j >= h && a[j - h] > v; j -= h)
            a[j] = a[j - h];
         if (i != j)
            a[j] = v;
      }
   } while (h != 1);
}

int main(int argc, char *argv[]) {
   int *a;
   int i;

   a = (int *)malloc((argc - 1) * sizeof(int));
   for (i = 0; i < argc - 1; i++)
      a[i] = atoi(argv[i + 1]);

   shell_sort(a, argc);

   for (i = 0; i < argc - 1; i++)
      printf("%d ", a[i]);
   printf("\n");

   free(a);
   return 0;
}
----- CUT ABOVE THIS LINE -------

Here's the transcript of the compile command:

[jeff@asic1 testbench]$ or32-rtems-gcc -o sample sample.c 
/opt/or32-rtems/or32-rtems/lib/libc.a(findfp.o): In function
`__sfmoreglue':
../../../../../gcc/newlib/libc/stdio/findfp.c:55: undefined reference to
`_malloc_r'
/opt/or32-rtems/or32-rtems/lib/libc.a(wsetup.o): In function
`__swsetup':
../../../../../gcc/newlib/libc/stdio/wsetup.c:50: undefined reference to
`_free_r'
/opt/or32-rtems/or32-rtems/lib/libc.a(stdio.o): In function `__sread':
../../../../../gcc/newlib/libc/stdio/stdio.c:40: undefined reference to
`_read_r'
/opt/or32-rtems/or32-rtems/lib/libc.a(stdio.o): In function `__swrite':
../../../../../gcc/newlib/libc/stdio/stdio.c:60: undefined reference to
`_lseek_r'
../../../../../gcc/newlib/libc/stdio/stdio.c:62: undefined reference to
`_write_r'
/opt/or32-rtems/or32-rtems/lib/libc.a(stdio.o): In function `__sseek':
../../../../../gcc/newlib/libc/stdio/stdio.c:74: undefined reference to
`_lseek_r'
/opt/or32-rtems/or32-rtems/lib/libc.a(stdio.o): In function `__sclose':
../../../../../gcc/newlib/libc/stdio/stdio.c:91: undefined reference to
`_close_r'
/opt/or32-rtems/or32-rtems/lib/libc.a(makebuf.o): In function
`__smakebuf':
../../../../../gcc/newlib/libc/stdio/makebuf.c:50: undefined reference
to `_fstat_r'
../../../../../gcc/newlib/libc/stdio/makebuf.c:81: undefined reference
to `_malloc_r'
../../../../../gcc/newlib/libc/stdio/makebuf.c:93: undefined reference
to `isatty'
/opt/or32-rtems/or32-rtems/lib/libc.a(mprec.o): In function `_Balloc':
../../../../../gcc/newlib/libc/stdlib/mprec.c:101: undefined reference
to `_calloc_r'
../../../../../gcc/newlib/libc/stdlib/mprec.c:118: undefined reference
to `_calloc_r'
collect2: ld returned 1 exit status


Any suggestions would be appreciated.

Thanks,
Jeff

--
To unsubscribe from openrisc mailing list please visit http://www.opencores.org/mailinglists.shtml