>>>>> Louis A Mamakos writes:

 > I just put a new -current on my test machine, and watched a bunch of stuff
 > fall over and die due to the new C++ implementation.

 > Is it possible to bump the revision of libstdc++ (and perhaps others) so
 > that existing programs can continue to function?  I fear I will be
 > tracking down occasional broken C++ programs for days now.

The solution I adopted is to keep the old libstdc++.so.3 and rename it
libstdc++.so.1. Then you just have to modify your executable so that
it looks for libstdc++.so.1 instead of libstdc++.so.3 (script below
:-))

Jean-Marc

#!/usr/bin/perl

if (!$ARGV[0] || $ARGV[0] eq "-h") {
    print STDERR "usage: $0 file...\n";
    exit 1;
}
foreach (@ARGV) {
    if (! -f $_) {
        print STDERR "$_: not found\n";
    } else {
        ($s) = `file $_`;
        if ($s !~ /: ELF.*dynamically linked/) {
            print STDERR "$_: bad format\n$s";
        } else {
            @h = `objdump -h $_`;
            $done = 0;
            foreach $s (@h) {
                if ($s =~ /dynstr/) {
                    &edit ($_, $s);
                    $done = 1;
                }
            }
            if (!$done) {
                print STDERR "$_: no .dynstr section\n";
            }
        }
    }
}
sub edit {
    $f = shift;
    $_ = shift;
    split;
    $len = hex ($_[2]);
    $skip = hex ($_[5]);
    if (!open (F, $f)) {
        print STDERR "$f: $!\n";
        return;
    }
    $n = sysread (F, $a, $skip);
    if ($n != $skip) {
        print STDERR "$f: short read\n";
        return;
    }
    $n = sysread (F, $_, $len);
    if ($n != $len) {
        print STDERR "$f: short read\n";
        return;
    }
    if (! /libstdc\+\+.so.3/) {
        print STDERR "$f: libstdc++.so.3 not used\n";
        return;
    }
    s/libstdc\+\+.so.3/libstdc++.so.1/;
    if (!open (G, ">$f.1")) {
        print STDERR "can't create $f.1\n";
        close F;
        return;
    }
    syswrite (G, $a, $skip);
    syswrite (G, $_, $len);
    while ($n != 0) {
        $n = sysread (F, $_, 100000);
        if ($n < 0) {
            print STDERR "$f: read error\n";
            close F;
            close G;
            return;
        }
        if ($n != 0) {
            $w = syswrite (G, $_, $n);
            if ($n < $w) {
                print STDERR "$f.1: write error\n";
                close F;
                close G;
                return;
            }
        }
    }
    close F;
    close G;
    system ("mv $f $f.backup && mv $f.1 $f");
}

-- 
 Jean-Marc Zucconi                    PGP Key: finger [EMAIL PROTECTED]


To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-current" in the body of the message

Reply via email to