bugDotGNU Portable.NET - Bugs: bug #13498, ilalink jumps to conclusions too...

 
 

You are not allowed to post comments on this tracker with your current authentification level.

bug #13498: ilalink jumps to conclusions too soon when auto-referencing libs that are indirectly required

Submitted by:  Ron MacNeil <macro>
Submitted on:  Wed 22 Jun 2005 05:49:25 AM UTC  
 
Category: NoneSeverity: 3 - Normal
Item Group: NoneStatus: None
Privacy: PublicAssigned to: None
Open/Closed: Open

Thu 23 Jun 2005 03:55:29 AM UTC, comment #1:

I've uploaded a test case demonstrating the bug. Extract the tgz and cd into the directory.

"make bug" and watch cscc (actually ilalink) fail to find c.dll. In this case, b.dll is referenced first, causing it to try to find c.dll via the auto-indirect-reference thing (outlined in the code snippet in the original post). It can't find c.dll and blows up without waiting to see if we explicitly reference c.dll later (which we do).

Then, "make nobug" and watch everything work. Why? Look at the makefile; The only difference is the order of the -l switches are swapped so c.dll is referenced before b.dll, avoiding the auto-indirect-reference mechanism.

Thanks again,
Ron

Ron MacNeil <macro>
Wed 22 Jun 2005 05:49:25 AM UTC, original submission:

When processing a referenced lib A, ilalink tries to be helpful by auto-referencing libs B that A requires but which might not be directly required.

The problem is, if B isn't in one of the lib paths (-L) ilalink gives up right away, EVEN IF that lib might be directly referenced in a subsequent -l/path/to/lib switch.

Maybe the auto-indirect-referencing should be done in a separate pass, after all direct references have been processed?

Regardless, neither Mono's mcs nor Microsoft's csc exhibit the same problem.

Kudos on the great work, guys.
Ron

Starting point:
This block at line 814'ish of ilalink/link_library.c, in function ILLinkerAddLibrary(), which recursively calls itself straight away for each indirectly-referenced lib without waiting to see if it's referenced manually later on:

/* Add assemblies that were referenced by this library, because
this library may contain TypeRef's in its public signatures
to some other assembly, and we need to import them too */
if(result)
{
assem = 0;
while((assem = (ILAssembly *)ILImageNextToken
(image, IL_META_TOKEN_ASSEMBLY_REF, (void *)assem)) != 0)
{
if(!ILLinkerAddLibrary(linker, ILAssembly_Name(assem)))
{
result = 0;
break;
}
}
}

Ron MacNeil <macro>

 

Attached Files
file #3114:  pnet-bug-testcase.tgz added by macro (709B - application/x-tgz - Test case demonstrating the bug)

 

Depends on the following items: None found

Items that depend on this one: None found

 

CC list is empty

 

Do you think this task is very important?
If so, you can click here to add your encouragement to it.
This task has 0 encouragements so far.

Only logged-in users can vote.

 

Please enter the title of George Orwell's famous dystopian book (it's a date):

 

 

Follows 1 latest change.

Date Changed By Updated Field Previous Value => Replaced By
Thu 23 Jun 2005 03:55:29 AM UTCmacroAttached File-=>Added pnet-bug-testcase.tgz, #2622

Back to the top


Powered by Savane 3.1-cleanup