Christian Svensson
2014-07-03 21:04:08 UTC
Hi,
I'm playing with newlib. I'm using https://github.com/openrisc/or1k-src/
and I'm compiling it like this:
EXTRA_BINUTILS=--disable-werror
(cd ${BUILDDIR}/build-or1k-newlib && \
${SRCDIR}/newlib/or1k-src/configure --target=${TARGET}
--prefix=/srv/compilers/openrisc-devel \
--disable-shared --disable-itcl --disable-tk --disable-tcl
--disable-winsup \
--disable-libgui --disable-rda --disable-sid --disable-sim
--disable-gdb \
--with-sysroot --enable-newlib --enable-libgloss
${EXTRA_BINUTILS} && \
make ${MAKEOPTS
I have this code:
#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
extern int _board_clk_freq;
void finish_test(const char *fmt, ...) {
va_list arg_list;
va_start(arg_list, fmt);
vprintf(fmt, arg_list);
va_end(arg_list);
fflush(stdout);
}
int main(int argc, char *argv[]) {
finish_test("%d MHz", _board_clk_freq / (1000*1000));
return 0;
}
Compiling results in the following:
or1k-elf-gcc vprintf.c
/srv/compilers/openrisc-devel/lib/gcc/or1k-elf/4.9.0/../../../../or1k-elf/lib/libc.a(lib_a-or1k-impure.o):
In function `__getreent':
/home/bluecmd/or1k-devel/newlib/../newlib/or1k-src/newlib/libc/machine/or1k/or1k-impure.c:80:
multiple definition of `__getreent'
/srv/compilers/openrisc-devel/lib/gcc/or1k-elf/4.9.0/../../../../or1k-elf/lib/libc.a(lib_a-getreent.o):/home/bluecmd/or1k-devel/newlib/../newlib/or1k-src/newlib/libc/reent/getreent.c:13:
first defined here
collect2: error: ld returned 1 exit status
Masking newlib/libc/reent/getreent.c with #if 0 (so the only definition is
or1k-impure.c) makes it work just fine.
diff --git a/newlib/libc/reent/getreent.c b/newlib/libc/reent/getreent.c
index 60ae6fb..d85d654 100644
--- a/newlib/libc/reent/getreent.c
+++ b/newlib/libc/reent/getreent.c
@@ -1,5 +1,6 @@
/* default reentrant pointer when multithread enabled */
+#if 0
#include <_ansi.h>
#include <reent.h>
@@ -12,3 +13,4 @@ _DEFUN_VOID(__getreent)
{
return _impure_ptr;
}
+#endif
Obviously that is not a correct solution though :-).
Ideas?
I'm playing with newlib. I'm using https://github.com/openrisc/or1k-src/
and I'm compiling it like this:
EXTRA_BINUTILS=--disable-werror
(cd ${BUILDDIR}/build-or1k-newlib && \
${SRCDIR}/newlib/or1k-src/configure --target=${TARGET}
--prefix=/srv/compilers/openrisc-devel \
--disable-shared --disable-itcl --disable-tk --disable-tcl
--disable-winsup \
--disable-libgui --disable-rda --disable-sid --disable-sim
--disable-gdb \
--with-sysroot --enable-newlib --enable-libgloss
${EXTRA_BINUTILS} && \
make ${MAKEOPTS
I have this code:
#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
extern int _board_clk_freq;
void finish_test(const char *fmt, ...) {
va_list arg_list;
va_start(arg_list, fmt);
vprintf(fmt, arg_list);
va_end(arg_list);
fflush(stdout);
}
int main(int argc, char *argv[]) {
finish_test("%d MHz", _board_clk_freq / (1000*1000));
return 0;
}
Compiling results in the following:
or1k-elf-gcc vprintf.c
/srv/compilers/openrisc-devel/lib/gcc/or1k-elf/4.9.0/../../../../or1k-elf/lib/libc.a(lib_a-or1k-impure.o):
In function `__getreent':
/home/bluecmd/or1k-devel/newlib/../newlib/or1k-src/newlib/libc/machine/or1k/or1k-impure.c:80:
multiple definition of `__getreent'
/srv/compilers/openrisc-devel/lib/gcc/or1k-elf/4.9.0/../../../../or1k-elf/lib/libc.a(lib_a-getreent.o):/home/bluecmd/or1k-devel/newlib/../newlib/or1k-src/newlib/libc/reent/getreent.c:13:
first defined here
collect2: error: ld returned 1 exit status
Masking newlib/libc/reent/getreent.c with #if 0 (so the only definition is
or1k-impure.c) makes it work just fine.
diff --git a/newlib/libc/reent/getreent.c b/newlib/libc/reent/getreent.c
index 60ae6fb..d85d654 100644
--- a/newlib/libc/reent/getreent.c
+++ b/newlib/libc/reent/getreent.c
@@ -1,5 +1,6 @@
/* default reentrant pointer when multithread enabled */
+#if 0
#include <_ansi.h>
#include <reent.h>
@@ -12,3 +13,4 @@ _DEFUN_VOID(__getreent)
{
return _impure_ptr;
}
+#endif
Obviously that is not a correct solution though :-).
Ideas?