Multi-module libstdc++ on Darwin

Geoffrey Keating geoffk@apple.com
Tue Aug 3 00:51:00 GMT 2004


On Darwin, it matters whether you build a shared library out of a 
single object or out of multiple objects; the Darwin linker and loader 
tries to really replicate .a file semantics with shared libraries.

So, this patch backports (well, completely rewrites) a change from 
libtool upstream which makes this work.  The original code, which was 
trying to use -bind_at_load, was probably a good idea but could never 
have worked, the loader doesn't support it.

It also backports (again, really it rewrites) a change from upstream 
that prevents use of -all_load, which didn't work in this context 
because it applies to *every* .a file on the link line.  (This makes it 
not very useful.)  Upstream has a much better fix for this, we should 
upgrade.

The previous patches exposed a problem where EH information would bind 
to global symbol, and when those symbols were coalesced, you'd end up 
with EH information bound to the wrong copy of its procedure, causing 
interesting bugs.  In addition, Mach-O doesn't make relocs to symbols; 
relocations happen to *addresses*.  So, if you had

             .globl __foo
__foo:
LEB1:

it didn't matter if you used __foo or LEB1, you would get exactly the 
same .o file.  So, I changed the assembler and linker to work around 
this in cctools-528.  That lets us get rid of these hacks from 
dwarf2out.c and fix the EH problem at the same time.  Unfortunately, it 
means you do have to upgrade your cctools.

Bootstrapped & tested (including libjava and libstdc++) on 
powerpc-darwin.

I have permission from my management to put a copy of the cctools-528 
sources on sourceware, and I'll also put a binary installable package 
there, since it turns out it's rather hard to build.  I've put the 
sources at
<ftp://gcc.gnu.org/pub/gcc/infrastructure/cctools-528.tar.bz2> and the 
package at <ftp://gcc.gnu.org/pub/gcc/infrastructure/cctools-528.dmg>.

If installing a binary package from gcc.gnu.org worries you, and it 
should, the md5sums are:

bfbe2e3893eb650a118b8dda7bb7b3e8  cctools-528.tar.bz2
d24567d069228f127e8ef458f7eaf8f6  cctools-528.dmg

and you can check them because this message is signed.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: gcc-3168188-flateh.patch
Type: application/octet-stream
Size: 5022 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20040803/4f77eaed/attachment.obj>
-------------- next part --------------


-- 
Geoff Keating <geoffk@apple.com>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 2361 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20040803/4f77eaed/attachment.p7s>


More information about the Gcc-patches mailing list