Gentoo Archives: gentoo-alt

From: Michael Weiser <michael@×××××××××××××××.net>
To: gentoo-alt@l.g.o
Subject: Re: [gentoo-alt] ld wrapper and cross-binutils
Date: Mon, 04 Apr 2016 18:00:33
Message-Id: 20160404174602.GA23544@weiser.dinsnail.net
In Reply to: Re: [gentoo-alt] ld wrapper and cross-binutils by Michael Weiser
1 Hi Fabian,
2
3 On Sun, Apr 03, 2016 at 08:14:38PM +0200, Michael Weiser wrote:
4
5 > > Care to share your patch so I can
6 > > look at merging it?
7 > It's attached. If you prefer (or the patch gets dropped by the list
8 > manager) I can open a bug for it as well.
9
10 I now have (seemingly) working stage1 cross-compilers for powerpc, armeb
11 and armel as well as a stage4 toolchain for avr. Yay! Getting glibc to
12 compile on OS X will be a bit more work, it seems. ;)
13
14 Regarding ldwrapper.c it turns out, that detecting CTARGET from a call
15 like CTARGET-ld isn't actually required for the cross compiler to work.
16 Instead, collect2 calls ld as EPREFIX/usr/libexec/gcc/CTARGET/ld. The
17 attached updated patch recognises such calls as well but doesn't get
18 prettier in the process.
19
20 Also, I hit some corner cases and actual bugs:
21
22 - all gcc ebuilds in Prefix are restricted to
23
24 KEYWORDS="~amd64-linux ~x86-linux"
25
26 crossdev defaults to "cross-CTARGET/gcc TARCH ~TARCH" in
27 package.keywords which will not give me any gcc. So I have to give an
28 explicit version to crossdev using --gcc 5.3.0 in order to get
29 "cross-CTARGET/gcc * ~* **" and thus the requested i.e. most current
30 gcc.
31
32 - kernel_Darwin makes the gcc ebuild require binutils-apple. Adding
33 package.use.force and package.mask.force as follows works around that:
34
35 EPREFIX/etc/portage/profile/package.use.force/system:
36 cross-armv5b-softfloat-linux-gnueabi/gcc -kernel_Darwin -elibc_Darwin kernel_linux elibc_glibc
37
38 EPREFIX/etc/portage/profile/package.use.mask/system:
39 cross-armv5teb-softfloat-linux-gnueabi/gcc -kernel_linux -elibc_glibc kernel_Darwin elibc_Darwin
40
41 - clang needs -fbracket-depth=1024 to compile arm*-gcc. Otherwise I
42 hit https://llvm.org/bugs/show_bug.cgi?id=19650.
43 o GCC nowadays compiles its C source with CXX. For stage1 of gcc that is
44 clang++ (on OS X) and uses the value of CXXFLAGS. But toolchain.eclass does
45 not support injecting CXXFLAGS from an ebuild.
46 o I found a way using an obscure environment variable named
47 CFLAGS_"${CTARGET//-/_}. So I can do
48 CFLAGS_armv5teb_softfloat_linux_gnueabi=-fbracket-depth=1024 crossdev
49 ... to get what I need.
50 o Patching clang to raise the bracket depth default as suggested in the
51 upstream bug would be another option.
52 o ... or install gcc for OS X native first and compile the cross-gccs
53 with that
54
55 - with binutils < 2.26 I hit
56 https://sourceware.org/bugzilla/show_bug.cgi?id=19222. Updating to 2.26.
57 solves it.
58
59 - with gmp < 6.1.0 I hit
60 https://github.com/hashdist/hashstack/issues/727. Updating to 6.1.0
61 solves it.
62
63 - avr-gcc doesn't pass -mmcu= flags on to the assembler. Compiling with
64 USE="vanilla" solves that. So it seems there's some patch in the Gentoo
65 patchset breaking it.
66
67 I hope this is of help to anyone and would appreciate any pointers on
68 how to properly solve any of the above problems.
69 --
70 bye, Michael

Attachments

File name MIME type
ldwrapper-ctarget-2.diff text/plain