This is the mail archive of the crossgcc@sources.redhat.com mailing list for the crossgcc project.
See the CrossGCC FAQ for lots more information.
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
Robert Lewko wrote: > > First, let me see if I am on the right track. What I eventually want is > a c/c++ compiler that is hosted on i386-linux and generates code for > arm-linux-elf and links against the uC-libc library. This library > should include the linux-threads package. Do I build a cross compiler > first with newlib then use that to compile uC-libc or can I start > building the compiler wiith uC-libc. I cannot imagine any reason using newlib in the build... Just go into the: http://www.uClinux.org/pub/uClinux/ports and download the uC-libc sources for ARM, then copy the headers from it into the proper place and start building GCC... About the linux-threads I'm not sure, there was a preliminary glibc-port in www.uClinux.org, don't remember the linux-threads mentioned with uC-libc, but perhaps it can be glued into it somehow.... > What I am trying to do is build a gcc cross compiler hosted on a > i386-intel machine running linux and cross compiling to > target=arm-linux-elf. ????? The target name is 'arm-uclinux', not the 'arm-linux' or 'arm-elf'. Basically the configuration is the same as for 'arm-linux-gnu', but the library names etc. are different. Someone wrote some misleading info on this list a week or so ago but everyone is free to believe or not and I'm too old and tired to argue... > I have read the CrossGcc FAQ. I have run the > one-tree-1.6.sh with binutils-2.10.tar.gz, gcc-2.95.tar.gz and > newlib-1.9.0.tar.gz in the tars directory. As said, don't use newlib. And gcc-2.95.2 needs the uClinux patches (they were broken when I last looked at the www.uClinux.org... I used the RedHat-EDK sources instead, there the 'arm-uclinux' and 'thumb-uclinux' targets were already known and the needed config files included... > 3) make ~/crossgcc/build > > 4) enter this directory and issue the command: > > ../src/configure --target=arm-linux --with-newlib > > 5) make all > > This stops with an error as follows: > > cp ../../src/gcc/config/arm/lib1funcs.asm libgcc1.S > for name in _udivsi3 _divsi3 _umodsi3 _modsi3 _dvmd_lnx; \ > do \ > echo ${name}; \ > /home/rob/crosscompiler/build/gcc/xgcc > -B/home/rob/crosscompiler/build/gcc/ -B/usr/local/arm-linux/bin/ > -I/usr/local/arm-linux/include -O2 -DCROSS_COMPILE -DIN_GCC -g -O2 > -I./include -fomit-frame-pointer -fPIC -g0 -DHAVE_GTHR_DEFAULT > -DIN_LIBGCC2 -D__GCC_FLOAT_NOT_NEEDED -Dinhibit_libc -I. > -I../../src/gcc -I../../src/gcc/config -I../../src/gcc/../include -c > -DL${name} libgcc1.S; \ > if [ $? -eq 0 ] ; then true; else exit 1; fi; \ > mv libgcc1.o ${name}.o; \ > /home/rob/crosscompiler/build/binutils/ar rc tmplibgcc1.a ${name}.o; \ > > rm -f ${name}.o; \ > done > _udivsi3 > _divsi3 > _umodsi3 > _modsi3 > _dvmd_lnx > libgcc1.S:438: asm/unistd.h: No such file or directory > make[1]: *** [libgcc1-asm.a] Error 1 When you selected a Linux-target, Linux-stuff you must have... > I have noticed that there are much newer compilers, ie. > gcc-2.95.3.tar.gz. Should I use this one? If not what have I done > wrong? The gcc-2.95.x-branch would be ok, if only the patches would be there... Basically only some small files are needed and the entry into 'gcc/configure' plus fixes into 'config.sub' so that the target will be recognized... --------------------- clip ------------------------------------------ case x${enable_threads} in x | xyes | xpthreads | xposix) thread_file='posix' ;; esac ;; + arm*-*-uclinux*) # ARM ucLinux + tm_file=arm/uclinux-elf.h + tmake_file=arm/t-arm-uclinux + ;; arm*-*-aout) tm_file=arm/aout.h tmake_file=arm/t-bare ;; arm*-*-ecos-elf) tm_file=arm/ecos-elf.h tmake_file=arm/t-elf ;; --------------------- clip ------------------------------------------ Just a piece of cake if one has any clue about what to do. My config files and the 'mno-got' patch are attached here but I haven't yet tried these with gcc-2.95.3... The gcc-3.0 prerelease has the 'arm-uclinux' somehow supported but no clue about the availability of the 'mno-got' option... I suggest looking at the www.uClinux.org documents, browsing the messages on the uClinux-maillist and so on... Only you will know what library variations you will need, so the MULTILIB definitions in 't-arm-uclinux' are just examples... Cheers, Kai
CROSS_LIBGCC1 = libgcc1-asm.a LIB1ASMSRC = arm/lib1funcs.asm LIB1ASMFUNCS = _udivsi3 _divsi3 _umodsi3 _modsi3 _dvmd_tls _call_via_rX # We want fine grained libraries, so use the new code to build the # floating point emulation libraries. FPBIT = fp-bit.c DPBIT = dp-bit.c fp-bit.c: $(srcdir)/config/fp-bit.c echo '#define FLOAT' > fp-bit.c echo '#ifndef __ARMEB__' >> fp-bit.c echo '#define FLOAT_BIT_ORDER_MISMATCH' >> fp-bit.c echo '#endif' >> fp-bit.c cat $(srcdir)/config/fp-bit.c >> fp-bit.c dp-bit.c: $(srcdir)/config/fp-bit.c echo '#ifndef __ARMEB__' > dp-bit.c echo '#define FLOAT_BIT_ORDER_MISMATCH' >> dp-bit.c echo '#define FLOAT_WORD_ORDER_MISMATCH' >> dp-bit.c echo '#endif' >> dp-bit.c cat $(srcdir)/config/fp-bit.c >> dp-bit.c MULTILIB_OPTIONS = mlittle-endian/mbig-endian MULTILIB_DIRNAMES = le be MULTILIB_EXCEPTIONS = MULTILIB_MATCHES = mbig-endian=mbe mlittle-endian=mle MULTILIB_OPTIONS += mhard-float/msoft-float MULTILIB_DIRNAMES += fpu soft MULTILIB_OPTIONS += mcpu=arm7 MULTILIB_DIRNAMES += nofmult # We have to match all the arm cpu variants which do not have the # multiply instruction and treat them as if the user had specified # -mcpu=arm7. Note that in the following the ? is interpreted as # an = for the purposes of matching command line options. # FIXME: There ought to be a better way to do this. MULTILIB_MATCHES += mcpu?arm7=mcpu?arm7d MULTILIB_MATCHES += mcpu?arm7=mcpu?arm7di MULTILIB_MATCHES += mcpu?arm7=mcpu?arm70 MULTILIB_MATCHES += mcpu?arm7=mcpu?arm700 MULTILIB_MATCHES += mcpu?arm7=mcpu?arm700i MULTILIB_MATCHES += mcpu?arm7=mcpu?arm710 MULTILIB_MATCHES += mcpu?arm7=mcpu?arm710c MULTILIB_MATCHES += mcpu?arm7=mcpu?arm7100 MULTILIB_MATCHES += mcpu?arm7=mcpu?arm7500 MULTILIB_MATCHES += mcpu?arm7=mcpu?arm7500fe MULTILIB_MATCHES += mcpu?arm7=mcpu?arm6 MULTILIB_MATCHES += mcpu?arm7=mcpu?arm60 MULTILIB_MATCHES += mcpu?arm7=mcpu?arm600 MULTILIB_MATCHES += mcpu?arm7=mcpu?arm610 MULTILIB_MATCHES += mcpu?arm7=mcpu?arm620 EXTRA_MULTILIB_PARTS = crtbegin.o crtend.o LIBGCC = stmp-multilib INSTALL_LIBGCC = install-multilib TARGET_LIBGCC2_CFLAGS = -Dinhibit_libc
Patch for arm-uclinux target the patch allows generation of Position Independent Code not using GOT and PLT relocations when gcc is configured for arm-uclinux target. arm-uclinux-gcc will enter this mode when given -mno-got option ChangeLog 2000-01-08 Vadim Lebedev <vlebedev@aplio.fr> * config.sub Added arm-uclinux target * gcc/Configure modified arm-uclinux-target to use t-arm-uclinux fragment * gcc/config/arm/arm.c added usage of ARM_SUBTARGET_OVERRIDE_OPTION in arm_override_options arm_legitimize_pic_address modified to generate indirection throug GOT ONLY if NEED_GOT_RELOC is true * gcc/config/arm/arm.h added define ARM_FLAG_LAST_USED_BIT to specify last used bit in target_flags * gcc/config/arm/uclinux-elf.h modified to support -mno-got option Index: config.sub =================================================================== RCS file: /cvs/gcc/egcs/config.sub,v retrieving revision 1.37 diff -c -r1.37 config.sub *** config.sub 1999/12/14 16:10:58 1.37 --- config.sub 2000/01/07 13:02:13 *************** *** 920,926 **** | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \ | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ | -mingw32* | -linux-gnu* | -uxpv* | -beos* | -mpeix* | -udk* \ ! | -interix* | -uwin* | -rhapsody* | -opened* | -openstep* | -oskit*) # Remember, each alternative MUST END IN *, to match a version number. ;; -sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \ --- 920,928 ---- | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \ | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ | -mingw32* | -linux-gnu* | -uxpv* | -beos* | -mpeix* | -udk* \ ! | -interix* | -uwin* | -rhapsody* | -openstep* | -oskit* \ ! | -uclinux* ) ! # Remember, each alternative MUST END IN *, to match a version number. ;; -sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \ Index: gcc/configure =================================================================== RCS file: /cvs/gcc/egcs/gcc/configure,v retrieving revision 1.317 diff -c -r1.317 configure *** configure 2000/01/05 08:23:15 1.317 --- configure 2000/01/07 13:02:15 *************** *** 3620,3626 **** ;; arm*-*-uclinux*) # ARM ucLinux tm_file=arm/uclinux-elf.h ! tmake_file=arm/t-arm-elf ;; arm*-*-aout) tm_file=arm/aout.h --- 3620,3627 ---- ;; arm*-*-uclinux*) # ARM ucLinux tm_file=arm/uclinux-elf.h ! tmake_file=arm/t-arm-uclinux ! extra_parts="crtbegin.o crtbeginS.o crtend.o crtendS.o" ;; arm*-*-aout) tm_file=arm/aout.h Index: gcc/config/arm/arm.c =================================================================== RCS file: /cvs/gcc/egcs/gcc/config/arm/arm.c,v retrieving revision 1.74 diff -c -r1.74 arm.c *** arm.c 1999/12/14 19:42:58 1.74 --- arm.c 2000/01/07 13:02:17 *************** *** 288,294 **** arm_override_options () { unsigned i; ! /* Set up the flags based on the cpu/architecture selected by the user. */ for (i = sizeof (arm_select) / sizeof (arm_select[0]); i--;) { --- 288,299 ---- arm_override_options () { unsigned i; ! ! #ifdef ARM_SUBTARGET_OVERRIDE_OPTIONS ! ! ARM_SUBTARGET_OVERRIDE_OPTIONS ; ! ! #endif /* Set up the flags based on the cpu/architecture selected by the user. */ for (i = sizeof (arm_select) / sizeof (arm_select[0]); i--;) { *************** *** 1525,1534 **** emit_insn (gen_pic_load_addr (address, orig)); ! pic_ref = gen_rtx_MEM (Pmode, ! gen_rtx_PLUS (Pmode, pic_offset_table_rtx, ! address)); ! RTX_UNCHANGING_P (pic_ref) = 1; insn = emit_move_insn (reg, pic_ref); #endif current_function_uses_pic_offset_table = 1; --- 1530,1544 ---- emit_insn (gen_pic_load_addr (address, orig)); ! pic_ref = gen_rtx_PLUS (Pmode, pic_offset_table_rtx, ! address); ! ! if (NEED_GOT_RELOC) ! { ! pic_ref = gen_rtx_MEM (Pmode, pic_ref); ! RTX_UNCHANGING_P (pic_ref) = 1; ! } ! insn = emit_move_insn (reg, pic_ref); #endif current_function_uses_pic_offset_table = 1; *************** *** 6041,6047 **** if (regs_ever_live[reg] && ! call_used_regs[reg]) live_regs_mask |= 1 << reg; ! if (flag_pic && regs_ever_live[PIC_OFFSET_TABLE_REGNUM]) live_regs_mask |= 1 << PIC_OFFSET_TABLE_REGNUM; if (regs_ever_live[LR_REGNUM]) --- 6051,6058 ---- if (regs_ever_live[reg] && ! call_used_regs[reg]) live_regs_mask |= 1 << reg; ! if (flag_pic && ! TARGET_SINGLE_PIC_BASE ! && regs_ever_live[PIC_OFFSET_TABLE_REGNUM]) live_regs_mask |= 1 << PIC_OFFSET_TABLE_REGNUM; if (regs_ever_live[LR_REGNUM]) Index: gcc/config/arm/arm.h =================================================================== RCS file: /cvs/gcc/egcs/gcc/config/arm/arm.h,v retrieving revision 1.56 diff -c -r1.56 arm.h *** arm.h 1999/12/14 19:42:58 1.56 --- arm.h 2000/01/07 13:02:18 *************** *** 318,323 **** --- 318,327 ---- /* Nonzero if all call instructions should be indirect. */ #define ARM_FLAG_LONG_CALLS (1 << 15) + /* last used bit in target_flags */ + #define ARM_FLAG_LAST_USED_BIT 15 + + #define TARGET_APCS (target_flags & ARM_FLAG_APCS_FRAME) #define TARGET_POKE_FUNCTION_NAME (target_flags & ARM_FLAG_POKE) #define TARGET_FPE (target_flags & ARM_FLAG_FPE) *************** *** 335,341 **** #define TARGET_ABORT_NORETURN (target_flags & ARM_FLAG_ABORT_NORETURN) #define TARGET_SINGLE_PIC_BASE (target_flags & ARM_FLAG_SINGLE_PIC_BASE) #define TARGET_LONG_CALLS (target_flags & ARM_FLAG_LONG_CALLS) ! /* SUBTARGET_SWITCHES is used to add flags on a per-config basis. Bit 31 is reserved. See riscix.h. */ #ifndef SUBTARGET_SWITCHES --- 339,345 ---- #define TARGET_ABORT_NORETURN (target_flags & ARM_FLAG_ABORT_NORETURN) #define TARGET_SINGLE_PIC_BASE (target_flags & ARM_FLAG_SINGLE_PIC_BASE) #define TARGET_LONG_CALLS (target_flags & ARM_FLAG_LONG_CALLS) ! /* SUBTARGET_SWITCHES is used to add flags on a per-config basis. Bit 31 is reserved. See riscix.h. */ #ifndef SUBTARGET_SWITCHES Index: gcc/config/arm/uclinux-elf.h =================================================================== RCS file: /cvs/gcc/egcs/gcc/config/arm/uclinux-elf.h,v retrieving revision 1.3 diff -c -r1.3 uclinux-elf.h *** uclinux-elf.h 1999/12/18 13:34:21 1.3 --- uclinux-elf.h 2000/01/07 13:02:18 *************** *** 1,7 **** /* Definitions for ARM running ucLinux using ELF Copyright (C) 1999 Free Software Foundation, Inc. Contributed by Philip Blundell <pb@nexus.co.uk> ! This file is part of GNU CC. GNU CC is free software; you can redistribute it and/or modify --- 1,8 ---- /* Definitions for ARM running ucLinux using ELF Copyright (C) 1999 Free Software Foundation, Inc. Contributed by Philip Blundell <pb@nexus.co.uk> ! Modified by Vadim Lebedev <vlebedev@aplio.fr> ! This file is part of GNU CC. GNU CC is free software; you can redistribute it and/or modify *************** *** 21,32 **** #include "arm/linux-elf.h" /* We don't want a PLT. */ #undef NEED_PLT_RELOC #define NEED_PLT_RELOC 0 #undef TARGET_VERSION #define TARGET_VERSION fputs (" (ARM/ELF ucLinux)", stderr); #undef TARGET_DEFAULT ! #define TARGET_DEFAULT (ARM_FLAG_APCS_32 | ARM_FLAG_MMU_TRAPS | ARM_FLAG_SINGLE_PIC_BASE) --- 22,50 ---- #include "arm/linux-elf.h" + #define ARM_FLAG_NO_GOT (1 << (ARM_FLAG_LAST_USED_BIT+1)) + #define TARGET_NO_GOT (target_flags & ARM_FLAG_NO_GOT) + + #undef SUBTARGET_SWITCHES + #define SUBTARGET_SWITCHES \ + {"got", -ARM_FLAG_NO_GOT, ""}, \ + {"no-got", ARM_FLAG_NO_GOT, \ + "Do not use GOT relocations" }, \ + + /* -mno-got will force -fPIC -msingle-pic-base */ + #define ARM_SUBTARGET_OVERRIDE_OPTIONS if (TARGET_NO_GOT) { flag_pic = 2; target_flags |= ARM_FLAG_SINGLE_PIC_BASE; } + /* We don't want a PLT. */ #undef NEED_PLT_RELOC #define NEED_PLT_RELOC 0 + #undef NEED_GOT_RELOC + #define NEED_GOT_RELOC (flag_pic && !TARGET_NO_GOT) + + #undef TARGET_VERSION #define TARGET_VERSION fputs (" (ARM/ELF ucLinux)", stderr); #undef TARGET_DEFAULT ! #define TARGET_DEFAULT (ARM_FLAG_APCS_32 | ARM_FLAG_MMU_TRAPS ) !
------ Want more information? See the CrossGCC FAQ, http://www.objsw.com/CrossGCC/ Want to unsubscribe? Send a note to crossgcc-unsubscribe@sourceware.cygnus.com
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |