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

See crosstool-NG for lots more information.


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: [PATCH] kernel/linux: change arch tuple to use -uclinux for uclinux toolchains


Mike Frysinger <vapier@gentoo.org> writes:

> On Tuesday 25 September 2012 14:18:38 Esben Haabendal wrote:
>> Mike Frysinger <vapier@gentoo.org> writes:
>> > On Tuesday 25 September 2012 12:41:42 Yann E. MORIN wrote:
>> >> Basically, 'bfin-elf' is for bare-metal, 'bfin-uclinux' if for
>> >> flat-binaries with no shared libs, and 'bfin-linux' for FDPIC-ELF that
>> >> allows shared libs.
>> > 
>> > correct, the current convention is that "-uclinux" is for FLAT
>> > targets.
>> 
>> Ok, but where does this convention come from.  Or rather, who follows
>> this convention?
>> 
>> It does not generally seem to be the convention used in GCC, at least
>> not for all archs.
>> 
>> If linux-gnu is linux with glibc, linux-uclibc is uClinux/FDPIC-ELF with
>> uClibc, and uclinux-uclibc is uClinux/FLAT with uClibc.
>
> uClibc supports multiple file formats (including FDPIC-ELF and FLAT).
> if you see a toolchain end in "-uclinux" or "-uclibc*", you're pretty
> much guaranteed to be using uClibc.

Yes.

> further, pretty much every target i've seen so far that ends in -uclinux was 
> targeting the FLAT file format.

You seem to miss the point I am making here. This is not true for
m68k/coldfire.  You must use *-*-uclinux-* to configure gcc for the
non-mmu m68k/cf cpus.

> for Blackfin targets, we wanted a new tuple when using FDPIC-ELF, so
> we went with linux-uclibc rather than uclinux.  after all, when you're
> running Linux with the ELF format, the fact that you lack a MMU is
> largely transparent to userland (ignoring lack of fork).

Yes, I see that.  But...

>> What arch tuple should then be used for linux with uClibc?  I don't see the
>> benefit of not being able to tell it apart from uClinux/FDPIC-ELF with
>> uClibc.
>
> i don't understand the question.  "uclinux" means you're running Linux with 
> uClibc, as does "linux-uclibc".

I dare to say "no".  With *-*-uclinux-* you are saying you are running
Linux without mmu.  With *-*-linux-uclibc or *-*-uclinux-uclibc you are
saying you are running Linux with uClibc.

With some m68k cpus, you are able to use either Linux with glibc, Linux
(with mmu) with uClibc, or Linux (without mmu, uCLinux) with uClibc.  It
would be rather handy to be able to use different arch tuples for all 3
cases.

>
>> --------
>> m68k-*-uclinuxoldabi*)          # Motorola m68k/ColdFire running uClinux
>>                                 # with uClibc, using the original
>>                                 # m68k-elf-based ABI
>>         default_m68k_cpu=68020
>>         default_cf_cpu=5206
>>         tm_file="${tm_file} m68k/m68k-none.h m68k/m68kelf.h dbxelf.h
>> elfos.h m68k/uclinux-oldabi.h glibc-stdint.h" tm_defines="${tm_defines}
>> MOTOROLA=1"
>>         tmake_file="m68k/t-floatlib m68k/t-uclinux"
>>         ;;
>> m68k-*-uclinux*)                # Motorola m68k/ColdFire running uClinux
>>                                 # with uClibc, using the new
>> GNU/Linux-style # ABI.
>>         default_m68k_cpu=68020
>>         default_cf_cpu=5206
>>         tm_file="${tm_file} dbxelf.h elfos.h svr4.h linux.h glibc-stdint.h
>> flat.h m68k/linux.h m68k/uclinux.h ./sysroot-suffix.h"
>> tm_defines="${tm_defines} MOTOROLA=1 UCLIBC_DEFAULT=1"
>>         extra_options="${extra_options} linux.opt"
>>         tmake_file="m68k/t-floatlib m68k/t-uclinux m68k/t-mlibs"
>>         ;;
>> m68k-*-linux*)          # Motorola m68k's running GNU/Linux
>>                                 # with ELF format using glibc 2
>>                                 # aka the GNU/Linux C library 6.
>>         default_m68k_cpu=68020
>>         default_cf_cpu=5475
>>         with_arch=${with_arch:-m68k}
>>         tm_file="${tm_file} dbxelf.h elfos.h svr4.h linux.h glibc-stdint.h
>> m68k/linux.h ./sysroot-suffix.h" extra_options="${extra_options}
>> m68k/ieee.opt"
>>         tm_defines="${tm_defines} MOTOROLA=1"
>>         tmake_file="${tmake_file} m68k/t-floatlib m68k/t-linux
>> m68k/t-mlibs" # if not configured with --enable-sjlj-exceptions, bump the
>> # libgcc version number
>>         if test x$sjlj != x1; then
>>             tmake_file="$tmake_file m68k/t-slibgcc-elf-ver"
>>         fi
>>         ;;
>> --------
>> 
>> I guess that mean that at least for m68k, the convention you mention is
>> not shared with GCC.
>
> m68k doesn't support FDPIC-ELF.  i don't know what you're trying to
> show.

I am not just trying to show something, I am trying to build a working
uclinux toolchain for coldfire.  It doesn't really matter for that, that
FDPIC-ELF is not supported, as the problem is here for FLAT.

>> When building an m68k cross gcc, using *-*-linux-* will filter out any
>> target devices that does not have the FL_MMU flag set (in
>> gcc/config/m68k/m68k-devices.def).  When building with *-*-uclinux-*,
>> only those devices without FL_MMU flag set, or with FL_UCLINUX flag set
>> will be available.
>> 
>> As such, the convention does not work for m68k.
>> 
>> As for my current needs, this can be made conditional for m68k.
>> 
>> That said, I don't think the convention is the most sane one, as it
>> would be best to have "linux-uclibc" mean the same thing independent of
>> the cpu prefix, and also in line with the principle of least surprise,
>> it would make sense to use "uclinux-*" for uclinux archs :-)
>
> looks to me like gcc only uses the FL_{MMU,UCLINUX} flags to figure
> out whether to build FLAT shared libraries.

No, gcc uses these flags combined with the arch tuples to sort out which
cpu's that are available (for --with-cpu and -mcpu).  Using linux-uclibc
results in only having the FL_MMU cpus available.

> so if you want those things, use m68k- uclinux.

Exactly :-)

I will rework the patch to set CT_TARGET_KERNEL depending on both
CT_ARCH_USE_MMU and CT_ARCH.  So "linux" for bfin and "uclinux" for
m68k.

/Esben

--
For unsubscribe information see http://sourceware.org/lists.html#faq


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