[Openmcl-devel] possible bug in open-shared-library-internal

Gary Byers gb at clozure.com
Tue Jun 21 16:33:21 PDT 2011


Thanks.  On Linux, that use of PREF does indeed return an unsigned
integer; on FreeBSD and (IIRC) Solaris the l_addr field is defined
to be a pointer type.

There are probably about half a dozen uses of "(pref map
:link_map.l_addr)" in that file, some of them conditionalized for this
difference and some of them should be but aren't.

It's probably worth defining macros or functions like
LINK-MAP-ADDRESS-AS-POINTER and LINK-MAP-ADDRESS-AS-INTEGER and hiding
this difference in there.  (There are other platform-specific differences,
but it's worth something to not trip over this one.)




On Tue, 21 Jun 2011, Artem Mironov wrote:

> Hello
>
> I've moved to trunk to test my project with fixed vector streams but
> got unexpected error
> in code which loads my shared library. The problem is that (pref map
> :link_map.l_addr) returns
> macptr and %INT-TO-PTR fails. Here is a fix. I run
> 1.7-dev-r14834M-trunk  (FreebsdX8664).
>
> Index: level-0/l0-cfm-support.lisp
> ===================================================================
> --- level-0/l0-cfm-support.lisp (revision 14834)
> +++ level-0/l0-cfm-support.lisp (working copy)
> @@ -351,8 +351,8 @@
>        (%walk-shared-libraries
>         #'(lambda (map)
>              (let* ((addr (pref map :link_map.l_addr)))
> -               (unless (or (eql addr 0)
> -                           (shared-library-at (%int-to-ptr addr)))
> +               (unless (or (%null-ptr-p addr)
> +                           (shared-library-at addr))
>                  (let* ((new (shlib-from-map-entry map)))
>                    (%dlopen-shlib new))))))))))
>
> -- 
> Best Regards
> Artem
> _______________________________________________
> Openmcl-devel mailing list
> Openmcl-devel at clozure.com
> http://clozure.com/mailman/listinfo/openmcl-devel
>
>



More information about the Openmcl-devel mailing list