This is the mail archive of the newlib@sourceware.org mailing list for the newlib project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Problems during shifting syscalls from /sys to /libgloss


Bhushan Attarde wrote:

Hi,


We are working on GNU based tool chain for infineon xc16x
microcontroller.
Currently the syscalls are in /newlib/libc/sys and we are trying to
shift them to /libgloss.
So after some google search we found some way to do that.......
And done some changes which are as follows:


* newlib-1.15.0/configure.in : removed target-libgloss from
noconfigdirs for xc16x-*-*
* configure : regenrate
* newlib-1.15.0/newlib/configure.host: : set sys_dir to empty for
xc16x-*-
And set syscall_dir to xc16x


* configure : regenerate * newlib/libc/sys/xc16x/ configure.in : removed
* newlib/libc/sys/xc16x/ configure : removed


 *  newlib/libc/sys/xc16x/ crt0.s : moved to libgloss/xc16x
 *  newlib/libc/sys/xc16x/ close.s : moved to libgloss/xc16x
 *  newlib/libc/sys/xc16x/ create.c : moved to libgloss/xc16x
 *  newlib/libc/sys/xc16x/ getchar1.c : moved to libgloss/xc16x
 *  newlib/libc/sys/xc16x/ isatty.c : moved to libgloss/xc16x
 *  newlib/libc/sys/xc16x/ lseek.c : moved to libgloss/xc16x
 *  newlib/libc/sys/xc16x/ mem-layout : moved to libgloss/xc16x
 *  newlib/libc/sys/xc16x/ misc.c : moved to libgloss/xc16x
 *  newlib/libc/sys/xc16x/ open.c : moved to libgloss/xc16x
 *  newlib/libc/sys/xc16x/ putchar.c : moved to libgloss/xc16x
 *  newlib/libc/sys/xc16x/ puts.c : moved to libgloss/xc16x
 *  newlib/libc/sys/xc16x/ read.c : moved to libgloss/xc16x
 *  newlib/libc/sys/xc16x/ sbrk.c: moved to libgloss/xc16x
 *  newlib/libc/sys/xc16x/ syscalls.c : moved to libgloss/xc16x
 *  newlib/libc/sys/xc16x/ trap-handle.c : moved to libgloss/xc16x
 *  newlib/libc/sys/xc16x/ write.c : moved to libgloss/xc16x

* newlib/libc/sys/xc16x : reomoved
* libgloss/xc16x/configure.in : new
* libgloss/xc16x/configure : regenerate




With these changes I built the tool chain, it got built without any
error.

But when I tried to compile one of our sample program I got the
following errors...............

/home/bhushana/XC16X/run/xc16x-elf/lib/gcc/xc16x-elf/4.2.0/../../../../x
c16x-elf/lib/xc16xl/libg.a(lib_a-makebuf.o): In function `___smakebuf':


makebuf.c:(.text+0x1fb): undefined reference to `_isatty'

makebuf.c:(.text+0x1fc): undefined reference to `_isatty'

/home/bhushana/XC16X/run/xc16x-elf/lib/gcc/xc16x-elf/4.2.0/../../../../x
c16x-elf/lib/xc16xl/libg.a(lib_a-sbrkr.o): In function `__sbrk_r':

sbrkr.c:(.text+0x1d): undefined reference to `__sbrk'

sbrkr.c:(.text+0x1e): undefined reference to `__sbrk'

/home/bhushana/XC16X/run/xc16x-elf/lib/gcc/xc16x-elf/4.2.0/../../../../x
c16x-elf/lib/xc16xl/libg.a(lib_a-closer.o): In function `__close_r':

closer.c:(.text+0x1b): undefined reference to `__close'

closer.c:(.text+0x1c): undefined reference to `__close'

/home/bhushana/XC16X/run/xc16x-elf/lib/gcc/xc16x-elf/4.2.0/../../../../x
c16x-elf/lib/xc16xl/libg.a(lib_a-fstatr.o): In function `__fstat_r':

fstatr.c:(.text+0x25): undefined reference to `__fstat'

fstatr.c:(.text+0x26): undefined reference to `__fstat'

/home/bhushana/XC16X/run/xc16x-elf/lib/gcc/xc16x-elf/4.2.0/../../../../x
c16x-elf/lib/xc16xl/libg.a(lib_a-lseekr.o): In function `__lseek_r':

lseekr.c:(.text+0x2d): undefined reference to `__lseek'

lseekr.c:(.text+0x2e): undefined reference to `__lseek'

collect2: ld returned 1 exit status

make: *** [Mathtest.out] Error 1



what went wrong ? Or the changes are incomplete and needs to do more?
What should I need to do?


Hi Bhushan,


Don't forget that the compiler needs to be informed of your change as well when it adds library references when linking. If you have introduced a new library, you will have to either refer to it manually on your compile/link command or you will need to modify the compiler so it adds it automatically.

A common way of implementing libgloss is to use an ld script. The ld script contains all the information needed to link so all that is needed is to add: -Txxxx.ld to the compile/link command. This is useful in the case of multiple board configurations as you can have yyyy.ld and zzzz.ld, etc... One could modify the compiler to add options to do this automatically on behalf of the end-user (e.g. -mxxxxx translates to -Txxxxx.ld when linking) or if there is only one choice to hardwire the needed reference.

Check out libgloss/mn10300/sim.ld for an example of an ld script. Note the GROUP directive to repeatedly search the given libraries.

-- Jeff J.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]