Back out most of last change

git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@1902 42af7a65-404d-4744-a932-0658087f49c3
This commit is contained in:
patacongo
2009-06-18 12:18:41 +00:00
parent 855a5845ee
commit b754962f81
4 changed files with 32 additions and 37 deletions
+5 -5
View File
@@ -73,11 +73,11 @@
int nxflat_init(const char *filename, struct nxflat_hdr_s *header, int nxflat_init(const char *filename, struct nxflat_hdr_s *header,
struct nxflat_loadinfo_s *loadinfo) struct nxflat_loadinfo_s *loadinfo)
{ {
uint32 datastart; uint32 datastart;
uint32 dataend; uint32 dataend;
uint32 bssstart; uint32 bssstart;
uint32 bssend; uint32 bssend;
int ret; int ret;
bvdbg("filename: %s header: %p loadinfo: %p\n", filename, header, loadinfo); bvdbg("filename: %s header: %p loadinfo: %p\n", filename, header, loadinfo);
+14 -14
View File
@@ -92,7 +92,7 @@ static const char *g_segment[] =
static void nxflat_reloc(struct nxflat_loadinfo_s *loadinfo, uint32 rl) static void nxflat_reloc(struct nxflat_loadinfo_s *loadinfo, uint32 rl)
{ {
uint32 *ptr; uint32 *ptr;
uint32 datastart; ubyte *datastart;
/* We only support relocations in the data sections. Verify that the /* We only support relocations in the data sections. Verify that the
* relocation address lies in the data section of the file image. * relocation address lies in the data section of the file image.
@@ -100,14 +100,14 @@ static void nxflat_reloc(struct nxflat_loadinfo_s *loadinfo, uint32 rl)
if (NXFLAT_RELOC_OFFSET(rl) > loadinfo->datasize) if (NXFLAT_RELOC_OFFSET(rl) > loadinfo->datasize)
{ {
bdbg("ERROR: Relocation at 0x%08x invalid -- " bdbg("ERROR: Relocation at %08x invalid -- "
"does not lie in the data segment, size=0x%08x\n", "does not lie in the data segment, size: %08x\n",
NXFLAT_RELOC_OFFSET(rl), loadinfo->datasize); NXFLAT_RELOC_OFFSET(rl), loadinfo->datasize);
bdbg(" Relocation not performed!\n"); bdbg(" Relocation not performed!\n");
} }
else if ((NXFLAT_RELOC_OFFSET(rl) & 0x00000003) != 0) else if ((NXFLAT_RELOC_OFFSET(rl) & 0x00000003) != 0)
{ {
bdbg("ERROR: Relocation at 0x%08x invalid -- " bdbg("ERROR: Relocation at %08x invalid -- "
"Improperly aligned\n", "Improperly aligned\n",
NXFLAT_RELOC_OFFSET(rl)); NXFLAT_RELOC_OFFSET(rl));
} }
@@ -118,7 +118,7 @@ static void nxflat_reloc(struct nxflat_loadinfo_s *loadinfo, uint32 rl)
* DSpace to hold information needed by ld.so at run time. * DSpace to hold information needed by ld.so at run time.
*/ */
datastart = (uint32)loadinfo->dspace->region; datastart = loadinfo->dspace->region;
/* Get a pointer to the value that needs relocation in /* Get a pointer to the value that needs relocation in
* DSpace. * DSpace.
@@ -126,8 +126,8 @@ static void nxflat_reloc(struct nxflat_loadinfo_s *loadinfo, uint32 rl)
ptr = (uint32*)(datastart + NXFLAT_RELOC_OFFSET(rl)); ptr = (uint32*)(datastart + NXFLAT_RELOC_OFFSET(rl));
bvdbg("Relocation of variable at DATASEG+0x%08x " bvdbg("Relocation of variable at DATASEG+%08x "
"(address 0x%p, currently 0x%08x) into segment %s\n", "(address %p, currently %08x) into segment %s\n",
NXFLAT_RELOC_OFFSET(rl), ptr, *ptr, SEGNAME(rl)); NXFLAT_RELOC_OFFSET(rl), ptr, *ptr, SEGNAME(rl));
switch (NXFLAT_RELOC_TYPE(rl)) switch (NXFLAT_RELOC_TYPE(rl))
@@ -153,7 +153,7 @@ static void nxflat_reloc(struct nxflat_loadinfo_s *loadinfo, uint32 rl)
case NXFLAT_RELOC_TYPE_DATA: case NXFLAT_RELOC_TYPE_DATA:
case NXFLAT_RELOC_TYPE_BSS: case NXFLAT_RELOC_TYPE_BSS:
*ptr += datastart; *ptr += (uint32)datastart;
break; break;
/* This case happens normally if the symbol is a weak /* This case happens normally if the symbol is a weak
@@ -165,11 +165,11 @@ static void nxflat_reloc(struct nxflat_loadinfo_s *loadinfo, uint32 rl)
break; break;
default: default:
bdbg("ERROR: Unknown relocation type=%d\n", NXFLAT_RELOC_TYPE(rl)); bdbg("ERROR: Unknown relocation type: %d\n", NXFLAT_RELOC_TYPE(rl));
break; break;
} }
bvdbg("Relocation became 0x%08x\n", *ptr); bvdbg("Relocation became %08x\n", *ptr);
} }
} }
@@ -186,7 +186,7 @@ int nxflat_load(struct nxflat_loadinfo_s *loadinfo)
off_t doffset; /* Offset to .data in the NXFLAT file */ off_t doffset; /* Offset to .data in the NXFLAT file */
uint32 *reloctab; /* Address of the relocation table */ uint32 *reloctab; /* Address of the relocation table */
uint32 dreadsize; /* Total number of bytes of .data to be read */ uint32 dreadsize; /* Total number of bytes of .data to be read */
uint32 ret = OK; int ret = OK;
int i; int i;
/* Calculate the extra space we need to allocate. This extra space will be /* Calculate the extra space we need to allocate. This extra space will be
@@ -251,7 +251,7 @@ int nxflat_load(struct nxflat_loadinfo_s *loadinfo)
return -errno; return -errno;
} }
bvdbg("Mapped ISpace (%d bytes) at 0x%08x\n", loadinfo->isize, loadinfo->ispace); bvdbg("Mapped ISpace (%d bytes) at %08x\n", loadinfo->isize, loadinfo->ispace);
/* The following call will give a pointer to the allocated but /* The following call will give a pointer to the allocated but
* uninitialized ISpace memory. * uninitialized ISpace memory.
@@ -279,7 +279,7 @@ int nxflat_load(struct nxflat_loadinfo_s *loadinfo)
goto errout; goto errout;
} }
bvdbg("TEXT=0x%x Entry point offset=0x%08x, datastart is 0x%08x\n", bvdbg("TEXT: %08x Entry point offset: %08x Data offset: %08x\n",
loadinfo->ispace, loadinfo->entryoffs, doffset); loadinfo->ispace, loadinfo->entryoffs, doffset);
/* Resolve the address of the relocation table. In the file, the /* Resolve the address of the relocation table. In the file, the
@@ -290,7 +290,7 @@ int nxflat_load(struct nxflat_loadinfo_s *loadinfo)
reloctab = (uint32*)(loadinfo->relocstart + (uint32)loadinfo->dspace->region - loadinfo->isize); reloctab = (uint32*)(loadinfo->relocstart + (uint32)loadinfo->dspace->region - loadinfo->isize);
bvdbg("Relocation table at 0x%p, reloccount=%d\n", bvdbg("Relocation table at %p, reloccount: %d\n",
reloctab, loadinfo->reloccount); reloctab, loadinfo->reloccount);
/* Now run through the relocation entries. */ /* Now run through the relocation entries. */
+1 -1
View File
@@ -79,7 +79,7 @@ int nxflat_verifyheader(const struct nxflat_hdr_s *header)
* silently. This is not our binary. * silently. This is not our binary.
*/ */
if (strncmp(header->h_magic, "NXFLAT", 4) != 0) if (strncmp(header->h_magic, NXFLAT_MAGIC, 4) != 0)
{ {
bdbg("Unrecognized magic=\"%c%c%c%c\"", bdbg("Unrecognized magic=\"%c%c%c%c\"",
header->h_magic[0], header->h_magic[1], header->h_magic[0], header->h_magic[1],
+12 -17
View File
@@ -47,18 +47,13 @@
* Pre-processor Definitions * Pre-processor Definitions
****************************************************************************/ ****************************************************************************/
#define NXFLAT_MAX_STRING_SIZE 64 /* Largest size of string (w/zterminator) */ #define NXFLAT_MAX_STRING_SIZE 64 /* Largest size of string (w/zterminator) */
#define NXFLAT_MAGIC "NxFT" /* NXFLAT magic number"
/**************************************************************************** /****************************************************************************
* Public Types * Public Types
****************************************************************************/ ****************************************************************************/
#ifdef CONFIG_NXFLAT_SMALL
typedef uint16 nxoff_t;
#else
typedef uint32 nxoff_t;
#endif
/**************************************************************************** /****************************************************************************
* The NXFLAT file header * The NXFLAT file header
* *
@@ -69,8 +64,8 @@
struct nxflat_hdr_s struct nxflat_hdr_s
{ {
/* The "magic number identifying the file type. This field should contain /* The "magic number" identifying the file type. This field should contain
* "NxFT". NOTE that there is not other versioning information other than * "NxFT". NOTE that there is no other versioning information other than
* this magic number. * this magic number.
*/ */
@@ -100,10 +95,10 @@ struct nxflat_hdr_s
* The bss segment is data_end through bss_end. * The bss segment is data_end through bss_end.
*/ */
nxoff_t h_entry; uint32 h_entry;
nxoff_t h_datastart; uint32 h_datastart;
nxoff_t h_dataend; uint32 h_dataend;
nxoff_t h_bssend; uint32 h_bssend;
/* Size of stack, in bytes */ /* Size of stack, in bytes */
@@ -116,8 +111,8 @@ struct nxflat_hdr_s
* h_reloccount - The number of relocation records in the arry * h_reloccount - The number of relocation records in the arry
*/ */
nxoff_t h_relocstart; /* Offset of relocation records */ uint32 h_relocstart; /* Offset of relocation records */
nxoff_t h_reloccount; /* Number of relocation records */ uint32 h_reloccount; /* Number of relocation records */
/* Imported symbol table (NOTE no symbols are exported) /* Imported symbol table (NOTE no symbols are exported)
* *
@@ -131,8 +126,8 @@ struct nxflat_hdr_s
* h_importcount - The number of records in the h_exportsymbols array. * h_importcount - The number of records in the h_exportsymbols array.
*/ */
nxoff_t h_importsymbols; /* Offset to list of imported symbols */ uint32 h_importsymbols; /* Offset to list of imported symbols */
uint16 h_importcount; /* Number of imported symbols */ uint16 h_importcount; /* Number of imported symbols */
}; };
/**************************************************************************** /****************************************************************************