User: Password:
Subscribe / Log in / New account



Posted Nov 21, 2007 11:29 UTC (Wed) by nix (subscriber, #2304)
In reply to: sys_indirect() by michaeljt
Parent article: sys_indirect()

I don't see how this differs from versioned symbols and a set of new syscalls with an extra
argument, except that it's much uglier.

(Log in to post comments)


Posted Nov 21, 2007 12:06 UTC (Wed) by michaeljt (subscriber, #39183) [Link]

But the point being that at some point it may be better to stop supporting old binaries
directly and move them to compatibility layers instead.  Currently I assume that binaries over
10 years old will still work in the unlikely event that everything else they need is still
available.  How long is forever though?

I suppose that the main difference from versioned symbols is that the compatibility layer
doesn't need to be inside the kernel, and doesn't even need to be installed on the machine if
it is not needed.


Posted Nov 21, 2007 16:39 UTC (Wed) by nix (subscriber, #2304) [Link]

There's no need for that, though: glibc already *contains* code which looks at the
capabiliities of your machine and uses different syscall mechanisms depending on that (int80
versus vsyscall on x86/x86-64, for instance).

Should we run out of syscalls (on x86-64, we only have 2^32 minus a couple of hundred left!
such a harsh limit!) or should we decide the syscall table is too damn huge, then we could
always introduce another syscall mechanism and call it unconditionally from a new glibc.

The point being, if you can hack to preload things automatically, you can just as easily
modify to do the job itself in a much less ugly fashion :)

(of course the problem here remains the breaking of compatibility with all older glibcs: the
newer glibc doesn't need a major version bump, though. I suspect this is a step which the
kernel hackers will be very reluctant to take. It's happened on some arches, but they're all
relatively minor ones.)


Posted Nov 21, 2007 16:52 UTC (Wed) by michaeljt (subscriber, #39183) [Link]

Right - as far as I know, the main reason that the syscall interface may never be changed is
old statically linked binaries, or at least binaries and libraries which do syscalls
themselves and not through libc.  That problem could be solved by hacking (as far as I
know, even statically linked binaries are loaded by, and if not something similar could
be found) but not by hacking libc.


Posted Nov 22, 2007 10:26 UTC (Thu) by nix (subscriber, #2304) [Link]

Statically linked binaries don't have a PT_INTERP header at all, so never gets involved. and libc are tightly tied: if one is used, the other always will be as well. (It is I
think possible to dynamically link and statically link libc.a, but this is rare and
strange and you don't do it just by specifying -static at link time. It may well have


Posted Nov 21, 2007 18:26 UTC (Wed) by drag (subscriber, #31333) [Link]

It (transition from old and busted glibc to a imaginary shiny and sexy replacement-for-glibc)
could probably be handled in a similar fasion on how the developers are handling the
transition from XCB to XLib. 

First they tried to go with XCL, which was a XLib compatability layer for XCB. It worked for
the most part, but a lot of the more oddball features of Xlib proved too difficult to
replication on top of XCB.

Now they are doing the Xlib/XCL approach, which is to have Xlib-guts being slowly ripped out
as applications gradually migrate to XCB, while having the Xlib actually running on top of
XCB. (or something like that) Using this approach they can acheive 100% binary compatability
and for programmers of applications/libraries using xlib they can start using XCB stuff right
away without a total rewrite. 

Also there is probably some answers to be found in the Linux-binary emulation features present
in other operating systems like FreeBSD, AIX, and Solaris.


Posted Nov 22, 2007 10:28 UTC (Thu) by nix (subscriber, #2304) [Link]

I wasn't aware there was any intent to have apps migrate en masse to XCB (does anyone know of
anything other than Xlib that uses XCB yet?). What is more likely to be useful is to have
*widget sets* migrate, as they already implement most of what Xlib does themselves, and don't
need most of the rest except for the raw comms stuff which XCB provides.

As far as I know the XCB-based Xlib is here to stay.


Posted Nov 22, 2007 22:36 UTC (Thu) by njs (guest, #40338) [Link]

GTK+ does use XCB in one or two obscure places, but most of it is still Xlib-based.  The big
advantage of Xlib-on-XCB is that it becomes possible to mix Xlib and XCB calls in the same
program, talking on the same X connection -- so you can have a gradual transition.  Aside from
toolkits themselves, interesting programs often have *some* direct calls to Xlib in addition
to all the ones that go through the toolkit, because toolkits don't expose everything.  (And
toolkits are explicitly architected to allow for this, e.g. there is a way to get an Xlib
Display* out of a GdkDisplay*.)  For some of those apps, being able to use a sane and
more-async-able API might well be valuable, and in general it is probably smart to use XCB in
new programs.

I have no idea what the equivalent for "libc migration" would be.  When would you want to use
two different libcs from the same program?  How would the compiler even know which version of
fork() you were trying to call?


Posted Nov 23, 2007 0:22 UTC (Fri) by nix (subscriber, #2304) [Link]

I suspect that the only way to `migrate' libcs would be a big bang with 
interface back-compatibility (which is, of course, exactly how glibc 
upgrades work). Nothing else works because of the presence of critical 
global data structures whose format must be understood by everything that 
accesses them (I'm thinking mostly of malloc() and free() here, but the 
exception unwinder is another example, which is why exists at 
all as opposed to just libgcc.a).

Copyright © 2017, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds