linux-embedded.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Can I run an application compiled with gcc ABI 2.95 on a kernel compiled with gcc ABI 3.4?
@ 2009-05-15 11:50 muzungu
  2009-05-15 12:31 ` David Woodhouse
  0 siblings, 1 reply; 11+ messages in thread
From: muzungu @ 2009-05-15 11:50 UTC (permalink / raw)
  To: linux-embedded

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
-- 
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

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Can I run an application compiled with gcc ABI 2.95 on a kernel compiled with gcc ABI 3.4?
  2009-05-15 11:50 Can I run an application compiled with gcc ABI 2.95 on a kernel compiled with gcc ABI 3.4? muzungu
@ 2009-05-15 12:31 ` David Woodhouse
  2009-05-15 13:51   ` Jamie Lokier
  0 siblings, 1 reply; 11+ messages in thread
From: David Woodhouse @ 2009-05-15 12:31 UTC (permalink / raw)
  To: muzungu; +Cc: linux-embedded

On Fri, 2009-05-15 at 13:50 +0200, muzungu@gmx.net 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.

-- 
David Woodhouse                            Open Source Technology Centre
David.Woodhouse@intel.com                              Intel Corporation

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Can I run an application compiled with gcc ABI 2.95 on a kernel compiled with gcc ABI 3.4?
  2009-05-15 12:31 ` David Woodhouse
@ 2009-05-15 13:51   ` Jamie Lokier
  2009-05-15 13:55     ` Ben Dooks
  2009-05-15 13:56     ` David Woodhouse
  0 siblings, 2 replies; 11+ messages in thread
From: Jamie Lokier @ 2009-05-15 13:51 UTC (permalink / raw)
  To: David Woodhouse; +Cc: muzungu, linux-embedded, linux-arm-kernel

David Woodhouse wrote:
> On Fri, 2009-05-15 at 13:50 +0200, muzungu@gmx.net 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

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Can I run an application compiled with gcc ABI 2.95 on a kernel compiled with gcc ABI 3.4?
  2009-05-15 13:51   ` Jamie Lokier
@ 2009-05-15 13:55     ` Ben Dooks
  2009-05-15 14:32       ` George G. Davis
  2009-05-15 13:56     ` David Woodhouse
  1 sibling, 1 reply; 11+ messages in thread
From: Ben Dooks @ 2009-05-15 13:55 UTC (permalink / raw)
  To: Jamie Lokier; +Cc: David Woodhouse, muzungu, linux-embedded, linux-arm-kernel

On Fri, May 15, 2009 at 02:51:05PM +0100, Jamie Lokier wrote:
> David Woodhouse wrote:
> > On Fri, 2009-05-15 at 13:50 +0200, muzungu@gmx.net 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?

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.

-- 
Ben

Q:      What's a light-year?
A:      One-third less calories than a regular year.

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Can I run an application compiled with gcc ABI 2.95 on a kernel compiled with gcc ABI 3.4?
  2009-05-15 13:51   ` Jamie Lokier
  2009-05-15 13:55     ` Ben Dooks
@ 2009-05-15 13:56     ` David Woodhouse
  2009-05-15 14:03       ` Gustavo Zacarias
  2009-05-15 16:31       ` Nicolas Pitre
  1 sibling, 2 replies; 11+ messages in thread
From: David Woodhouse @ 2009-05-15 13:56 UTC (permalink / raw)
  To: Jamie Lokier; +Cc: muzungu, linux-embedded, linux-arm-kernel

On Fri, 2009-05-15 at 14:51 +0100, Jamie Lokier wrote:
> 
> 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.

-- 
dwmw2

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Can I run an application compiled with gcc ABI 2.95 on a kernel compiled with gcc ABI 3.4?
  2009-05-15 13:56     ` David Woodhouse
@ 2009-05-15 14:03       ` Gustavo Zacarias
  2009-05-15 16:31       ` Nicolas Pitre
  1 sibling, 0 replies; 11+ messages in thread
From: Gustavo Zacarias @ 2009-05-15 14:03 UTC (permalink / raw)
  To: David Woodhouse; +Cc: Jamie Lokier, muzungu, linux-embedded, linux-arm-kernel

David Woodhouse wrote:

> 
> 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

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Can I run an application compiled with gcc ABI 2.95 on a kernel compiled with gcc ABI 3.4?
  2009-05-15 13:55     ` Ben Dooks
@ 2009-05-15 14:32       ` George G. Davis
  2009-05-15 14:54         ` Jamie Lokier
  0 siblings, 1 reply; 11+ messages in thread
From: George G. Davis @ 2009-05-15 14:32 UTC (permalink / raw)
  To: Ben Dooks
  Cc: Jamie Lokier, David Woodhouse, muzungu, linux-embedded,
	linux-arm-kernel

Hi,

On Fri, May 15, 2009 at 02:55:57PM +0100, Ben Dooks wrote:
> On Fri, May 15, 2009 at 02:51:05PM +0100, Jamie Lokier wrote:
> > 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.

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

> 
> -- 
> 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 majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Can I run an application compiled with gcc ABI 2.95 on a kernel compiled with gcc ABI 3.4?
  2009-05-15 14:32       ` George G. Davis
@ 2009-05-15 14:54         ` Jamie Lokier
  2009-05-15 14:56           ` Jamie Lokier
  2009-05-15 21:42           ` Russell King - ARM Linux
  0 siblings, 2 replies; 11+ messages in thread
From: Jamie Lokier @ 2009-05-15 14:54 UTC (permalink / raw)
  To: George G. Davis
  Cc: Ben Dooks, David Woodhouse, muzungu, linux-embedded,
	linux-arm-kernel

George G. Davis wrote:
> On Fri, May 15, 2009 at 02:55:57PM +0100, Ben Dooks wrote:
> > On Fri, May 15, 2009 at 02:51:05PM +0100, Jamie Lokier wrote:
> > > 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.
> 
> 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.

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

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Can I run an application compiled with gcc ABI 2.95 on a kernel compiled with gcc ABI 3.4?
  2009-05-15 14:54         ` Jamie Lokier
@ 2009-05-15 14:56           ` Jamie Lokier
  2009-05-15 21:42           ` Russell King - ARM Linux
  1 sibling, 0 replies; 11+ messages in thread
From: Jamie Lokier @ 2009-05-15 14:56 UTC (permalink / raw)
  To: George G. Davis
  Cc: Ben Dooks, David Woodhouse, muzungu, linux-embedded,
	linux-arm-kernel

Jamie Lokier wrote:
> 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

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Can I run an application compiled with gcc ABI 2.95 on a kernel compiled with gcc ABI 3.4?
  2009-05-15 13:56     ` David Woodhouse
  2009-05-15 14:03       ` Gustavo Zacarias
@ 2009-05-15 16:31       ` Nicolas Pitre
  1 sibling, 0 replies; 11+ messages in thread
From: Nicolas Pitre @ 2009-05-15 16:31 UTC (permalink / raw)
  To: David Woodhouse; +Cc: Jamie Lokier, muzungu, linux-embedded, linux-arm-kernel

On Fri, 15 May 2009, David Woodhouse wrote:

> On Fri, 2009-05-15 at 14:51 +0100, Jamie Lokier wrote:
> > 
> > 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.

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

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Can I run an application compiled with gcc ABI 2.95 on a kernel compiled with gcc ABI 3.4?
  2009-05-15 14:54         ` Jamie Lokier
  2009-05-15 14:56           ` Jamie Lokier
@ 2009-05-15 21:42           ` Russell King - ARM Linux
  1 sibling, 0 replies; 11+ messages in thread
From: Russell King - ARM Linux @ 2009-05-15 21:42 UTC (permalink / raw)
  To: Jamie Lokier
  Cc: George G. Davis, Ben Dooks, David Woodhouse, muzungu,
	linux-embedded, linux-arm-kernel

On Fri, May 15, 2009 at 03:54:35PM +0100, Jamie Lokier wrote:
> 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.

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2009-05-15 21:42 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-05-15 11:50 Can I run an application compiled with gcc ABI 2.95 on a kernel compiled with gcc ABI 3.4? muzungu
2009-05-15 12:31 ` David Woodhouse
2009-05-15 13:51   ` Jamie Lokier
2009-05-15 13:55     ` Ben Dooks
2009-05-15 14:32       ` George G. Davis
2009-05-15 14:54         ` Jamie Lokier
2009-05-15 14:56           ` Jamie Lokier
2009-05-15 21:42           ` Russell King - ARM Linux
2009-05-15 13:56     ` David Woodhouse
2009-05-15 14:03       ` Gustavo Zacarias
2009-05-15 16:31       ` Nicolas Pitre

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).