Changeset 11606


Ignore:
Timestamp:
Jan 10, 2009, 9:53:43 AM (11 years ago)
Author:
gb
Message:

When dealing with ELF shared libs (Linux/FreeBSD/Solaris), ignore any
.nnn suffices when comparing the soname of a SHLIB entry to the shared
libs actually in memory; when "reviving" a shared lib, set its soname
to the actual library's soname (which may differ in this version
suffix.) This is intended to help deal with the fact that FreeBSD 6.x
and 7.x provide versions of the standard libraries (and FreeBSD
incorporates a version suffix in the soname); in some cases (depending
on what library versions the lisp kernel was linked against), this can
cause attempts to open (for instance) the libc.so.6 library when
libc.so.7 is already open, with unpleasant consequenes.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/source/level-0/l0-cfm-support.lisp

    r11518 r11606  
    845845#+(or linux-target freebsd-target solaris-target)
    846846(progn
     847
     848;;; Return the position of the last dot character in name, if that
     849;;; character is followed by one or more decimal digits (e.g., the
     850;;; start of a numeric suffix on a library name.)  Return NIL if
     851;;; there's no such suffix.
     852(defun last-dot-pos (name)
     853  (do* ((i (1- (length name)) (1- i))
     854       (trailing-digits nil))
     855       ((<= i 0))
     856    (declare (fixnum i))
     857    (let* ((code (%scharcode name i)))
     858      (declare (type (mod #x110000) code))
     859      (if (and (>= code (char-code #\0))
     860               (<= code (char-code #\9)))
     861        (setq trailing-digits t)
     862        (if (= code (char-code #\.))
     863          (return (if trailing-digits i))
     864          (return nil))))))
     865 
    847866;;; It's assumed that the set of libraries that the OS has open
    848867;;; (accessible via the _dl_loaded global variable) is a subset of
     
    854873          (shlib.pathname lib) nil
    855874          (shlib.base lib) nil)
    856     (let* ((soname (shlib.soname lib)))
     875    (let* ((soname (shlib.soname lib))
     876           (last-dot (if soname (1+ (last-dot-pos soname)))))
    857877      (when soname
    858878        (with-cstrs ((soname soname))
     
    864884                                             (soname-ptr-from-link-map m))
    865885                               (unless (%null-ptr-p libname)
    866                                  (when (%cstrcmp soname libname)
     886                                 (when (or (%cstrcmp soname libname)
     887                                           (and last-dot
     888                                                (%cnstrcmp soname libname last-dot)))
    867889                                   (return-from found  m)))))))))
    868890            (when map
     
    879901                    (shlib.pathname lib) (%get-cstring
    880902                                          (pref map :link_map.l_name))
     903                    (shlib.soname lib) (%get-cstring (soname-ptr-from-link-map map))
    881904                    (shlib.map lib) map))))))))
    882905
Note: See TracChangeset for help on using the changeset viewer.