Issue 11945 - Provide linker mapfiles for dynamically loaded libraries
Summary: Provide linker mapfiles for dynamically loaded libraries
Status: CLOSED FIXED
Alias: None
Product: porting
Classification: Code
Component: code (show other issues)
Version: 644
Hardware: All All
: P3 Trivial (vote)
Target Milestone: OOo 1.1 Beta2
Assignee: matthias.huetsch
QA Contact: issues@porting
URL:
Keywords:
Depends on: 11962 11968 12151 12685 12687 12688 12689 12692 12694
Blocks:
  Show dependency tree
 
Reported: 2003-03-01 16:37 UTC by matthias.huetsch
Modified: 2003-04-29 13:33 UTC (History)
2 users (show)

See Also:
Issue Type: TASK
Latest Confirmation in: ---
Developer Difficulty: ---


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description matthias.huetsch 2003-03-01 16:37:51 UTC
By their very nature, all dynamically loaded libraries do have a well defined
exported API, and thus can always provide (symbol scoping) linker mapfiles (in
terms of GNU ld: --version-script).

Many dynamically loaded libraries do not yet provide such mapfiles, though they
often do provide a (windows only) .DEF file.

Meta 'porting' task to track issues against individual modules, upon which this
task will depend.
Comment 1 matthias.huetsch 2003-03-01 16:39:13 UTC
Accepting with tentative target 'OOo 1.1 Beta2'.
Comment 2 matthias.huetsch 2003-03-02 13:53:11 UTC
Added dependency to issue 11962.
Comment 3 matthias.huetsch 2003-03-02 19:48:21 UTC
Added dependency to issue 11968.
Comment 4 matthias.huetsch 2003-03-02 20:11:19 UTC
Linker mapfile (version script) for a dynamically loaded library
implementing a UNO component, e.g. called 'exports.map':

UDK_3_0_0 {
        global:
                GetVersionInfo;
                component_getDescriptionFunc;
                component_getImplementationEnvironment;
                component_getFactory;
                component_writeInfo;

        local:
                *;
};

In the corresponding 'makefile.mk', all those fancy

USE_DEFFILE=TRUE
USE_LDUMP2=TRUE

lines should be removed, and be replaced by instructions like:

SHL1TARGET= $(TARGET)
SHL1IMPLIB= i$(TARGET)

SHL1VERSIONMAP=exports.map
SHL1DEF=$(MISC)$/$(SHL1TARGET).def
DEF1NAME=$(SHL1TARGET)

The 'solenv' build environment takes care of the rest, i.e. feeds the
specified 'exports.map' as mapfile (or version script) to a Unix 'ld'
or generates a Windows .DEF file and feeds that to a Windows linker.
Comment 5 khendricks 2003-03-06 21:53:23 UTC
Hi,  (Adding myself to CC on this one). 
 
I do not know alot about map files in general so I have one related question?  
 
Must the Linux map files be cpu specific or can they be generalized to all Linux platforms? 
 
Specifically, can we make all Linux_intel.map files generic so that they work for x86, ppc, 
and s390 (our currently working linux ports)?   
 
My guess is they should work for PPC Linux and S390 Linux as well since we all use the 
same compiler and have the same entry points (almost nothing but the bridge code and 
the atomic increment/derement code are ppc linux specific) and even those entry points 
would be identical in symbol names correct? 
 
If the answer to this is uncertain I would be happy to test any and all Linux_intel.map files 
on my PPC Linux build and attempt to identify if any irregularities exists.  Basically I could 
use nm or readelf and grep to make sure the all of the symbols in the Linux_intel map files 
are present in the PPC Linux version of the library. 
 
Any guidance about their reusability would be appreciated. 
 
Thanks, 
 
Kevin 
 
 
 
Comment 6 matthias.huetsch 2003-03-06 22:23:24 UTC
Hi Kevin,

Somehow I knew you would stumble over this issue :-)

Seriously, what I meant by '...by their very nature...' is that all
dynamically loaded -- dlopen()'ed -- libraries do export a C API, only.

There is no C++ name mangling involved at all, and thus these version
scripts (or map files) are neither CPU nor OS dependent, provided the
used linker on a particular OS does support this concept at all (or
some kind of script applies a translation into something similar, as
is done on Windows to generate a .DEF file from the map file).

As the GNU ld supports this via the '-version-script' switch, all
GNU binutils based OSes (in particular all Linux platforms) can make
use of this mechanism.
In case that 'solenv/inc/unxlngppc.mk' is your's then it's already
enabled (grep for VERSIONMAP -> LINKVERSIONMAPFLAG=...).

Just to clarify, this issue applies to *dynamically* loaded libs with
C exports, only. Libraries with C++ exports are not yet addressed 
here. I'm still thinking about a practical solution, but you're on
the right track in that even those map files can most probably be
simplified to depend on the *compiler* only (i.e. a 'gcc3.map' 
replacing all those 'linux_intel_gcc3.map', 'freebsd_alpha_gcc3.map',
et al currently in use.

Hope that helps,
Matthias

Comment 7 matthias.huetsch 2003-03-08 17:42:54 UTC
Added dependency to issue 12151.
Comment 8 matthias.huetsch 2003-04-11 20:13:31 UTC
With all dependencies resolved fixed, this is resolved fixed as well :-)
Comment 9 matthias.huetsch 2003-04-29 13:33:15 UTC
All dependencies verified and closed -> closing this as well.