1 |
On Fri, 16 Jun 2006 15:30:06 -0400 |
2 |
Mike Frysinger <vapier@g.o> wrote: |
3 |
|
4 |
> On Friday 16 June 2006 15:10, Sven Köhler wrote: |
5 |
> > some software, like qemu and others, are simply not compatible with |
6 |
> > gcc 4.x and they will not become compatible due to severe |
7 |
> > conceptional issues. |
8 |
> |
9 |
> then they stay broken ... add a warning to the ebuild if |
10 |
> `gcc-major-version` is "4" (see toolchain-funcs.eclass) |
11 |
|
12 |
I've been thinking about this recently. What qemu does is compile a C |
13 |
implementation of the target processor's instruction set into an object |
14 |
file when qemu is built, then at run-time (JIT time) it cut-n-pastes |
15 |
bits of that object file when it "compiles" the target executable into |
16 |
native code that can be executed directly in the emulator. This is |
17 |
pretty cool, as it means you have a cross-platform target emulator that |
18 |
is fast because it leverages the compiler to write the emulation code, |
19 |
without having to maintain separate implementations for each target. |
20 |
|
21 |
However it does rely on the ability to snip the function |
22 |
prologue/epilogue reliably so you can stitch stuff together (in |
23 |
particular the return instruction is eliminated), and with gcc-4 this is |
24 |
no longer possible because the return is not always and only at the end |
25 |
of the function. I think the change to gcc that causes this is one of |
26 |
the reasons the major revision number was increased. |
27 |
|
28 |
The reason for describing this is to illustrate that qemu is not |
29 |
"broken" as such; it just relies on implementation detail of the pre-4 |
30 |
gcc series. Since gcc-4 doesn't provide any option to force code |
31 |
generation to fit the requirements of qemu, the compilation of the |
32 |
affected code must use gcc-3 (which it does with a very specific set |
33 |
of CFLAGS). Note; the majority of qemu can be compiled with gcc-4 just |
34 |
fine, however the target implementation objects have to be built with |
35 |
gcc-3 because gcc-4 does not provide an option to get the old gcc-3 |
36 |
behaviour. |
37 |
|
38 |
Since we already have slotted gcc working just fine, it seems |
39 |
reasonable to me that we could support packages requiring the existence |
40 |
of more than one compiler version (although I'm not sure portage |
41 |
DEPENDs will cope - I'm guessing: |
42 |
|
43 |
DEPEND="<sys-devel/gcc-4 |
44 |
>=sys-devel/gcc-4" |
45 |
|
46 |
won't be interpreted to mean both a pre-4 and a post-4 compiler are |
47 |
required). |
48 |
|
49 |
Portage DEPENDs aside, it would be relatively easy to provide a |
50 |
function to return the latest 3-series compiler. We already have |
51 |
symlinks installed in /usr/bin (e.g. i686-pc-linux-gnu-gcc-3.4.6) - |
52 |
caveat that they don't use the wrapper, although that may not matter. |
53 |
|
54 |
Absent the DEPEND functionality, we can still go quite a way just by |
55 |
supplying a suitable function or functions in toolchain-funcs.eclass. |
56 |
The affected packages can use them in pkg_setup to check for existence |
57 |
and abort if they're not available without requiring the user to change |
58 |
the system default compiler. The only loss is that the user doesn't |
59 |
find out about the missing dependency until the package is actually |
60 |
merged, rather than at the beginning of an 'emerge world'. |
61 |
|
62 |
|
63 |
Perhaps details should be taken off-list, if we're to think about this |
64 |
seriously. |
65 |
|
66 |
-- |
67 |
Kevin F. Quinn |