Remove import symbols from relo table

git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@1930 42af7a65-404d-4744-a932-0658087f49c3
This commit is contained in:
patacongo 2009-06-23 18:55:57 +00:00
parent c34a013a0f
commit 65aa8ce26e
2 changed files with 9 additions and 22 deletions

View File

@ -186,9 +186,7 @@ static inline int nxflat_gotrelocs(FAR struct nxflat_loadinfo_s *loadinfo)
DEBUGASSERT(offset >= loadinfo->isize && offset < (loadinfo->isize + loadinfo->dsize)); DEBUGASSERT(offset >= loadinfo->isize && offset < (loadinfo->isize + loadinfo->dsize));
relocs = (FAR struct nxflat_reloc_s*)(offset - loadinfo->isize + loadinfo->dspace->region); relocs = (FAR struct nxflat_reloc_s*)(offset - loadinfo->isize + loadinfo->dspace->region);
/* Now, traverse the relocation list of imported symbols and attempt to bind /* Now, traverse the relocation list of and bind each GOT relocation. */
* each GOT relocation (imported symbols will be handled elsewhere).
*/
ret = OK; /* Assume success */ ret = OK; /* Assume success */
for (i = 0; i < nrelocs; i++) for (i = 0; i < nrelocs; i++)
@ -223,16 +221,10 @@ static inline int nxflat_gotrelocs(FAR struct nxflat_loadinfo_s *loadinfo)
} }
break; break;
/* NXFLAT_RELOC_TYPE_ABS32 Meaning: Offset refers to a struct nxflat_import_s default:
* describing a function pointer to be
* imported.
* Fixup: Provide the absolute function address
* in the struct nxflat_import_s instance.
*/
case NXFLAT_RELOC_TYPE_ABS32:
{ {
/* These will be handled together in nxflat_bindimports */ bdbg("ERROR: Unrecognized relocation type: %d\n", NXFLAT_RELOC_TYPE(reloc.r_info));
result = -EINVAL;
} }
break; break;
} }
@ -370,22 +362,18 @@ static inline int nxflat_bindimports(FAR struct nxflat_loadinfo_s *loadinfo,
int nxflat_bind(FAR struct nxflat_loadinfo_s *loadinfo, int nxflat_bind(FAR struct nxflat_loadinfo_s *loadinfo,
FAR const struct symtab_s *exports, int nexports) FAR const struct symtab_s *exports, int nexports)
{ {
/* First bind all GOT relocations (omitting absolute symbol relocations) */ /* First bind all GOT relocations */
int ret = nxflat_gotrelocs(loadinfo); int ret = nxflat_gotrelocs(loadinfo);
if (ret == OK) if (ret == OK)
{ {
/* Then bind the imported symbol, absolute relocations separately. /* Then bind the imported symbol, absolute relocations separately. */
* There is no particular reason to do these separately over than
* traversing the import list directly is simpler than traversing
* it indirectly through the relocation list.
*/
ret = nxflat_bindimports(loadinfo, exports, nexports); ret = nxflat_bindimports(loadinfo, exports, nexports);
if (ret == OK) if (ret == OK)
{ {
/* Zero the BSS area, trashing the relocations that lived in space /* Zero the BSS area, trashing the relocations that lived in that
* in the file. * space in the loaded file.
*/ */
memset((void*)(loadinfo->dspace->region + loadinfo->datasize), memset((void*)(loadinfo->dspace->region + loadinfo->datasize),

View File

@ -176,8 +176,7 @@ struct nxflat_reloc_s
#define NXFLAT_RELOC_TYPE_REL32I 0 #define NXFLAT_RELOC_TYPE_REL32I 0
#define NXFLAT_RELOC_TYPE_REL32D 1 #define NXFLAT_RELOC_TYPE_REL32D 1
#define NXFLAT_RELOC_TYPE_ABS32 2 #define NXFLAT_RELOC_TYPE_NUM 2 /* Number of relocation types */
#define NXFLAT_RELOC_TYPE_NUM 3 /* Number of relocation types */
/**************************************************************************** /****************************************************************************
* NXFLAT Imported symbol type * NXFLAT Imported symbol type