[Issue 3372] New: optlink silently mistreats object files with more than 16384 symbols

d-bugmail at puremagic.com d-bugmail at puremagic.com
Wed Oct 7 23:50:30 PDT 2009


http://d.puremagic.com/issues/show_bug.cgi?id=3372

           Summary: optlink silently mistreats object files with more than
                    16384 symbols
           Product: D
           Version: 2.033
          Platform: Other
        OS/Version: Windows
            Status: NEW
          Severity: major
          Priority: P2
         Component: Optlink
        AssignedTo: nobody at puremagic.com
        ReportedBy: r.sagitario at gmx.de


--- Comment #0 from Rainer Schuetze <r.sagitario at gmx.de> 2009-10-07 23:50:29 PDT ---
Larger projects (like qtd) are suffering from problems with large object files
with a lot of symbols, where the linker creates bad fixups, creating
executables that are calling wrong functions.

Here's a test case that creates a lot of symbols

//////////////////////////////////////

import std.stdio;

class genfuns(int n, int m)
{
    static void run() { 
        genfuns!(n - 1, m).run(); 
    }
}

class genfuns(int n : 0, int m)
{
    static void run() { writefln("=== 0, %d ===", m); }
}

void main()
{
    // dmd-release: stack overflow with n=700
    // dmd-debug:   stack overflow with n=500
    genfuns!(300, 0).run(); 
    genfuns!(300, 1).run();
    genfuns!(300, 2).run();
    genfuns!(300, 3).run();
    genfuns!(300, 4).run();
    genfuns!(300, 5).run();
    genfuns!(300, 6).run();
    genfuns!(300, 7).run();
    genfuns!(300, 8).run();
    genfuns!(300, 9).run();
    genfuns!(300, 10).run();
    genfuns!(300, 11).run();
}
////////////////////////////////////////////

The output looks like this:

=== 0, 0 ===
=== 0, 1 ===
=== 0, 2 ===
=== 0, 3 ===
=== 0, 4 ===
=== 0, 5 ===
=== 0, 6 ===
=== 0, 7 ===
=== 0, 8 ===
=== 0, 9 ===
=== 0, 0 ===
=== 0, 0 ===

That shows, that the two last functions are calling wrong functions. The
symbols don't even show up in the map file, but are still in the debug info.
There you can see, that the adress is plain wrong, and searching the symbol in
the object file dump, it seems that symbol #16384 + n gets the address of
symbol #n.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list