some questions about compiling newlib

View: New views
3 Messages — Rating Filter:   Alert me  

some questions about compiling newlib

by miloody :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Dear all:
my questions are:
1. in sys/config.h, it will try to determine the machine we try to
compile. Like
#if defined(__mips__) && !defined(__rtems__)
#define __ATTRIBUTE_IMPURE_PTR__ __attribute__((__section__(".sdata")))
#endif

where we give the define like __mips__?
I grep the '__mips__' in whole source code but I cannot find any clue.

newlib-1.17.0.monta_noUclibc# grep -rw '__mips__' *
newlib/ChangeLog: * libc/include/sys/config.h[__mips__]: Don't bother
newlib/ChangeLog: [__rtems__][__mips__]: No need to undef the
__ATTRIBUTE_IMPURE_PTR__
newlib/ChangeLog: * libc/include/machine/setjmp.h: Added __mips__ case.
newlib/libc/sys/linux/linuxthreads/kernel-features.h:#if
__LINUX_KERNEL_VERSION >= 131879 || defined __powerpc__ || defined
__mips__
newlib/libc/sys/linux/dl/kernel-features.h:#if __LINUX_KERNEL_VERSION
>= 131879 || defined __powerpc__ || defined __mips__
newlib/libc/include/machine/setjmp.h:#ifdef __mips__
newlib/libc/include/sys/config.h:#if defined(__mips__) && !defined(__rtems__)
newlib-1.17.0.monta_noUclibc#


2. I try to compile newlib under mips-toolchain.
But I get the error attached at the end of mail while compiling impure.c.
it seems somewhere declare _global_impure_ptr and assign it with
different section type. But i cannot find out where it is.

mips2_fp_le-gcc
-B/media/sdb1/Novatek2/newlib-1.17.0.monta_noUclibc/mipsel/newlib/
-isystem /media/sdb1/Novatek2/newlib-1.17.0.monta_noUclibc/mipsel/newlib/targ-include
-isystem /media/sdb1/Novatek2/newlib-1.17.0.monta_noUclibc/newlib/libc/include
-B/media/sdb1/Novatek2/newlib-1.17.0.monta_noUclibc/mipsel/libgloss/mips
-L/media/sdb1/Novatek2/newlib-1.17.0.monta_noUclibc/mipsel/libgloss/libnosys
-L/media/sdb1/Novatek2/newlib-1.17.0.monta_noUclibc/libgloss/mips
-DPACKAGE_NAME=\"newlib\" -DPACKAGE_TARNAME=\"newlib\"
-DPACKAGE_VERSION=\"1.17.0\" -DPACKAGE_STRING=\"newlib\ 1.17.0\"
-DPACKAGE_BUGREPORT=\"\"  -I. -I../../../.././newlib/libc/reent -O2
-DMISSING_SYSCALL_NAMES -fno-builtin      -g -O2   -c -o
lib_a-impure.o `test -f 'impure.c' || echo
'../../../.././newlib/libc/reent/'`impure.c
../../../.././newlib/libc/reent/impure.c:17: error: _global_impure_ptr
causes a section type conflict

appreciate your help,
miloody

RE: some questions about compiling newlib

by Jon Beniston-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

> where we give the define like __mips__?

This will probably be defined by the compiler.

To see what the compiler defines:

mips-elf-gcc -dM -E - < /dev/null

Cheers,
Jon




Re: some questions about compiling newlib

by miloody :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi all:

2009/11/11 loody <miloody@...>:

> Dear all:
> my questions are:
> 1. in sys/config.h, it will try to determine the machine we try to
> compile. Like
> #if defined(__mips__) && !defined(__rtems__)
> #define __ATTRIBUTE_IMPURE_PTR__ __attribute__((__section__(".sdata")))
> #endif
>
> where we give the define like __mips__?
> I grep the '__mips__' in whole source code but I cannot find any clue.
>
> newlib-1.17.0.monta_noUclibc# grep -rw '__mips__' *
> newlib/ChangeLog:       * libc/include/sys/config.h[__mips__]: Don't bother
> newlib/ChangeLog:       [__rtems__][__mips__]: No need to undef the
> __ATTRIBUTE_IMPURE_PTR__
> newlib/ChangeLog:       * libc/include/machine/setjmp.h: Added __mips__ case.
> newlib/libc/sys/linux/linuxthreads/kernel-features.h:#if
> __LINUX_KERNEL_VERSION >= 131879 || defined __powerpc__ || defined
> __mips__
> newlib/libc/sys/linux/dl/kernel-features.h:#if __LINUX_KERNEL_VERSION
>>= 131879 || defined __powerpc__ || defined __mips__
> newlib/libc/include/machine/setjmp.h:#ifdef __mips__
> newlib/libc/include/sys/config.h:#if defined(__mips__) && !defined(__rtems__)
> newlib-1.17.0.monta_noUclibc#
>
>
> 2. I try to compile newlib under mips-toolchain.
> But I get the error attached at the end of mail while compiling impure.c.
> it seems somewhere declare _global_impure_ptr and assign it with
> different section type. But i cannot find out where it is.
>
> mips2_fp_le-gcc
> -B/media/sdb1/Novatek2/newlib-1.17.0.monta_noUclibc/mipsel/newlib/
> -isystem /media/sdb1/Novatek2/newlib-1.17.0.monta_noUclibc/mipsel/newlib/targ-include
> -isystem /media/sdb1/Novatek2/newlib-1.17.0.monta_noUclibc/newlib/libc/include
> -B/media/sdb1/Novatek2/newlib-1.17.0.monta_noUclibc/mipsel/libgloss/mips
> -L/media/sdb1/Novatek2/newlib-1.17.0.monta_noUclibc/mipsel/libgloss/libnosys
> -L/media/sdb1/Novatek2/newlib-1.17.0.monta_noUclibc/libgloss/mips
> -DPACKAGE_NAME=\"newlib\" -DPACKAGE_TARNAME=\"newlib\"
> -DPACKAGE_VERSION=\"1.17.0\" -DPACKAGE_STRING=\"newlib\ 1.17.0\"
> -DPACKAGE_BUGREPORT=\"\"  -I. -I../../../.././newlib/libc/reent -O2
> -DMISSING_SYSCALL_NAMES -fno-builtin      -g -O2   -c -o
> lib_a-impure.o `test -f 'impure.c' || echo
> '../../../.././newlib/libc/reent/'`impure.c
> ../../../.././newlib/libc/reent/impure.c:17: error: _global_impure_ptr
> causes a section type conflict
>
I find the 2 problem will disappear if I use different compiler.
it seems the error comes from compiler setting.
Am I right?
appreciate your help,
miloody