2000-05-28 13:40:48 +00:00
|
|
|
/*****************************************************************************/
|
|
|
|
/* */
|
|
|
|
/* objdata.h */
|
|
|
|
/* */
|
|
|
|
/* Handling object file data for the ld65 linker */
|
|
|
|
/* */
|
|
|
|
/* */
|
|
|
|
/* */
|
2011-01-24 22:39:07 +00:00
|
|
|
/* (C) 1998-2011, Ullrich von Bassewitz */
|
2010-07-30 20:58:51 +00:00
|
|
|
/* Roemerstrasse 52 */
|
|
|
|
/* D-70794 Filderstadt */
|
|
|
|
/* EMail: uz@cc65.org */
|
2000-05-28 13:40:48 +00:00
|
|
|
/* */
|
|
|
|
/* */
|
|
|
|
/* This software is provided 'as-is', without any expressed or implied */
|
|
|
|
/* warranty. In no event will the authors be held liable for any damages */
|
|
|
|
/* arising from the use of this software. */
|
|
|
|
/* */
|
|
|
|
/* Permission is granted to anyone to use this software for any purpose, */
|
|
|
|
/* including commercial applications, and to alter it and redistribute it */
|
|
|
|
/* freely, subject to the following restrictions: */
|
|
|
|
/* */
|
|
|
|
/* 1. The origin of this software must not be misrepresented; you must not */
|
|
|
|
/* claim that you wrote the original software. If you use this software */
|
|
|
|
/* in a product, an acknowledgment in the product documentation would be */
|
|
|
|
/* appreciated but is not required. */
|
|
|
|
/* 2. Altered source versions must be plainly marked as such, and must not */
|
|
|
|
/* be misrepresented as being the original software. */
|
|
|
|
/* 3. This notice may not be removed or altered from any source */
|
|
|
|
/* distribution. */
|
|
|
|
/* */
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#ifndef OBJDATA_H
|
|
|
|
#define OBJDATA_H
|
|
|
|
|
|
|
|
|
|
|
|
|
2000-08-02 13:23:06 +00:00
|
|
|
/* common */
|
2003-06-05 16:50:01 +00:00
|
|
|
#include "coll.h"
|
2003-11-28 22:12:14 +00:00
|
|
|
#include "inline.h"
|
2000-08-02 13:23:06 +00:00
|
|
|
#include "objdefs.h"
|
2000-05-28 13:40:48 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
/* Data */
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* Values for the Flags field */
|
|
|
|
#define OBJ_REF 0x0001 /* We have a reference to this file */
|
|
|
|
|
|
|
|
/* Internal structure holding object file data */
|
2000-11-02 22:11:25 +00:00
|
|
|
typedef struct ObjData ObjData;
|
|
|
|
struct ObjData {
|
2003-06-05 16:50:01 +00:00
|
|
|
ObjData* Next; /* Linked list of all objects */
|
|
|
|
unsigned Name; /* Module name */
|
|
|
|
unsigned LibName; /* Name of library */
|
|
|
|
unsigned long MTime; /* Time of last modification */
|
2000-11-02 22:11:25 +00:00
|
|
|
ObjHeader Header; /* Header of file */
|
2003-11-28 22:12:14 +00:00
|
|
|
unsigned long Start; /* Start offset of data in library */
|
2000-05-28 13:40:48 +00:00
|
|
|
unsigned Flags;
|
2010-07-30 20:58:51 +00:00
|
|
|
Collection Files; /* List of input files */
|
|
|
|
Collection Sections; /* List of all sections */
|
|
|
|
Collection Exports; /* List of all exports */
|
|
|
|
Collection Imports; /* List of all imports */
|
|
|
|
Collection DbgSyms; /* List of debug symbols */
|
2011-01-24 22:39:07 +00:00
|
|
|
Collection LineInfos; /* List of line infos */
|
2003-05-25 17:57:50 +00:00
|
|
|
unsigned StringCount; /* Count of strings */
|
2003-06-06 06:50:27 +00:00
|
|
|
unsigned* Strings; /* List of global string indices */
|
2010-07-30 20:58:51 +00:00
|
|
|
Collection Assertions; /* List of module assertions */
|
|
|
|
Collection Scopes; /* List of scopes */
|
2000-05-28 13:40:48 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
2003-06-05 16:50:01 +00:00
|
|
|
/* Collection containing used ObjData objects */
|
|
|
|
extern Collection ObjDataList;
|
2000-05-28 13:40:48 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
2003-06-05 16:50:01 +00:00
|
|
|
/* Code */
|
2000-05-28 13:40:48 +00:00
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ObjData* NewObjData (void);
|
|
|
|
/* Allocate a new structure on the heap, insert it into the list, return it */
|
|
|
|
|
2003-06-05 16:50:01 +00:00
|
|
|
void FreeObjData (ObjData* O);
|
|
|
|
/* Free an ObjData object. NOTE: This function works only for unused object
|
|
|
|
* data, that is, ObjData objects that aren't used because they aren't
|
|
|
|
* referenced.
|
|
|
|
*/
|
|
|
|
|
2003-06-04 12:40:14 +00:00
|
|
|
void FreeObjStrings (ObjData* O);
|
|
|
|
/* Free the module string data. Used once the object file is loaded completely
|
|
|
|
* when all strings are converted to global strings.
|
|
|
|
*/
|
|
|
|
|
2003-06-05 16:50:01 +00:00
|
|
|
void InsertObjData (ObjData* O);
|
|
|
|
/* Insert the ObjData object into the collection of used ObjData objects. */
|
|
|
|
|
2003-06-06 12:45:19 +00:00
|
|
|
void InsertObjGlobals (ObjData* O);
|
|
|
|
/* Insert imports and exports from the object file into the global import and
|
|
|
|
* export lists.
|
|
|
|
*/
|
|
|
|
|
2003-06-04 12:40:14 +00:00
|
|
|
unsigned MakeGlobalStringId (const ObjData* O, unsigned Index);
|
|
|
|
/* Convert a local string id into a global one and return it. */
|
|
|
|
|
2000-11-20 21:56:48 +00:00
|
|
|
const char* GetObjFileName (const ObjData* O);
|
2000-11-23 19:14:15 +00:00
|
|
|
/* Get the name of the object file. Return "[linker generated]" if the object
|
2000-11-20 21:56:48 +00:00
|
|
|
* file is NULL.
|
|
|
|
*/
|
|
|
|
|
2003-11-28 22:12:14 +00:00
|
|
|
#if defined(HAVE_INLINE)
|
|
|
|
INLINE int ObjHasFiles (const ObjData* O)
|
|
|
|
/* Return true if the files list does exist */
|
|
|
|
{
|
2010-07-30 20:58:51 +00:00
|
|
|
return (O != 0 && CollCount (&O->Files) != 0);
|
2003-11-28 22:12:14 +00:00
|
|
|
}
|
2003-12-22 20:39:15 +00:00
|
|
|
#else
|
2010-07-31 12:37:14 +00:00
|
|
|
# define ObjHasFiles(O) ((O) != 0 && CollCount (&(O)->Files) != 0)
|
2003-11-28 22:12:14 +00:00
|
|
|
#endif
|
|
|
|
|
2000-05-28 13:40:48 +00:00
|
|
|
|
|
|
|
|
|
|
|
/* End of objdata.h */
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
|
2000-11-02 22:11:25 +00:00
|
|
|
|
2001-05-23 19:03:40 +00:00
|
|
|
|