Changeset 10048


Ignore:
Timestamp:
Jul 16, 2008, 2:22:02 PM (11 years ago)
Author:
gb
Message:

Conditionalize for Solaris.

Use *rtld-default* instead of *rtld-next* in many places; they seem
to yield the same results on other ELF-based systems, but differ
slightly on Solaris.

File:
1 edited

Legend:

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

    r9917 r10048  
    4444  (istruct-typep x 'external-entry-point))
    4545
     46;;; On both Linux and FreeBSD, RTLD_NEXT and RTLD_DEFAULT behave
     47;;; the same way wrt symbols defined somewhere other than the lisp
     48;;; kernel.  On Solaris, RTLD_DEFAULT will return the address of
     49;;; an imported symbol's procedure linkage table entry if the symbol
     50;;; has a plt entry (e.g., if it happens to be referenced by the
     51;;; lisp kernel.)  *RTLD-NEXT* is therefore a slightly better
     52;;; default; we've traditionaly used *RTLD-DEFAULT*.
    4653(defvar *rtld-next*)
    4754(defvar *rtld-default*)
     
    5057                                  #-(or linux-target darwin-target)  -2))
    5158
    52 #+(or linux-target freebsd-target)
     59#+(or linux-target freebsd-target solaris-target)
    5360(progn
    5461
     
    99106(defvar *shared-libraries* nil)
    100107
    101 #+(or linux-target freebsd-target)
     108#+(or linux-target freebsd-target solaris-target)
    102109(progn
    103110
     
    137144                                             dynamic-entries
    138145                                             target::node-size)))
    139                                  #+freebsd-target
     146                                 #+(or freebsd-target solaris-target)
    140147                                 (%inc-ptr (pref map :link_map.l_addr) disp)
    141                                  #-freebsd-target
     148                                 #-(or freebsd-target solaris-target)
    142149                                 (%int-to-ptr
    143150                                  (if (< disp 0)
     
    432439(defun ensure-open-shlib (c force)
    433440  (if (or (shlib.map c) (not force))
    434     *rtld-default*
     441    *rtld-next*
    435442    (error "Shared library not open: ~s" (shlib.soname c))))
    436443
     
    438445  (if c
    439446    (ensure-open-shlib c force)
    440     *rtld-default*
     447    *rtld-next*
    441448    ))
    442449
     
    454461;;; linkers don't quite get the concept ...)
    455462
    456 (defun foreign-symbol-entry (name &optional (handle *rtld-default*))
     463(defun foreign-symbol-entry (name &optional (handle *rtld-next*))
    457464  "Try to resolve the address of the foreign symbol name. If successful,
    458465return a fixnum representation of that address, else return NIL."
     
    476483(defvar *statically-linked* nil)
    477484
    478 #+(or linux-target freebsd-target)
     485#+(or linux-target freebsd-target solaris-target)
    479486(progn
    480487
     
    581588)
    582589
    583 #-(or linux-target darwin-target freebsd-target)
     590#-(or linux-target darwin-target freebsd-target solaris-target)
    584591(defun shlib-containing-entry (entry &optional name)
    585592  (declare (ignore entry name))
     
    603610
    604611
    605 (defun foreign-symbol-address (name &optional (map *rtld-default*))
     612(defun foreign-symbol-address (name &optional (map *rtld-next*))
    606613  "Try to resolve the address of the foreign symbol name. If successful,
    607614return that address encapsulated in a MACPTR, else returns NIL."
     
    630637    eep))
    631638
     639
     640
    632641(defun load-fv (name type)
    633642  (let* ((fv (or (gethash name (fvs)) (setf (gethash name *fvs*) (%cons-foreign-variable name type)))))
     
    640649
    641650
    642 #+(or linux-target freebsd-target)
     651#+(or linux-target freebsd-target solaris-target)
    643652(progn
    644653;;; It's assumed that the set of libraries that the OS has open
     
    728737  (%revive-macptr *rtld-next*)
    729738  (%revive-macptr *rtld-default*)
    730   #+(or linux-target freebsd-target)
     739  #+(or linux-target freebsd-target solaris-target)
    731740  (unless *statically-linked*
    732741    (setq *dladdr-entry* (foreign-symbol-entry "dladdr"))
Note: See TracChangeset for help on using the changeset viewer.