summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2009-06-25 12:44:55 +0000
committerpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2009-06-25 12:44:55 +0000
commit0ffd3b6c84610350f6880e044a2f64a4f8cf55d9 (patch)
treedcd56d76f7a8bdfa211661c803171d7d6c278a86
parent855e18e540b2973634c70dc2a90e306b1567b49c (diff)
downloadnuttx-0ffd3b6c84610350f6880e044a2f64a4f8cf55d9.tar.gz
nuttx-0ffd3b6c84610350f6880e044a2f64a4f8cf55d9.tar.bz2
nuttx-0ffd3b6c84610350f6880e044a2f64a4f8cf55d9.zip
Make all counts 16-bit
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@1946 42af7a65-404d-4744-a932-0658087f49c3
-rw-r--r--misc/buildroot/toolchain/nxflat/ldnxflat.c2
-rw-r--r--misc/buildroot/toolchain/nxflat/nxflat.h13
-rw-r--r--nuttx/binfmt/libnxflat/libnxflat_bind.c2
-rw-r--r--nuttx/binfmt/libnxflat/libnxflat_init.c2
-rw-r--r--nuttx/binfmt/nxflat.c2
-rw-r--r--nuttx/include/nuttx/nxflat.h2
-rw-r--r--nuttx/include/nxflat.h11
7 files changed, 22 insertions, 12 deletions
diff --git a/misc/buildroot/toolchain/nxflat/ldnxflat.c b/misc/buildroot/toolchain/nxflat/ldnxflat.c
index e600e4a94..30f98ee33 100644
--- a/misc/buildroot/toolchain/nxflat/ldnxflat.c
+++ b/misc/buildroot/toolchain/nxflat/ldnxflat.c
@@ -2207,7 +2207,7 @@ int main(int argc, char **argv, char **envp)
put_xflat32(&hdr.h_bssend, offset);
put_xflat32(&hdr.h_stacksize, stack_size);
- put_xflat32(&hdr.h_reloccount, ngot_offsets);
+ put_xflat16(&hdr.h_reloccount, ngot_offsets);
put_entry_point(&hdr);
diff --git a/misc/buildroot/toolchain/nxflat/nxflat.h b/misc/buildroot/toolchain/nxflat/nxflat.h
index fcdc17b0d..994a68421 100644
--- a/misc/buildroot/toolchain/nxflat/nxflat.h
+++ b/misc/buildroot/toolchain/nxflat/nxflat.h
@@ -108,25 +108,30 @@ struct nxflat_hdr_s
* h_relocstart - Offset to the beginning of an array of relocation
* records (struct nxflat_reloc). The offset is
* relative to the start of the file
- * h_reloccount - The number of relocation records in the arry
*/
u_int32_t h_relocstart; /* Offset of relocation records */
- u_int32_t h_reloccount; /* Number of relocation records */
/* Imported symbol table (NOTE no symbols are exported):
*
* h_importsymbols - Offset to the beginning of an array of imported
- * symbol structures (struct nxflat_import). The
+ * symbol structures (struct nxflat_import_s). The
* h_importsymbols offset is relative to the
* beginning of the file. Each entry of the
* array contains an uint32 offset (again from
* the beginning of the file) to the name of
* a symbol string. This string is null-terminated.
- * h_importcount - The number of records in the h_exportsymbols array.
*/
u_int32_t h_importsymbols; /* Offset to list of imported symbols */
+
+ /* 16-bit counts
+ *
+ * h_reloccount - The number of relocation records in the arry
+ * h_importcount - The number of records in the h_importsymbols array.
+ */
+
+ u_int16_t h_reloccount; /* Number of relocation records */
u_int16_t h_importcount; /* Number of imported symbols */
};
diff --git a/nuttx/binfmt/libnxflat/libnxflat_bind.c b/nuttx/binfmt/libnxflat/libnxflat_bind.c
index 1d0c8d661..4489ebfcd 100644
--- a/nuttx/binfmt/libnxflat/libnxflat_bind.c
+++ b/nuttx/binfmt/libnxflat/libnxflat_bind.c
@@ -220,7 +220,7 @@ static inline int nxflat_gotrelocs(FAR struct nxflat_loadinfo_s *loadinfo)
/* From this, we can get the offset to the list of relocation entries */
offset = ntohl(hdr->h_relocstart);
- nrelocs = ntohl(hdr->h_reloccount);
+ nrelocs = ntohs(hdr->h_reloccount);
/* The value of the relocation list that we get from the header is a
* file offset. We will have to convert this to an offset into the
diff --git a/nuttx/binfmt/libnxflat/libnxflat_init.c b/nuttx/binfmt/libnxflat/libnxflat_init.c
index 8bc9aef99..6a7a98748 100644
--- a/nuttx/binfmt/libnxflat/libnxflat_init.c
+++ b/nuttx/binfmt/libnxflat/libnxflat_init.c
@@ -168,7 +168,7 @@ int nxflat_init(const char *filename, struct nxflat_hdr_s *header,
*/
loadinfo->relocstart = ntohl(header->h_relocstart);
- loadinfo->reloccount = ntohl(header->h_reloccount);
+ loadinfo->reloccount = ntohs(header->h_reloccount);
return 0;
}
diff --git a/nuttx/binfmt/nxflat.c b/nuttx/binfmt/nxflat.c
index 8aee2fdd0..534f18cae 100644
--- a/nuttx/binfmt/nxflat.c
+++ b/nuttx/binfmt/nxflat.c
@@ -123,7 +123,7 @@ static void nxflat_dumploadinfo(struct nxflat_loadinfo_s *loadinfo)
bdbg(" RELOCS:\n");
bdbg(" relocstart: %08lx\n", loadinfo->relocstart);
- bdbg(" reloccount: %08lx\n", loadinfo->reloccount);
+ bdbg(" reloccount: %04lx\n", loadinfo->reloccount);
bdbg(" HANDLES:\n");
bdbg(" filfd: %d\n", loadinfo->filfd);
diff --git a/nuttx/include/nuttx/nxflat.h b/nuttx/include/nuttx/nxflat.h
index 779d1ade8..8c43917ce 100644
--- a/nuttx/include/nuttx/nxflat.h
+++ b/nuttx/include/nuttx/nxflat.h
@@ -81,7 +81,7 @@ struct nxflat_loadinfo_s
/* This is temporary memory where relocation records will be loaded. */
uint32 relocstart; /* Start of array of struct flat_reloc */
- uint32 reloccount; /* Number of elements in reloc array */
+ uint16 reloccount; /* Number of elements in reloc array */
/* File descriptors */
diff --git a/nuttx/include/nxflat.h b/nuttx/include/nxflat.h
index f65310244..8e551b252 100644
--- a/nuttx/include/nxflat.h
+++ b/nuttx/include/nxflat.h
@@ -109,11 +109,9 @@ struct nxflat_hdr_s
* h_relocstart - Offset to the beginning of an array of relocation
* records (struct nxflat_reloc). The offset is
* relative to the start of the file
- * h_reloccount - The number of relocation records in the arry
*/
uint32 h_relocstart; /* Offset of relocation records */
- uint32 h_reloccount; /* Number of relocation records */
/* Imported symbol table (NOTE no symbols are exported):
*
@@ -124,10 +122,17 @@ struct nxflat_hdr_s
* array contains an uint32 offset (again from
* the beginning of the file) to the name of
* a symbol string. This string is null-terminated.
- * h_importcount - The number of records in the h_exportsymbols array.
*/
uint32 h_importsymbols; /* Offset to list of imported symbols */
+
+ /* 16-bit counts
+ *
+ * h_reloccount - The number of relocation records in the arry
+ * h_importcount - The number of records in the h_importsymbols array.
+ */
+
+ uint16 h_reloccount; /* Number of relocation records */
uint16 h_importcount; /* Number of imported symbols */
};