From f44c80d64924b5796a547d2d4e787591da58726d Mon Sep 17 00:00:00 2001 From: patacongo Date: Wed, 17 Jun 2009 22:13:21 +0000 Subject: Remove bitfields from NXFLAT definition git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@1897 42af7a65-404d-4744-a932-0658087f49c3 --- nuttx/binfmt/libnxflat/libnxflat_load.c | 32 ++++++++++---------------------- 1 file changed, 10 insertions(+), 22 deletions(-) (limited to 'nuttx/binfmt') diff --git a/nuttx/binfmt/libnxflat/libnxflat_load.c b/nuttx/binfmt/libnxflat/libnxflat_load.c index 8f9da18cb..77ced1b64 100644 --- a/nuttx/binfmt/libnxflat/libnxflat_load.c +++ b/nuttx/binfmt/libnxflat/libnxflat_load.c @@ -87,37 +87,25 @@ static const char *g_segment[] = static void nxflat_reloc(struct nxflat_loadinfo_s *loadinfo, uint32 rl) { - union - { - uint32 l; - struct nxflat_reloc_s s; - } reloc; uint32 *ptr; uint32 datastart; - /* Force the long value into a union so that we can strip off some - * bit-encoded values. - */ - - reloc.l = rl; - - /* We only support relocations in the data sections. - * Verify that the the relocation address lies in the data - * section of the file image. + /* We only support relocations in the data sections. Verify that the + * relocation address lies in the data section of the file image. */ - if (reloc.s.r_offset > loadinfo->datasize) + if (NXFLAT_RELOC_OFFSET(rl) > loadinfo->datasize) { bdbg("ERROR: Relocation at 0x%08x invalid -- " "does not lie in the data segment, size=0x%08x\n", - reloc.s.r_offset, loadinfo->datasize); + NXFLAT_RELOC_OFFSET(rl), loadinfo->datasize); bdbg(" Relocation not performed!\n"); } - else if ((reloc.s.r_offset & 0x00000003) != 0) + else if ((NXFLAT_RELOC_OFFSET(rl) & 0x00000003) != 0) { bdbg("ERROR: Relocation at 0x%08x invalid -- " "Improperly aligned\n", - reloc.s.r_offset); + NXFLAT_RELOC_OFFSET(rl)); } else { @@ -132,13 +120,13 @@ static void nxflat_reloc(struct nxflat_loadinfo_s *loadinfo, uint32 rl) * DSpace. */ - ptr = (uint32*)(datastart + reloc.s.r_offset); + ptr = (uint32*)(datastart + NXFLAT_RELOC_OFFSET(rl)); bvdbg("Relocation of variable at DATASEG+0x%08x " "(address 0x%p, currently 0x%08x) into segment %s\n", - reloc.s.r_offset, ptr, *ptr, g_segment[reloc.s.r_type]); + NXFLAT_RELOC_OFFSET(rl), ptr, *ptr, g_segment[NXFLAT_RELOC_TYPE(rl)]); - switch (reloc.s.r_type) + switch (NXFLAT_RELOC_TYPE(rl)) { /* TEXT is located at an offset of sizeof(struct nxflat_hdr_s) from * the allocated/mapped ISpace region. @@ -173,7 +161,7 @@ static void nxflat_reloc(struct nxflat_loadinfo_s *loadinfo, uint32 rl) break; default: - bdbg("ERROR: Unknown relocation type=%d\n", reloc.s.r_type); + bdbg("ERROR: Unknown relocation type=%d\n", NXFLAT_RELOC_TYPE(rl)); break; } -- cgit v1.2.3