Can I run an application compiled with gcc ABI 2.95 on a kernel compiled with gcc ABI 3.4?
Hello all
We have a target system with an old Linux environment that we can not easily upgrade to a new one.
The actual development system (linux) has more or less the same age (prox. 10 year)
We intend to do the following:
- Use a new distribution as development environment (linux)
- Still compile the target application for the old system (2.2 and 2.4 kernels, once all compiled with egcs 2.91.66)
- Test the target applications in the new development environment
Questions:
- Can I run an application compiled with gcc ABI 2.95 on a kernel compiled with gcc ABI 3.4?
- In other words: does it matter if the gcc ABI of the compilers for the kernel and the application are different, assuming all the libraries used, have the same gcc ABI as the application?
I guess:
- gcc ABI of librabies and applications compilation must generally match
- gcc ABI of kernel, libraries and applications compilation must generally match to.
Am I wrong?
I would appreciate any help
Roman
Signature · 1 line
Neu: GMX FreeDSL Komplettanschluss mit DSL 6.000 Flatrate + Telefonanschluss für nur 17,95 Euro/mtl.!* http://dslspecial.gmx.de/freedsl-surfflat/?ac=OM.AD.PD003K11308T4569a
Quoted 3 lines · On Fri, 2009-05-15 at 13:50 +0200, [email protected] wrote:
Questions:
- Can I run an application compiled with gcc ABI 2.95 on a kernel compiled with gcc ABI 3.4?
Yes. The kernel ABI never changes in a backward-incompatible fashion. Unless you try switching your kernel to ARM EABI and don't update userspace to match -- don't do that :)
Unless you're using C++, you're more likely to have problems with different versions of libraries, and buggy code which doesn't compile correctly with the new compiler, than you are with GCC ABI variations per se. Especially in the kernel<->userspace interface.
Signature · 2 lines
David Woodhouse Open Source Technology Centre [email protected] Intel Corporation
Quoted 8 lines · David Woodhouse
Quoted 3 lines · On Fri, 2009-05-15 at 13:50 +0200, [email protected] wrote:
Questions:
- Can I run an application compiled with gcc ABI 2.95 on a kernel compiled with gcc ABI 3.4?Yes. The kernel ABI never changes in a backward-incompatible fashion. Unless you try switching your kernel to ARM EABI and don't update userspace to match -- don't do that :)
Eek, can you say a bit more about the ARM EABI mismatch?
I would like to run a shiny modern ARM EABI kernel and userspace, but also need to run one or two OABI binaries (from the gcc 2.95 era) on the same kernel which I cannot recompile because they're built with closed source libraries only supplied as OABI.
Does that not work at all?
If it does work, which part of userspace must be EABI to work?
Thanks,
-- Jamie
Quoted 10 lines · Jamie Lokier
Quoted 8 lines · David Woodhouse
Quoted 3 lines · On Fri, 2009-05-15 at 13:50 +0200, [email protected] wrote:
Questions:
- Can I run an application compiled with gcc ABI 2.95 on a kernel compiled with gcc ABI 3.4?Yes. The kernel ABI never changes in a backward-incompatible fashion. Unless you try switching your kernel to ARM EABI and don't update userspace to match -- don't do that :)
Quoted 8 lines
Eek, can you say a bit more about the ARM EABI mismatch?
I would like to run a shiny modern ARM EABI kernel and userspace, but also need to run one or two OABI binaries (from the gcc 2.95 era) on the same kernel which I cannot recompile because they're built with closed source libraries only supplied as OABI.
Does that not work at all?
There are a few ioctl() incompatibilities between the two ABIs, the main problems are within the ALSA API. Mostly it will work, but there are a couple of caveats.
Signature · 4 lines
Ben Q: What's a light-year? A: One-third less calories than a regular year.
Hi,
Quoted 8 lines · Ben Dooks
Quoted 7 lines · Jamie Lokier
Eek, can you say a bit more about the ARM EABI mismatch?
I would like to run a shiny modern ARM EABI kernel and userspace, but also need to run one or two OABI binaries (from the gcc 2.95 era) on the same kernel which I cannot recompile because they're built with closed source libraries only supplied as OABI.
Quoted 5 lines
Quoted 1 line
Does that not work at all?
There are a few
ioctl()incompatibilities between the two ABIs, the main problems are within the ALSA API. Mostly it will work, but there are a couple of caveats.
Right, you can run ARM OABI binaries on an ARM eABI kernel by enabling OABI_COMPAT. However, as Ben notes, there are (more than, IMNSHO ; ) "a couple of caveats". Most of the "easy" ABI compatibility fixups should be handled already via OABI_COMPAT. However, it's practically impossible to fixup all OABI/eABI compatibility issues due to register assignment, parameter alignment and/or packing differences between the two ABIs. You would have to analyze all kernel and driver user interfaces to reassign parameters to registers, align and/or repack data structures, etc.,. In fact, some of the existing fixups include side effects that in some cases can cause userspace code to fail, depending on how it is using I/O parameters, e.g. in some cases, library code may try to validate parameters which are relocated and those tests fail due to reshuffling of parameters. It's a nasty path to go down, quite frankly. I would not recommend trying to support OABI binaries on an eABI kernel using OABI_COMPAT.
--
Regards,
George
Quoted 11 lines
Signature · 10 lines
-- Ben Q: What's a light-year? A: One-third less calories than a regular year. -- To unsubscribe from this list: send the line "unsubscribe linux-embedded" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 15 lines · George G. Davis
Quoted 8 lines · Ben Dooks
Quoted 7 lines · Jamie Lokier
Eek, can you say a bit more about the ARM EABI mismatch?
I would like to run a shiny modern ARM EABI kernel and userspace, but also need to run one or two OABI binaries (from the gcc 2.95 era) on the same kernel which I cannot recompile because they're built with closed source libraries only supplied as OABI.
Quoted 5 lines
Quoted 1 line
Does that not work at all?
There are a few
ioctl()incompatibilities between the two ABIs, the main problems are within the ALSA API. Mostly it will work, but there are a couple of caveats.
Quoted 15 lines
Right, you can run ARM OABI binaries on an ARM eABI kernel by enabling
OABI_COMPAT. However, as Ben notes, there are (more than, IMNSHO ; ) "a couple of caveats". Most of the "easy" ABI compatibility fixups should be handled already viaOABI_COMPAT. However, it's practically impossible to fixup all OABI/eABI compatibility issues due to register assignment, parameter alignment and/or packing differences between the two ABIs. You would have to analyze all kernel and driver user interfaces to reassign parameters to registers, align and/or repack data structures, etc.,. In fact, some of the existing fixups include side effects that in some cases can cause userspace code to fail, depending on how it is using I/O parameters, e.g. in some cases, library code may try to validate parameters which are relocated and those tests fail due to reshuffling of parameters. It's a nasty path to go down, quite frankly. I would not recommend trying to support OABI binaries on an eABI kernel usingOABI_COMPAT.
Structure packing: Isn't that basically the same set of fixups that need to be done for 32-bit compatibility on 64-bit kernels? Could it even use the same code - sneakily replacing "32" with OABI and "64" with EABI?
Register/parameter assignment: How is that relevant to the kernel interface, if the kernel itself and modules are all EABI? The system call interface is a fixed set of registers.
It sounds like you're saying I should use OABI kernels and userspace even with latest kernels, if I have a single OABI binary that might use anything interesting from the kernel, like readdir, poll, signal context, ioctl, device read/write, or any other system calls which take a struct that isn't all 32-bit words.
-- Jamie
Quoted 4 lines · Jamie Lokier
Structure packing: Isn't that basically the same set of fixups that need to be done for 32-bit compatibility on 64-bit kernels? Could it even use the same code - sneakily replacing "32" with OABI and "64" with EABI?
On second thoughts, I guess there may be a few fixups in common but not much.
-- Jamie
Quoted 3 lines · Jamie Lokier
Register/parameter assignment: How is that relevant to the kernel interface, if the kernel itself and modules are all EABI? The system call interface is a fixed set of registers.
No it is not. The syscall interface obeys the ABI register allocation rules as well, otherwise we have to have veneeer layers to reshuffle the registers prior to calling C functions.
Quoted 11 lines · Jamie Lokier
Eek, can you say a bit more about the ARM EABI mismatch?
I would like to run a shiny modern ARM EABI kernel and userspace, but also need to run one or two OABI binaries (from the gcc 2.95 era) on the same kernel which I cannot recompile because they're built with closed source libraries only supplied as OABI.
Does that not work at all?
If it does work, which part of userspace must be EABI to work?
It was just a note of caution that sometimes we _do_ change the ABI.
I'm not 100% sure offhand whether the EABI kernel can support OABI userspace; I didn't think so though.
Signature · 1 line
dwmw2
Quoted 6 lines · David Woodhouse
It was just a note of caution that sometimes we _do_ change the ABI.
I'm not 100% sure offhand whether the EABI kernel can support OABI userspace; I didn't think so though.
He could try CONFIG_OABI_COMPAT=y, at least in 2.6.28+. No thumb though.
Regards.
-------------------------------------------------------------------
List admin: http://lists.arm.linux.org.uk/mailman/listinfo/linux-arm-kernel FAQ: http://www.arm.linux.org.uk/mailinglists/faq.php Etiquette: http://www.arm.linux.org.uk/mailinglists/etiquette.php
Quoted 9 lines · David Woodhouse
Quoted 8 lines · Jamie Lokier
Eek, can you say a bit more about the ARM EABI mismatch?
I would like to run a shiny modern ARM EABI kernel and userspace, but also need to run one or two OABI binaries (from the gcc 2.95 era) on the same kernel which I cannot recompile because they're built with closed source libraries only supplied as OABI.
Quoted 8 lines
Quoted 3 lines
Does that not work at all?
If it does work, which part of userspace must be EABI to work?
It was just a note of caution that sometimes we _do_ change the ABI.
I'm not 100% sure offhand whether the EABI kernel can support OABI userspace; I didn't think so though.
Yes it can, for basic stuff. That means basic system calls with issues are fixed up when necessary. This does not include things like ioctls though, and in this case your mileage may vary. Notably, ALSA is known to fail, some features of iptables too. See documentation at the top of arch/arm/kernel/sys_oabi-compat.c to get an idea of what to watch for.
It is also possible to extend on what is already there for specific needs that are not covered by the current set of fixups (and contribute it back). But complete coverage is almost impossible to achieve and pointless.
Nicolas