Changeset 14932 for release


Ignore:
Timestamp:
Aug 8, 2011, 3:17:04 PM (8 years ago)
Author:
wws
Message:

open-shared-library works again in FreeBSD (merge 14929 from trunk)

File:
1 edited

Legend:

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

    r14656 r14932  
    162162#+(or linux-target freebsd-target solaris-target)
    163163(progn
     164
     165;; (pref ptr :link_map.l_addr) is an integer on Linux and a Pointer on FreeBSD
     166;; This macro returns a pointer on all platforms
     167(defmacro link_map.l_addr (ptr)
     168  (let* ((record (%find-foreign-record :link_map))
     169         (field (%find-foreign-record-type-field record :l_addr))
     170         (offset (/ (foreign-record-field-offset field) 8)))
     171    `(%get-ptr ,ptr ,offset)))
    164172
    165173(defun soname-ptr-from-link-map (map)
     
    241249
    242250(defun shlib-from-map-entry (m)
    243   (let* ((base (%int-to-ptr (pref m :link_map.l_addr))))
     251  (let* ((base (link_map.l_addr m)))
    244252    ;; On relatively modern Linux systems, this is often NULL.
    245253    ;; I'm not sure what (SELinux ?  Pre-binding ?  Something else ?)
     
    351359        (%walk-shared-libraries
    352360         #'(lambda (map)
    353              (let* ((addr (pref map :link_map.l_addr)))
    354                (unless (or (eql addr 0)
    355                            (shared-library-at (%int-to-ptr addr)))
     361             (let* ((addr (link_map.l_addr map)))
     362               (unless (or (%null-ptr-p addr)
     363                           (shared-library-at addr))
    356364                 (let* ((new (shlib-from-map-entry map)))
    357365                   (%dlopen-shlib new))))))))))
     
    856864                       :unsigned-fullword *dlopen-flags*
    857865                       :void)
    858               (setf (shlib.base lib) (%int-to-ptr (pref map :link_map.l_addr))
     866              (setf (shlib.base lib) (link_map.l_addr map)
    859867                    (shlib.pathname lib) (%get-cstring
    860868                                          (pref map :link_map.l_name))
     
    900908                        (%get-cstring (pref map :link_map.l_name))
    901909                        (shlib.base lib)
    902                         (%int-to-ptr (pref map :link_map.l_addr))
     910                        (link_map.l_addr map)
    903911                        (shlib.map lib) map
    904912                        (shlib.handle lib) handle
Note: See TracChangeset for help on using the changeset viewer.