Issue 804 - SGI ld doesnt like the .map file format used to build many .so's
Summary: SGI ld doesnt like the .map file format used to build many .so's
Status: CLOSED WONT_FIX
Alias: None
Product: Build Tools
Classification: Code
Component: code (show other issues)
Version: 625
Hardware: SGI IRIX
: P5 (lowest) Trivial (vote)
Target Milestone: ---
Assignee: nickb
QA Contact: issues@tools
URL:
Keywords:
Depends on:
Blocks: 810 816 1041 1209
  Show dependency tree
 
Reported: 2001-04-26 11:34 UTC by zeroj
Modified: 2013-08-07 15:35 UTC (History)
3 users (show)

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


Attachments
inet/util/makefile.mk : Patch to ignore .map file (527 bytes, patch)
2001-04-26 11:56 UTC, zeroj
no flags Details | Diff
store/util/makefile.mk : Patch to ignore .map file (720 bytes, patch)
2001-04-26 11:57 UTC, zeroj
no flags Details | Diff
inet/util/ni.map : Example .map in question (59 bytes, text/plain)
2001-04-26 15:46 UTC, zeroj
no flags Details
store/util/sto.map : Another example .map file (546 bytes, patch)
2001-04-26 15:48 UTC, zeroj
no flags Details | Diff
solenv/inv/_tg_shl.mk : Patch to disable .map files on IRIX (768 bytes, patch)
2003-12-06 14:52 UTC, issues@www
no flags Details | Diff
as above with correct syntax (785 bytes, patch)
2003-12-06 14:52 UTC, issues@www
no flags Details | Diff
wrapper around ld to support map files (1.10 KB, text/plain)
2001-12-07 02:09 UTC, nickb
no flags Details
solenv/inc/_tg_shl.mk - allow IRIX to use map files (5.82 KB, patch)
2001-12-07 02:10 UTC, nickb
no flags Details | Diff
wrapper around ld - using gawk rather then awk - some input lines are too long for awk (1.10 KB, text/plain)
2001-12-07 02:22 UTC, nickb
no flags Details
wrapper script, uses -hiddens_file or -exports_file, as is appropriate (2.71 KB, text/plain)
2001-12-10 05:48 UTC, nickb
no flags Details
salhelper/source/irgm.map - map file for IRIX (980 bytes, text/plain)
2001-12-10 07:47 UTC, nickb
no flags Details
salhelper/source/makefile.mk - support for IRIX map file (346 bytes, patch)
2001-12-10 07:48 UTC, nickb
no flags Details | Diff
psprint/util/makefile.mk - use solaris mapfile on IRIX (462 bytes, patch)
2001-12-10 07:52 UTC, nickb
no flags Details | Diff
ld wrapper - ONLY changes the map file to sgi format (2.76 KB, patch)
2001-12-11 23:56 UTC, nickb
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this issue.
Description zeroj 2001-04-26 11:34:42 UTC
Open Office uses .map files to build many of its .so's, however I have not been 
able to identify the format, or the flags required to get MIPSpro accept it.

My solution to date has been to remove the .map from the build process, by 
placing IRIX beside MACOSX in makefile.mk . I doubt this is a problem, however 
it would be good to find a better solution.

% find * -name '*map'
chaos/util/exports.map
chaos/util/exports.mxp.map
chaos/source/imap
configmgr/util/cfgmgr.map
configmgr/util/cfgmgr.mxp.map
connectivity/source/drivers/calc/calc.map
connectivity/source/drivers/file/file.map
connectivity/source/drivers/flat/flat.map
connectivity/source/drivers/flat/flat.mxp.map
connectivity/source/drivers/jdbc/jdbc.map
connectivity/source/drivers/jdbc/jdbc.mxp.map
connectivity/source/drivers/odbc/odbc.map
connectivity/source/drivers/adabas/adabas.map
connectivity/source/drivers/adabas/adabas.mxp.map
connectivity/source/drivers/dbase/dbase.map
connectivity/source/drivers/dbase/dbase.mxp.map
connectivity/source/manager/sdbc.map
connectivity/source/manager/sdbc.mxp.map
dbaccess/util/dba.map
dbaccess/util/dbu.map
dtrans/source/generic/exports.map
extensions/source/propctrlr/pcr.map
extensions/source/dbpilots/dbp.map
extensions/source/dbimport/dbi.map
extras/source/templates/wizard/bitmap
inet/util/ni.mxp.map
inet/util/ni.map
inet/unxirxm3.pro/misc/ni.map
inet/source/imap
linguistic/workben/lex.map
package/util/exports.map
sc/util/sc.map
sch/util/sch.map
sd/util/sd.map
setup2/mow/source/loader/bitmap
solenv/bin/genmap
starmath/util/sm.map
store/util/sto.mxp.map
store/util/sto.map
sw/util/sw.map
ucb/source/ucp/package/exports.map
ucb/source/ucp/webdav/exports.map
ucb/source/ucp/hierarchy/ucphier.map
ucbhelper/workben/myucp/exports.map
xmlhelp/source/helpprovider/exports.map
Comment 1 zeroj 2001-04-26 11:56:42 UTC
Created attachment 194 [details]
inet/util/makefile.mk : Patch to ignore .map file
Comment 2 zeroj 2001-04-26 11:57:20 UTC
Created attachment 195 [details]
store/util/makefile.mk : Patch to ignore .map file
Comment 3 sander_traveling 2001-04-26 11:57:31 UTC
But the .map-s are extremely usefull as they speed up loading of shared
libraries by limiting the number of global symbols to only these actually
required to be global (now look at the number and size of shared libraries in
OOo).

You might want to take a look at the linker documentation and investigate how
you can pass flags to linker from the compiler. I'm realtively sure they are
actually supported.
Comment 4 sander_traveling 2001-04-26 11:59:15 UTC
One more thing - if you actually decide to take out map files, I guess you
should not patch all teh individual makefile.mk-s but instead modify make rules
in the solenv/inc directory
Comment 5 zeroj 2001-04-26 12:11:40 UTC
I definately want to work on this before we release to customer, and have 
raised this with the MIPSpro compiler group.  If they cant provide a suitable 
solution, I will simply write a script which converts them to a compatible 
format.

For now, can we just get it building on IRIX :)
Comment 6 jens-heiner.rechtien 2001-04-26 12:35:14 UTC
John,

the map files are not just an optimization for shared library loading speed. 
You'll get quite a few hard to find bugs if you just throw away these files on 
Irix without implementing an equivalent mechanism.

The reason for this trouble are double symbols. Under NT all symbols are bound 
locally in a DLL if a symbol is present in this DLL. OpenOffice assumes that 
this behaviour is true also for all shared libraries on Unix which exports just 
a few C functions. These are quite a few like the shared libraries for the 
writer, the calc etc.

All global symbols which are not exported are localized in the map files, which 
results in that all these symbols are bound locally, thus implementing the same 
behaviour as under NT.

Another possibility to achieve this behaviour is to link with -Bsymbolic. But 
this linker switch has some disastrous effects on the ability to catch 
exceptions over shared library boundaries, at least on some platforms.

Shared libraries without mapfiles should never exhibit double symbols, this 
would be a bug.

Heiner


Comment 7 Unknown 2001-04-26 12:50:10 UTC
reassign to porting
Comment 8 zeroj 2001-04-26 13:45:01 UTC
Technical answer: Bugga.

I had expected as much actually, 'cause it seemed highly un-usual to have a 
wierd format for such a simple task.

Have Sun developed any tools which I could use to perform this?  Are they Open 
Source?  And can I get a slightly more technical (say EBNF) desciption of the 
file format?
Comment 9 sander_traveling 2001-04-26 14:38:31 UTC
John, you might want to take a look at docs.sun.com (search for something called
linker and libraries guide). 
Comment 10 jens-heiner.rechtien 2001-04-26 15:18:46 UTC
John,

well, our NT developers always call the Unix behavior buggy ...

But to answer your question: The GNU linker has the same ability. They call it
version maps. Mapfiles are also quite useful in performing versioning on symbol
level rep. defining several API's in one shared library. I always thought that
most ELF platforms support these kind of stuff, but obviously I'm wrong.

Heiner
Comment 11 zeroj 2001-04-26 15:46:56 UTC
Created attachment 205 [details]
inet/util/ni.map : Example .map in question
Comment 12 zeroj 2001-04-26 15:48:26 UTC
Created attachment 206 [details]
store/util/sto.map : Another example .map file
Comment 13 zeroj 2001-04-26 15:51:52 UTC
Its not that MIPSpro doesnt support this feature, its merely that I have only 
worked on IRIX/MIPSpro in the last 4 months, hence I am MIPSpro challenged, 
being typically a gcc/linux developer previously.

Sander, is this the document you are refering to ?
http://docs.sun.com/ab2/coll.45.13/LLM/@Ab2PageView/24449?
DwebQuery=linker&oqt=linker&Ab2Lang=C&Ab2Enc=iso-8859-1
Comment 14 sander_traveling 2001-04-26 15:58:54 UTC
I believe so. If you have access to a Linux machine, info ld will show you the
picture from the point of view of gnu linker, but I doubt it is too different...
Comment 15 issues@www 2001-06-01 01:13:14 UTC
These global symbols sound like the export symbols list for MIPSpro.
In the ld man page there is:

     -exported_symbol symbol_list
               Used in conjunction with the -shared or -call_shared
               options.  Marks the specified symbols as exported.  Use a
               comma to separate the symbols.  If you specify any exported
               symbols, all unspecified symbols are automatically hidden.
               (C, C++, F77, F90)

     -exports_file file
               Used in conjunction with the -shared or -call_shared
               options.  The specified file must contain a list of symbols
               that should be exported.  The list is comprised of symbol
               names separated by spaces or new-line characters.  Any
               symbols not specifically exported will be automatically
               hidden.  (C, C++, F77, F90)

maybe we could use a script to dynamically convert the .map file to an
export file.  If all the .map files use only global and local * then
the script should be easy enough to generate.

	Victor
Comment 16 issues@www 2001-07-13 05:00:08 UTC
This problem is not MIPSpro specific, as gcc on IRIX also uses SGI ld.

I have seen that this problem is also on MACOSX, and they have solved it 
by .IF 's in every applicable makefile.  Surely this can be fixed in the top 
level makefiles, so that for example, should I set LINKNOMAP=1, it will not use 
the MAP settings in each util/makefile.mk
Comment 17 issues@www 2001-07-13 12:14:42 UTC
Created attachment 373 [details]
solenv/inv/_tg_shl.mk : Patch to disable .map files on IRIX
Comment 18 issues@www 2001-07-13 12:16:59 UTC
This patch is what I want ... but it doesnt seem to be possible using dmake .. 
I get the following error:

solenv/inc/_tg_shl.mk:  line 66:  Error -- .IF do not support &&

Am I using incorrect syntax ... or does it really not handle logical AND's ?
Comment 19 jens-heiner.rechtien 2001-07-13 13:06:15 UTC
Hi John,

plain dmake doesn't handle &&, || and the like. Ause implemented || because it 
was essentilally a one liner, implementing && correctly would have beeen much 
harder. Just use two conditions one after the other.

Heiner
Comment 20 issues@www 2001-07-13 18:46:43 UTC
Created attachment 379 [details]
as above with correct syntax
Comment 21 sander_traveling 2001-07-13 19:47:37 UTC
Patch (ok, a look-alike) appliet to solenv/inc/tg_shl.mk, then re-generated
_tg_shl.mk with mkunroll and tagged both new versions as OO633B
Comment 22 nickb 2001-09-20 05:43:26 UTC
Added myself to CC list. This problem still exists in 638.
Comment 23 Unknown 2001-11-08 23:07:26 UTC
changing QA contact from bugs@ to issues@
Comment 24 nickb 2001-12-07 02:09:26 UTC
Created attachment 774 [details]
wrapper around ld to support map files
Comment 25 nickb 2001-12-07 02:10:06 UTC
Created attachment 775 [details]
solenv/inc/_tg_shl.mk - allow IRIX to use map files
Comment 26 nickb 2001-12-07 02:15:41 UTC
I'm not actually sure these should be checked in yet, but I thought
this would be a good spot to
record my progress. 
Basically, what happens is this:
-I have a gcc specs file which looks like this:
    *linker:
     ld.sh
And pass g++ (during the link phase, eg LINK= in the os specific
makefile) -specs=/path/to/gcc_specs
This overrides the default gcc setting for the linker, so call the
ld.sh script (att id 774) instead of collect2. The ld script parses
out  some conflicting options if the map file is used, and converts
the map file to something that is useable by sgi's linker.
It SHOULD be possible to change the gcc specs file to do the parsing,
but I find the specs file 
format very messy and not documented (I DID manage to find
documentation for gcc 3.1 but the 
functionality seems quite different to 2.95.3), and after spending
half a day on it, decided it
was a better use of my time to write this script.... 15 minutes later,
here we are!
Anyway, the script is also a handy place to do a dynamic conversion of
the GNU map file into
something sgi's linker can use.
And, messy as it is, this appears to be working nicely.
Comment 27 nickb 2001-12-07 02:22:34 UTC
Created attachment 776 [details]
wrapper around ld - using gawk rather then awk - some input lines are too long for awk
Comment 28 nickb 2001-12-07 03:45:10 UTC
Hmm, still needs some more work, it looks like some mapfiles only have
a local section (solaris)
or alternatively the Linux ones seem to be able to take wildcards.
Also, gonna have name mangling problems.....
Comment 29 nickb 2001-12-10 05:48:08 UTC
Created attachment 789 [details]
wrapper script, uses -hiddens_file or -exports_file, as is appropriate
Comment 30 nickb 2001-12-10 07:47:14 UTC
OK, this last attachment, works around some more ld problems, and uses
either  -hiddens_file (if only
local symbols are mentioned) or -exports_file (if only exported
symbols are mentioned).
There will need to be some changes to some makefiles for this to work,
as it looks like Linux map
files can have wilcards, so we need to use the solaris ones.

I now have a build which should match the Solaris build in what
symbols are exported from the dso's.
Comment 31 nickb 2001-12-10 07:47:51 UTC
Created attachment 790 [details]
salhelper/source/irgm.map - map file for IRIX
Comment 32 nickb 2001-12-10 07:48:20 UTC
Created attachment 791 [details]
salhelper/source/makefile.mk - support for IRIX map file
Comment 33 nickb 2001-12-10 07:52:50 UTC
Created attachment 792 [details]
psprint/util/makefile.mk - use solaris mapfile on IRIX
Comment 34 nickb 2001-12-11 23:56:34 UTC
Created attachment 820 [details]
ld wrapper - ONLY changes the map file to sgi format
Comment 35 nickb 2001-12-11 23:58:06 UTC
This last wrapper for ld is much better, in that I have gotten rid of
many of the 'sed' lines, by finding
a work-around for some of the ld problems. If we pass ld the flag
-LD_MSG:off=4, we still get the
(misleading) error message, but it does NOT cause an error. So this is
a much cleaner solution,
as all the wrapper does now, is convert the mapfiles to something
sgi's ld can use.
Comment 36 nickb 2002-01-06 20:55:48 UTC
I'm not 100% sure on where to go from here. I have succeded in building
OO using the mapfiles, but it required using a wrapper around ld.
I think I will need to make some changes to configure.in so that
it generates the appropriate wrapper and gcc spec file.... so that 
the wrapper is used transparently.
Comment 37 nickb 2002-01-14 22:22:56 UTC
Also, in the irix specific make file (unxirgm.mk)
LINKVERSIONMAPFLAG=-Wl,-exports_file
needs to be set.
Comment 38 stx123 2002-03-12 18:54:28 UTC
Hi, where are we with this issue? Is it still blocking other GSI
porting efforts?
Comment 39 nickb 2002-03-12 22:30:48 UTC
This works, if you use the last four patches
included in this bug. However, it really needs to be included in the 
configure script, so that it is all done automatically, and I haven't 
got to that yet. 
Comment 40 Martin Hollmichel 2003-01-27 19:04:58 UTC
mh->nick: please work with Ken to do the remaining work.
Comment 41 nickb 2003-02-10 00:01:38 UTC
Accepted. This will require some funky configure work, but its not
urgent right now (Its mostly a performance thing I believe).
Comment 42 nickb 2003-03-16 23:01:46 UTC
Added Miltestone
Comment 43 caolanm 2010-03-29 19:54:29 UTC
per issue 106845 sb removed the partial irix port, so this doesn't make sense in
isolation anymore106845
Comment 44 caolanm 2010-03-29 19:54:54 UTC
closing