Subject: lib/2824: Fixes objc runtime for dynamic loading of modules
To: None <gnats-bugs@gnats.netbsd.org>
From: Ezra Story <ezy@panix.com>
List: netbsd-bugs
Date: 10/09/1996 14:09:21
>Number:         2824
>Category:       lib
>Synopsis:       Fixes objc runtime for dynamic loading of modules
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    lib-bug-people (Library Bug People)
>State:          open
>Class:          change-request
>Submitter-Id:   net
>Arrival-Date:   Wed Oct  9 11:20:02 1996
>Last-Modified:
>Originator:     Ezra Story
>Organization:
>Release:        1.2_BETA
>Environment:
System: NetBSD inca 1.2 NetBSD 1.2 (INCA) #124: Wed Sep 18 10:10:24 EDT 1996 ezy@inca:/usr/src/sys/arch/amiga/compile/INCA amiga


>Description:
These are a set of patches to the objc runtime for dynamic loading and
linking of libraries with modules in them.  It consists of a simple patch
to class.c to add a hook in lookup_class which points to code in dynamic.c
which does all the dirty work.  This stuff is NetBSD specific since it
relies on internals of the rtld netbsd uses.  It shouldn't be arch
specific however.

On the first class lookup, it will locate any constructor lists generated
by ld in the shared libraries the executable has linked to, and call the
constructors.  Then it will restart the lookup -- which will probably find
the class it wanted this time. :)  dynamic.c also provides a wrapper around
dlopen (objc_dlopen) which does a dlopen on a shared object and calls any
constructors hiding in it before returning the handle.

When you dynamically link objc modules, you will find the linker
complaining about RRS Text relocation.  This is because cc1obj plops a
reference to objc_class_name_* in the text segment of generated objects in
order to pull in statically linked module libraries.  It really doesn't
harm anything since its not used otherwise, but I've also included a patch
to objc-act.c that may or may not eliminate that problem (my computer is
way too slow to wait for cc1obj to compile :)).
>How-To-Repeat:
>Fix:
The fix:

begin 644 objcdynruntime.tgz
M'XL(`````````^U9_6_;N!GNK]5?\5X/N,JN[<H?<=H$[:W7=$"!]&Y(,UQO
MPR#($AUSD45!I.*Z6__W/2\IVG*27H?UDF)HB""R*8KO]_,^E#,YG^O']VYT
MT"3:W]NC>\3#7Z/FVGRAZ6@XF8[&XSU\'D;#:'J/]FY6+3=J;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