[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Dotgnu-pnet-commits] pnet/image meta_index.c, 1.8, 1.9 pecoff_loader.c,
From: |
Rhys Weatherley <address@hidden> |
Subject: |
[Dotgnu-pnet-commits] pnet/image meta_index.c, 1.8, 1.9 pecoff_loader.c, 1.19, 1.20 |
Date: |
Mon, 17 Nov 2003 09:00:21 +0000 |
Update of /cvsroot/dotgnu-pnet/pnet/image
In directory subversions:/tmp/cvs-serv24904/image
Modified Files:
meta_index.c pecoff_loader.c
Log Message:
Add some support for IL object files that use a ".cormeta" section.
Index: meta_index.c
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/image/meta_index.c,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -d -r1.8 -r1.9
*** meta_index.c 13 Jun 2003 06:44:04 -0000 1.8
--- meta_index.c 17 Nov 2003 09:00:18 -0000 1.9
***************
*** 958,963 ****
if(!index)
{
! META_ERROR("index is missing or an obsolete version");
! return IL_LOADERR_BAD_META;
}
--- 958,967 ----
if(!index)
{
! index = ILImageGetMetaEntry(image, "#-", &size);
! if(!index)
! {
! META_ERROR("index is missing or an obsolete version");
! return IL_LOADERR_BAD_META;
! }
}
Index: pecoff_loader.c
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/image/pecoff_loader.c,v
retrieving revision 1.19
retrieving revision 1.20
diff -C2 -d -r1.19 -r1.20
*** pecoff_loader.c 25 Sep 2003 01:19:04 -0000 1.19
--- pecoff_loader.c 17 Nov 2003 09:00:18 -0000 1.20
***************
*** 435,438 ****
--- 435,439 ----
int isMapped;
int isInPlace;
+ int isCorMeta;
void *mapAddress;
unsigned long mapLength;
***************
*** 609,612 ****
--- 610,614 ----
rsrcRVA = 0;
rsrcSize = 0;
+ isCorMeta = 0;
while(numSections > 0)
{
***************
*** 635,638 ****
--- 637,644 ----
/* Object files may set this field to zero */
newMap->virtSize = newMap->realSize;
+ if(!(newMap->virtAddr))
+ {
+ newMap->virtAddr = newMap->realAddr;
+ }
}
if(((newMap->virtAddr + newMap->virtSize) &
***************
*** 658,661 ****
--- 664,674 ----
base = newMap->virtAddr;
}
+ else if(!runtimeHdrSize && !ILMemCmp(buffer, ".cormeta", 8))
+ {
+ /* We are processing an object file that has the
+ IL data embedded within the ".cormeta" section */
+ base = newMap->virtAddr;
+ isCorMeta = 1;
+ }
else if(!ILMemCmp(buffer, ".ildebug", 8))
{
***************
*** 683,686 ****
--- 696,710 ----
rsrcSize = newMap->virtSize;
}
+ else if(!ILMemCmp(buffer, ".bss\0\0\0\0", 8))
+ {
+ /* Object files with ".cormeta" sections may have an
+ empty ".bss" section present. Ignore it when getting
+ the minimum and maximum sizes */
+ if(!(newMap->realAddr))
+ {
+ --numSections;
+ continue;
+ }
+ }
if(newMap->realSize > 0)
{
***************
*** 770,774 ****
while(newMap != 0)
{
! newMap->realAddr -= minAddress;
newMap = newMap->next;
}
--- 794,801 ----
while(newMap != 0)
{
! if(newMap->realAddr)
! {
! newMap->realAddr -= minAddress;
! }
newMap = newMap->next;
}
***************
*** 801,804 ****
--- 828,840 ----
}
}
+ else if(isCorMeta)
+ {
+ /* We are processing an object file that stores the metadata
+ header at the start of the ".cormeta" section */
+ runtimeHdrSize = 0;
+ hadNative = 0;
+ only32Bit = 0;
+ goto noRuntimeHeader;
+ }
else
{
***************
*** 843,846 ****
--- 879,883 ----
}
#endif
+ noRuntimeHeader:
/* Create and populate the ILImage structure */
***************
*** 1212,1217 ****
/* Subtract out the resources section, if present */
! addrTest = IL_READ_UINT32(runtimeHdr + 24);
! sizeTest = IL_READ_UINT32(runtimeHdr + 28);
if(addrTest != 0 && sizeTest != 0 && addrTest <
addrHighest)
{
--- 1249,1262 ----
/* Subtract out the resources section, if present */
! if(image->headerSize > 0)
! {
! addrTest = IL_READ_UINT32(runtimeHdr + 24);
! sizeTest = IL_READ_UINT32(runtimeHdr + 28);
! }
! else
! {
! addrTest = 0;
! sizeTest = 0;
! }
if(addrTest != 0 && sizeTest != 0 && addrTest <
addrHighest)
{
***************
*** 1242,1250 ****
/* Subtract out the metadata section, if present */
! addrTest = IL_READ_UINT32(runtimeHdr + 8);
! sizeTest = IL_READ_UINT32(runtimeHdr + 12);
! if(addrTest != 0 && sizeTest != 0)
{
! SubtractFromRange(&ranges, addrTest, addrTest +
sizeTest);
}
--- 1287,1298 ----
/* Subtract out the metadata section, if present */
! if(image->headerSize > 0)
{
! addrTest = IL_READ_UINT32(runtimeHdr + 8);
! sizeTest = IL_READ_UINT32(runtimeHdr + 12);
! if(addrTest != 0 && sizeTest != 0)
! {
! SubtractFromRange(&ranges, addrTest,
addrTest + sizeTest);
! }
}
***************
*** 1295,1300 ****
{
/* Locate the metadata section */
! *address = IL_READ_UINT32(runtimeHdr + 8);
! *size = IL_READ_UINT32(runtimeHdr + 12);
}
break;
--- 1343,1360 ----
{
/* Locate the metadata section */
! if(image->headerSize)
! {
! *address = IL_READ_UINT32(runtimeHdr + 8);
! *size = IL_READ_UINT32(runtimeHdr + 12);
! }
! else
! {
! *address = image->headerAddr;
! *size = TopOfVirtualRange(image->map, *address);
! if(*size > 0)
! {
! *size -= *address;
! }
! }
}
break;
***************
*** 1303,1306 ****
--- 1363,1372 ----
{
/* Locate the resources section */
+ if(!(image->headerSize))
+ {
+ *address = 0;
+ *size = 0;
+ break;
+ }
*address = IL_READ_UINT32(runtimeHdr + 24);
*size = IL_READ_UINT32(runtimeHdr + 28);
***************
*** 1327,1330 ****
--- 1393,1402 ----
{
/* Locate the strong name signature section */
+ if(!(image->headerSize))
+ {
+ *address = 0;
+ *size = 0;
+ break;
+ }
*address = IL_READ_UINT32(runtimeHdr + 32);
*size = IL_READ_UINT32(runtimeHdr + 36);
***************
*** 1335,1338 ****
--- 1407,1416 ----
{
/* Locate the code manager table section */
+ if(!(image->headerSize))
+ {
+ *address = 0;
+ *size = 0;
+ break;
+ }
*address = IL_READ_UINT32(runtimeHdr + 40);
*size = IL_READ_UINT32(runtimeHdr + 44);
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Dotgnu-pnet-commits] pnet/image meta_index.c, 1.8, 1.9 pecoff_loader.c, 1.19, 1.20,
Rhys Weatherley <address@hidden> <=